xref: /openssl/crypto/md5/asm/md5-aarch64.pl (revision ad347c9f)
1#! /usr/bin/env perl
2# Copyright 2021-2023 The OpenSSL Project Authors. All Rights Reserved.
3#
4# Licensed under the Apache License 2.0 (the "License").  You may not use
5# this file except in compliance with the License.  You can obtain a copy
6# in the file LICENSE in the source distribution or at
7# https://www.openssl.org/source/license.html
8
9# MD5 optimized for aarch64.
10
11use strict;
12
13my $code;
14
15#no warnings qw(uninitialized);
16# $output is the last argument if it looks like a file (it has an extension)
17# $flavour is the first argument if it doesn't look like a file
18my $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
19my $flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
20
21$0 =~ m/(.*[\/\\])[^\/\\]+$/; my $dir=$1; my $xlate;
22( $xlate="${dir}arm-xlate.pl" and -f $xlate ) or
23( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or
24die "can't locate arm-xlate.pl";
25
26open OUT,"| \"$^X\" $xlate $flavour \"$output\""
27    or die "can't call $xlate: $1";
28*STDOUT=*OUT;
29
30$code .= <<EOF;
31#include "arm_arch.h"
32
33.text
34.globl  ossl_md5_block_asm_data_order
35.type   ossl_md5_block_asm_data_order,\@function
36ossl_md5_block_asm_data_order:
37        AARCH64_VALID_CALL_TARGET
38        // Save all callee-saved registers
39        stp     x19,x20,[sp,#-80]!
40        stp     x21,x22,[sp,#16]
41        stp     x23,x24,[sp,#32]
42        stp     x25,x26,[sp,#48]
43        stp     x27,x28,[sp,#64]
44
45        ldp w10, w11, [x0, #0]        // Load MD5 state->A and state->B
46        ldp w12, w13, [x0, #8]        // Load MD5 state->C and state->D
47.align 5
48ossl_md5_blocks_loop:
49        eor x17, x12, x13             // Begin aux function round 1 F(x,y,z)=(((y^z)&x)^z)
50        and x16, x17, x11             // Continue aux function round 1 F(x,y,z)=(((y^z)&x)^z)
51        ldp w15, w20, [x1]            // Load 2 words of input data0 M[0],M[1]
52        ldp w3, w21, [x1, #8]        // Load 2 words of input data0 M[2],M[3]
53#ifdef __AARCH64EB__
54        rev w15, w15
55        rev w20, w20
56        rev w3, w3
57        rev w21, w21
58#endif
59        eor x14, x16, x13             // End aux function round 1 F(x,y,z)=(((y^z)&x)^z)
60        movz x9, #0xa478              // Load lower half of constant 0xd76aa478
61        movk x9, #0xd76a, lsl #16     // Load upper half of constant 0xd76aa478
62        add w8, w10, w15              // Add dest value
63        add w7, w8, w9                // Add constant 0xd76aa478
64        add w6, w7, w14               // Add aux function result
65        ror w6, w6, #25               // Rotate left s=7 bits
66        eor x5, x11, x12              // Begin aux function round 1 F(x,y,z)=(((y^z)&x)^z)
67        add w4, w11, w6               // Add X parameter round 1 A=FF(A, B, C, D, 0xd76aa478, s=7, M[0])
68        and x8, x5, x4                // Continue aux function round 1 F(x,y,z)=(((y^z)&x)^z)
69        eor x17, x8, x12              // End aux function round 1 F(x,y,z)=(((y^z)&x)^z)
70        movz x16, #0xb756             // Load lower half of constant 0xe8c7b756
71        movk x16, #0xe8c7, lsl #16    // Load upper half of constant 0xe8c7b756
72        add w9, w13, w20              // Add dest value
73        add w7, w9, w16               // Add constant 0xe8c7b756
74        add w14, w7, w17              // Add aux function result
75        ror w14, w14, #20             // Rotate left s=12 bits
76        eor x6, x4, x11               // Begin aux function round 1 F(x,y,z)=(((y^z)&x)^z)
77        add w5, w4, w14               // Add X parameter round 1 D=FF(D, A, B, C, 0xe8c7b756, s=12, M[1])
78        and x8, x6, x5                // Continue aux function round 1 F(x,y,z)=(((y^z)&x)^z)
79        eor x9, x8, x11               // End aux function round 1 F(x,y,z)=(((y^z)&x)^z)
80        movz x16, #0x70db             // Load lower half of constant 0x242070db
81        movk x16, #0x2420, lsl #16    // Load upper half of constant 0x242070db
82        add w7, w12, w3               // Add dest value
83        add w17, w7, w16              // Add constant 0x242070db
84        add w14, w17, w9              // Add aux function result
85        ror w14, w14, #15             // Rotate left s=17 bits
86        eor x6, x5, x4                // Begin aux function round 1 F(x,y,z)=(((y^z)&x)^z)
87        add w8, w5, w14               // Add X parameter round 1 C=FF(C, D, A, B, 0x242070db, s=17, M[2])
88        and x7, x6, x8                // Continue aux function round 1 F(x,y,z)=(((y^z)&x)^z)
89        eor x16, x7, x4               // End aux function round 1 F(x,y,z)=(((y^z)&x)^z)
90        movz x9, #0xceee              // Load lower half of constant 0xc1bdceee
91        movk x9, #0xc1bd, lsl #16     // Load upper half of constant 0xc1bdceee
92        add w14, w11, w21             // Add dest value
93        add w6, w14, w9               // Add constant 0xc1bdceee
94        add w7, w6, w16               // Add aux function result
95        ror w7, w7, #10               // Rotate left s=22 bits
96        eor x17, x8, x5               // Begin aux function round 1 F(x,y,z)=(((y^z)&x)^z)
97        add w9, w8, w7                // Add X parameter round 1 B=FF(B, C, D, A, 0xc1bdceee, s=22, M[3])
98        ldp w14, w22, [x1, #16]       // Load 2 words of input data0 M[4],M[5]
99        ldp w7, w23, [x1, #24]        // Load 2 words of input data0 M[6],M[7]
100#ifdef __AARCH64EB__
101        rev w14, w14
102        rev w22, w22
103        rev w7, w7
104        rev w23, w23
105#endif
106        and x16, x17, x9              // Continue aux function round 1 F(x,y,z)=(((y^z)&x)^z)
107        eor x6, x16, x5               // End aux function round 1 F(x,y,z)=(((y^z)&x)^z)
108        movz x16, #0xfaf              // Load lower half of constant 0xf57c0faf
109        movk x16, #0xf57c, lsl #16    // Load upper half of constant 0xf57c0faf
110        add w17, w4, w14              // Add dest value
111        add w16, w17, w16             // Add constant 0xf57c0faf
112        add w4, w16, w6               // Add aux function result
113        ror w4, w4, #25               // Rotate left s=7 bits
114        eor x16, x9, x8               // Begin aux function round 1 F(x,y,z)=(((y^z)&x)^z)
115        add w17, w9, w4               // Add X parameter round 1 A=FF(A, B, C, D, 0xf57c0faf, s=7, M[4])
116        and x16, x16, x17             // Continue aux function round 1 F(x,y,z)=(((y^z)&x)^z)
117        eor x6, x16, x8               // End aux function round 1 F(x,y,z)=(((y^z)&x)^z)
118        movz x4, #0xc62a              // Load lower half of constant 0x4787c62a
119        movk x4, #0x4787, lsl #16     // Load upper half of constant 0x4787c62a
120        add w16, w5, w22              // Add dest value
121        add w16, w16, w4              // Add constant 0x4787c62a
122        add w5, w16, w6               // Add aux function result
123        ror w5, w5, #20               // Rotate left s=12 bits
124        eor x4, x17, x9               // Begin aux function round 1 F(x,y,z)=(((y^z)&x)^z)
125        add w19, w17, w5              // Add X parameter round 1 D=FF(D, A, B, C, 0x4787c62a, s=12, M[5])
126        and x6, x4, x19               // Continue aux function round 1 F(x,y,z)=(((y^z)&x)^z)
127        eor x5, x6, x9                // End aux function round 1 F(x,y,z)=(((y^z)&x)^z)
128        movz x4, #0x4613              // Load lower half of constant 0xa8304613
129        movk x4, #0xa830, lsl #16     // Load upper half of constant 0xa8304613
130        add w6, w8, w7                // Add dest value
131        add w8, w6, w4                // Add constant 0xa8304613
132        add w4, w8, w5                // Add aux function result
133        ror w4, w4, #15               // Rotate left s=17 bits
134        eor x6, x19, x17              // Begin aux function round 1 F(x,y,z)=(((y^z)&x)^z)
135        add w8, w19, w4               // Add X parameter round 1 C=FF(C, D, A, B, 0xa8304613, s=17, M[6])
136        and x5, x6, x8                // Continue aux function round 1 F(x,y,z)=(((y^z)&x)^z)
137        eor x4, x5, x17               // End aux function round 1 F(x,y,z)=(((y^z)&x)^z)
138        movz x6, #0x9501              // Load lower half of constant 0xfd469501
139        movk x6, #0xfd46, lsl #16     // Load upper half of constant 0xfd469501
140        add w9, w9, w23               // Add dest value
141        add w5, w9, w6                // Add constant 0xfd469501
142        add w9, w5, w4                // Add aux function result
143        ror w9, w9, #10               // Rotate left s=22 bits
144        eor x6, x8, x19               // Begin aux function round 1 F(x,y,z)=(((y^z)&x)^z)
145        add w4, w8, w9                // Add X parameter round 1 B=FF(B, C, D, A, 0xfd469501, s=22, M[7])
146        ldp w5, w24, [x1, #32]        // Load 2 words of input data0 M[8],M[9]
147        ldp w16, w25, [x1, #40]        // Load 2 words of input data0 M[10],M[11]
148#ifdef __AARCH64EB__
149        rev w5, w5
150        rev w24, w24
151        rev w16, w16
152        rev w25, w25
153#endif
154        and x9, x6, x4                // Continue aux function round 1 F(x,y,z)=(((y^z)&x)^z)
155        eor x6, x9, x19               // End aux function round 1 F(x,y,z)=(((y^z)&x)^z)
156        movz x9, #0x98d8              // Load lower half of constant 0x698098d8
157        movk x9, #0x6980, lsl #16     // Load upper half of constant 0x698098d8
158        add w17, w17, w5              // Add dest value
159        add w9, w17, w9               // Add constant 0x698098d8
160        add w17, w9, w6               // Add aux function result
161        ror w17, w17, #25             // Rotate left s=7 bits
162        eor x9, x4, x8                // Begin aux function round 1 F(x,y,z)=(((y^z)&x)^z)
163        add w6, w4, w17               // Add X parameter round 1 A=FF(A, B, C, D, 0x698098d8, s=7, M[8])
164        and x17, x9, x6               // Continue aux function round 1 F(x,y,z)=(((y^z)&x)^z)
165        eor x9, x17, x8               // End aux function round 1 F(x,y,z)=(((y^z)&x)^z)
166        movz x17, #0xf7af             // Load lower half of constant 0x8b44f7af
167        movk x17, #0x8b44, lsl #16    // Load upper half of constant 0x8b44f7af
168        add w19, w19, w24             // Add dest value
169        add w17, w19, w17             // Add constant 0x8b44f7af
170        add w19, w17, w9              // Add aux function result
171        ror w19, w19, #20             // Rotate left s=12 bits
172        eor x9, x6, x4                // Begin aux function round 1 F(x,y,z)=(((y^z)&x)^z)
173        add w17, w6, w19              // Add X parameter round 1 D=FF(D, A, B, C, 0x8b44f7af, s=12, M[9])
174        and x9, x9, x17               // Continue aux function round 1 F(x,y,z)=(((y^z)&x)^z)
175        eor x9, x9, x4                // End aux function round 1 F(x,y,z)=(((y^z)&x)^z)
176        movz x11, #0x5bb1             // Load lower half of constant 0xffff5bb1
177        movk x11, #0xffff, lsl #16    // Load upper half of constant 0xffff5bb1
178        add w8, w8, w16               // Add dest value
179        add w8, w8, w11               // Add constant 0xffff5bb1
180        add w8, w8, w9                // Add aux function result
181        ror w8, w8, #15               // Rotate left s=17 bits
182        eor x9, x17, x6               // Begin aux function round 1 F(x,y,z)=(((y^z)&x)^z)
183        add w8, w17, w8               // Add X parameter round 1 C=FF(C, D, A, B, 0xffff5bb1, s=17, M[10])
184        and x9, x9, x8                // Continue aux function round 1 F(x,y,z)=(((y^z)&x)^z)
185        eor x9, x9, x6                // End aux function round 1 F(x,y,z)=(((y^z)&x)^z)
186        movz x11, #0xd7be             // Load lower half of constant 0x895cd7be
187        movk x11, #0x895c, lsl #16    // Load upper half of constant 0x895cd7be
188        add w4, w4, w25               // Add dest value
189        add w4, w4, w11               // Add constant 0x895cd7be
190        add w9, w4, w9                // Add aux function result
191        ror w9, w9, #10               // Rotate left s=22 bits
192        eor x4, x8, x17               // Begin aux function round 1 F(x,y,z)=(((y^z)&x)^z)
193        add w9, w8, w9                // Add X parameter round 1 B=FF(B, C, D, A, 0x895cd7be, s=22, M[11])
194        ldp w11, w26, [x1, #48]       // Load 2 words of input data0 M[12],M[13]
195        ldp w12, w27, [x1, #56]       // Load 2 words of input data0 M[14],M[15]
196#ifdef __AARCH64EB__
197        rev w11, w11
198        rev w26, w26
199        rev w12, w12
200        rev w27, w27
201#endif
202        and x4, x4, x9                // Continue aux function round 1 F(x,y,z)=(((y^z)&x)^z)
203        eor x4, x4, x17               // End aux function round 1 F(x,y,z)=(((y^z)&x)^z)
204        movz x19, #0x1122             // Load lower half of constant 0x6b901122
205        movk x19, #0x6b90, lsl #16    // Load upper half of constant 0x6b901122
206        add w6, w6, w11               // Add dest value
207        add w6, w6, w19               // Add constant 0x6b901122
208        add w4, w6, w4                // Add aux function result
209        ror w4, w4, #25               // Rotate left s=7 bits
210        eor x6, x9, x8                // Begin aux function round 1 F(x,y,z)=(((y^z)&x)^z)
211        add w4, w9, w4                // Add X parameter round 1 A=FF(A, B, C, D, 0x6b901122, s=7, M[12])
212        and x6, x6, x4                // Continue aux function round 1 F(x,y,z)=(((y^z)&x)^z)
213        eor x6, x6, x8                // End aux function round 1 F(x,y,z)=(((y^z)&x)^z)
214        movz x19, #0x7193             // Load lower half of constant 0xfd987193
215        movk x19, #0xfd98, lsl #16    // Load upper half of constant 0xfd987193
216        add w17, w17, w26             // Add dest value
217        add w17, w17, w19             // Add constant 0xfd987193
218        add w17, w17, w6              // Add aux function result
219        ror w17, w17, #20             // Rotate left s=12 bits
220        eor x6, x4, x9                // Begin aux function round 1 F(x,y,z)=(((y^z)&x)^z)
221        add w17, w4, w17              // Add X parameter round 1 D=FF(D, A, B, C, 0xfd987193, s=12, M[13])
222        and x6, x6, x17               // Continue aux function round 1 F(x,y,z)=(((y^z)&x)^z)
223        eor x6, x6, x9                // End aux function round 1 F(x,y,z)=(((y^z)&x)^z)
224        movz x13, #0x438e             // Load lower half of constant 0xa679438e
225        movk x13, #0xa679, lsl #16    // Load upper half of constant 0xa679438e
226        add w8, w8, w12               // Add dest value
227        add w8, w8, w13               // Add constant 0xa679438e
228        add w8, w8, w6                // Add aux function result
229        ror w8, w8, #15               // Rotate left s=17 bits
230        eor x6, x17, x4               // Begin aux function round 1 F(x,y,z)=(((y^z)&x)^z)
231        add w8, w17, w8               // Add X parameter round 1 C=FF(C, D, A, B, 0xa679438e, s=17, M[14])
232        and x6, x6, x8                // Continue aux function round 1 F(x,y,z)=(((y^z)&x)^z)
233        eor x6, x6, x4                // End aux function round 1 F(x,y,z)=(((y^z)&x)^z)
234        movz x13, #0x821              // Load lower half of constant 0x49b40821
235        movk x13, #0x49b4, lsl #16    // Load upper half of constant 0x49b40821
236        add w9, w9, w27               // Add dest value
237        add w9, w9, w13               // Add constant 0x49b40821
238        add w9, w9, w6                // Add aux function result
239        ror w9, w9, #10               // Rotate left s=22 bits
240        bic x6, x8, x17               // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
241        add w9, w8, w9                // Add X parameter round 1 B=FF(B, C, D, A, 0x49b40821, s=22, M[15])
242        and x13, x9, x17              // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
243        orr x6, x6, x13               // End aux function round 2 G(x,y,z)=((x&z)|(~z&y))
244        movz x13, #0x2562             // Load lower half of constant 0xf61e2562
245        movk x13, #0xf61e, lsl #16    // Load upper half of constant 0xf61e2562
246        add w4, w4, w20               // Add dest value
247        add w4, w4, w13               // Add constant 0xf61e2562
248        add w4, w4, w6                // Add aux function result
249        ror w4, w4, #27               // Rotate left s=5 bits
250        bic x6, x9, x8                // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
251        add w4, w9, w4                // Add X parameter round 2 A=GG(A, B, C, D, 0xf61e2562, s=5, M[1])
252        and x13, x4, x8               // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
253        orr x6, x6, x13               // End aux function round 2 G(x,y,z)=((x&z)|(~z&y))
254        movz x13, #0xb340             // Load lower half of constant 0xc040b340
255        movk x13, #0xc040, lsl #16    // Load upper half of constant 0xc040b340
256        add w17, w17, w7              // Add dest value
257        add w17, w17, w13             // Add constant 0xc040b340
258        add w17, w17, w6              // Add aux function result
259        ror w17, w17, #23             // Rotate left s=9 bits
260        bic x6, x4, x9                // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
261        add w17, w4, w17              // Add X parameter round 2 D=GG(D, A, B, C, 0xc040b340, s=9, M[6])
262        and x13, x17, x9              // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
263        orr x6, x6, x13               // End aux function round 2 G(x,y,z)=((x&z)|(~z&y))
264        movz x13, #0x5a51             // Load lower half of constant 0x265e5a51
265        movk x13, #0x265e, lsl #16    // Load upper half of constant 0x265e5a51
266        add w8, w8, w25               // Add dest value
267        add w8, w8, w13               // Add constant 0x265e5a51
268        add w8, w8, w6                // Add aux function result
269        ror w8, w8, #18               // Rotate left s=14 bits
270        bic x6, x17, x4               // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
271        add w8, w17, w8               // Add X parameter round 2 C=GG(C, D, A, B, 0x265e5a51, s=14, M[11])
272        and x13, x8, x4               // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
273        orr x6, x6, x13               // End aux function round 2 G(x,y,z)=((x&z)|(~z&y))
274        movz x13, #0xc7aa             // Load lower half of constant 0xe9b6c7aa
275        movk x13, #0xe9b6, lsl #16    // Load upper half of constant 0xe9b6c7aa
276        add w9, w9, w15               // Add dest value
277        add w9, w9, w13               // Add constant 0xe9b6c7aa
278        add w9, w9, w6                // Add aux function result
279        ror w9, w9, #12               // Rotate left s=20 bits
280        bic x6, x8, x17               // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
281        add w9, w8, w9                // Add X parameter round 2 B=GG(B, C, D, A, 0xe9b6c7aa, s=20, M[0])
282        and x13, x9, x17              // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
283        orr x6, x6, x13               // End aux function round 2 G(x,y,z)=((x&z)|(~z&y))
284        movz x13, #0x105d             // Load lower half of constant 0xd62f105d
285        movk x13, #0xd62f, lsl #16    // Load upper half of constant 0xd62f105d
286        add w4, w4, w22               // Add dest value
287        add w4, w4, w13               // Add constant 0xd62f105d
288        add w4, w4, w6                // Add aux function result
289        ror w4, w4, #27               // Rotate left s=5 bits
290        bic x6, x9, x8                // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
291        add w4, w9, w4                // Add X parameter round 2 A=GG(A, B, C, D, 0xd62f105d, s=5, M[5])
292        and x13, x4, x8               // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
293        orr x6, x6, x13               // End aux function round 2 G(x,y,z)=((x&z)|(~z&y))
294        movz x13, #0x1453             // Load lower half of constant 0x2441453
295        movk x13, #0x244, lsl #16     // Load upper half of constant 0x2441453
296        add w17, w17, w16             // Add dest value
297        add w17, w17, w13             // Add constant 0x2441453
298        add w17, w17, w6              // Add aux function result
299        ror w17, w17, #23             // Rotate left s=9 bits
300        bic x6, x4, x9                // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
301        add w17, w4, w17              // Add X parameter round 2 D=GG(D, A, B, C, 0x2441453, s=9, M[10])
302        and x13, x17, x9              // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
303        orr x6, x6, x13               // End aux function round 2 G(x,y,z)=((x&z)|(~z&y))
304        movz x13, #0xe681             // Load lower half of constant 0xd8a1e681
305        movk x13, #0xd8a1, lsl #16    // Load upper half of constant 0xd8a1e681
306        add w8, w8, w27               // Add dest value
307        add w8, w8, w13               // Add constant 0xd8a1e681
308        add w8, w8, w6                // Add aux function result
309        ror w8, w8, #18               // Rotate left s=14 bits
310        bic x6, x17, x4               // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
311        add w8, w17, w8               // Add X parameter round 2 C=GG(C, D, A, B, 0xd8a1e681, s=14, M[15])
312        and x13, x8, x4               // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
313        orr x6, x6, x13               // End aux function round 2 G(x,y,z)=((x&z)|(~z&y))
314        movz x13, #0xfbc8             // Load lower half of constant 0xe7d3fbc8
315        movk x13, #0xe7d3, lsl #16    // Load upper half of constant 0xe7d3fbc8
316        add w9, w9, w14               // Add dest value
317        add w9, w9, w13               // Add constant 0xe7d3fbc8
318        add w9, w9, w6                // Add aux function result
319        ror w9, w9, #12               // Rotate left s=20 bits
320        bic x6, x8, x17               // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
321        add w9, w8, w9                // Add X parameter round 2 B=GG(B, C, D, A, 0xe7d3fbc8, s=20, M[4])
322        and x13, x9, x17              // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
323        orr x6, x6, x13               // End aux function round 2 G(x,y,z)=((x&z)|(~z&y))
324        movz x13, #0xcde6             // Load lower half of constant 0x21e1cde6
325        movk x13, #0x21e1, lsl #16    // Load upper half of constant 0x21e1cde6
326        add w4, w4, w24               // Add dest value
327        add w4, w4, w13               // Add constant 0x21e1cde6
328        add w4, w4, w6                // Add aux function result
329        ror w4, w4, #27               // Rotate left s=5 bits
330        bic x6, x9, x8                // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
331        add w4, w9, w4                // Add X parameter round 2 A=GG(A, B, C, D, 0x21e1cde6, s=5, M[9])
332        and x13, x4, x8               // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
333        orr x6, x6, x13               // End aux function round 2 G(x,y,z)=((x&z)|(~z&y))
334        movz x13, #0x7d6              // Load lower half of constant 0xc33707d6
335        movk x13, #0xc337, lsl #16    // Load upper half of constant 0xc33707d6
336        add w17, w17, w12             // Add dest value
337        add w17, w17, w13             // Add constant 0xc33707d6
338        add w17, w17, w6              // Add aux function result
339        ror w17, w17, #23             // Rotate left s=9 bits
340        bic x6, x4, x9                // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
341        add w17, w4, w17              // Add X parameter round 2 D=GG(D, A, B, C, 0xc33707d6, s=9, M[14])
342        and x13, x17, x9              // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
343        orr x6, x6, x13               // End aux function round 2 G(x,y,z)=((x&z)|(~z&y))
344        movz x13, #0xd87              // Load lower half of constant 0xf4d50d87
345        movk x13, #0xf4d5, lsl #16    // Load upper half of constant 0xf4d50d87
346        add w8, w8, w21               // Add dest value
347        add w8, w8, w13               // Add constant 0xf4d50d87
348        add w8, w8, w6                // Add aux function result
349        ror w8, w8, #18               // Rotate left s=14 bits
350        bic x6, x17, x4               // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
351        add w8, w17, w8               // Add X parameter round 2 C=GG(C, D, A, B, 0xf4d50d87, s=14, M[3])
352        and x13, x8, x4               // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
353        orr x6, x6, x13               // End aux function round 2 G(x,y,z)=((x&z)|(~z&y))
354        movz x13, #0x14ed             // Load lower half of constant 0x455a14ed
355        movk x13, #0x455a, lsl #16    // Load upper half of constant 0x455a14ed
356        add w9, w9, w5                // Add dest value
357        add w9, w9, w13               // Add constant 0x455a14ed
358        add w9, w9, w6                // Add aux function result
359        ror w9, w9, #12               // Rotate left s=20 bits
360        bic x6, x8, x17               // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
361        add w9, w8, w9                // Add X parameter round 2 B=GG(B, C, D, A, 0x455a14ed, s=20, M[8])
362        and x13, x9, x17              // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
363        orr x6, x6, x13               // End aux function round 2 G(x,y,z)=((x&z)|(~z&y))
364        movz x13, #0xe905             // Load lower half of constant 0xa9e3e905
365        movk x13, #0xa9e3, lsl #16    // Load upper half of constant 0xa9e3e905
366        add w4, w4, w26               // Add dest value
367        add w4, w4, w13               // Add constant 0xa9e3e905
368        add w4, w4, w6                // Add aux function result
369        ror w4, w4, #27               // Rotate left s=5 bits
370        bic x6, x9, x8                // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
371        add w4, w9, w4                // Add X parameter round 2 A=GG(A, B, C, D, 0xa9e3e905, s=5, M[13])
372        and x13, x4, x8               // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
373        orr x6, x6, x13               // End aux function round 2 G(x,y,z)=((x&z)|(~z&y))
374        movz x13, #0xa3f8             // Load lower half of constant 0xfcefa3f8
375        movk x13, #0xfcef, lsl #16    // Load upper half of constant 0xfcefa3f8
376        add w17, w17, w3              // Add dest value
377        add w17, w17, w13             // Add constant 0xfcefa3f8
378        add w17, w17, w6              // Add aux function result
379        ror w17, w17, #23             // Rotate left s=9 bits
380        bic x6, x4, x9                // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
381        add w17, w4, w17              // Add X parameter round 2 D=GG(D, A, B, C, 0xfcefa3f8, s=9, M[2])
382        and x13, x17, x9              // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
383        orr x6, x6, x13               // End aux function round 2 G(x,y,z)=((x&z)|(~z&y))
384        movz x13, #0x2d9              // Load lower half of constant 0x676f02d9
385        movk x13, #0x676f, lsl #16    // Load upper half of constant 0x676f02d9
386        add w8, w8, w23               // Add dest value
387        add w8, w8, w13               // Add constant 0x676f02d9
388        add w8, w8, w6                // Add aux function result
389        ror w8, w8, #18               // Rotate left s=14 bits
390        bic x6, x17, x4               // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
391        add w8, w17, w8               // Add X parameter round 2 C=GG(C, D, A, B, 0x676f02d9, s=14, M[7])
392        and x13, x8, x4               // Aux function round 2 G(x,y,z)=((x&z)|(~z&y))
393        orr x6, x6, x13               // End aux function round 2 G(x,y,z)=((x&z)|(~z&y))
394        movz x13, #0x4c8a             // Load lower half of constant 0x8d2a4c8a
395        movk x13, #0x8d2a, lsl #16    // Load upper half of constant 0x8d2a4c8a
396        add w9, w9, w11               // Add dest value
397        add w9, w9, w13               // Add constant 0x8d2a4c8a
398        add w9, w9, w6                // Add aux function result
399        eor x6, x8, x17               // Begin aux function round 3 H(x,y,z)=(x^y^z)
400        ror w9, w9, #12               // Rotate left s=20 bits
401        movz x10, #0x3942             // Load lower half of constant 0xfffa3942
402        add w9, w8, w9                // Add X parameter round 2 B=GG(B, C, D, A, 0x8d2a4c8a, s=20, M[12])
403        movk x10, #0xfffa, lsl #16    // Load upper half of constant 0xfffa3942
404        add w4, w4, w22               // Add dest value
405        eor x6, x6, x9                // End aux function round 3 H(x,y,z)=(x^y^z)
406        add w4, w4, w10               // Add constant 0xfffa3942
407        add w4, w4, w6                // Add aux function result
408        ror w4, w4, #28               // Rotate left s=4 bits
409        eor x6, x9, x8                // Begin aux function round 3 H(x,y,z)=(x^y^z)
410        movz x10, #0xf681             // Load lower half of constant 0x8771f681
411        add w4, w9, w4                // Add X parameter round 3 A=HH(A, B, C, D, 0xfffa3942, s=4, M[5])
412        movk x10, #0x8771, lsl #16    // Load upper half of constant 0x8771f681
413        add w17, w17, w5              // Add dest value
414        eor x6, x6, x4                // End aux function round 3 H(x,y,z)=(x^y^z)
415        add w17, w17, w10             // Add constant 0x8771f681
416        add w17, w17, w6              // Add aux function result
417        eor x6, x4, x9                // Begin aux function round 3 H(x,y,z)=(x^y^z)
418        ror w17, w17, #21             // Rotate left s=11 bits
419        movz x13, #0x6122             // Load lower half of constant 0x6d9d6122
420        add w17, w4, w17              // Add X parameter round 3 D=HH(D, A, B, C, 0x8771f681, s=11, M[8])
421        movk x13, #0x6d9d, lsl #16    // Load upper half of constant 0x6d9d6122
422        add w8, w8, w25               // Add dest value
423        eor x6, x6, x17               // End aux function round 3 H(x,y,z)=(x^y^z)
424        add w8, w8, w13               // Add constant 0x6d9d6122
425        add w8, w8, w6                // Add aux function result
426        ror w8, w8, #16               // Rotate left s=16 bits
427        eor x6, x17, x4               // Begin aux function round 3 H(x,y,z)=(x^y^z)
428        movz x13, #0x380c             // Load lower half of constant 0xfde5380c
429        add w8, w17, w8               // Add X parameter round 3 C=HH(C, D, A, B, 0x6d9d6122, s=16, M[11])
430        movk x13, #0xfde5, lsl #16    // Load upper half of constant 0xfde5380c
431        add w9, w9, w12               // Add dest value
432        eor x6, x6, x8                // End aux function round 3 H(x,y,z)=(x^y^z)
433        add w9, w9, w13               // Add constant 0xfde5380c
434        add w9, w9, w6                // Add aux function result
435        eor x6, x8, x17               // Begin aux function round 3 H(x,y,z)=(x^y^z)
436        ror w9, w9, #9                // Rotate left s=23 bits
437        movz x10, #0xea44             // Load lower half of constant 0xa4beea44
438        add w9, w8, w9                // Add X parameter round 3 B=HH(B, C, D, A, 0xfde5380c, s=23, M[14])
439        movk x10, #0xa4be, lsl #16    // Load upper half of constant 0xa4beea44
440        add w4, w4, w20               // Add dest value
441        eor x6, x6, x9                // End aux function round 3 H(x,y,z)=(x^y^z)
442        add w4, w4, w10               // Add constant 0xa4beea44
443        add w4, w4, w6                // Add aux function result
444        ror w4, w4, #28               // Rotate left s=4 bits
445        eor x6, x9, x8                // Begin aux function round 3 H(x,y,z)=(x^y^z)
446        movz x10, #0xcfa9             // Load lower half of constant 0x4bdecfa9
447        add w4, w9, w4                // Add X parameter round 3 A=HH(A, B, C, D, 0xa4beea44, s=4, M[1])
448        movk x10, #0x4bde, lsl #16    // Load upper half of constant 0x4bdecfa9
449        add w17, w17, w14             // Add dest value
450        eor x6, x6, x4                // End aux function round 3 H(x,y,z)=(x^y^z)
451        add w17, w17, w10             // Add constant 0x4bdecfa9
452        add w17, w17, w6              // Add aux function result
453        eor x6, x4, x9                // Begin aux function round 3 H(x,y,z)=(x^y^z)
454        ror w17, w17, #21             // Rotate left s=11 bits
455        movz x13, #0x4b60             // Load lower half of constant 0xf6bb4b60
456        add w17, w4, w17              // Add X parameter round 3 D=HH(D, A, B, C, 0x4bdecfa9, s=11, M[4])
457        movk x13, #0xf6bb, lsl #16    // Load upper half of constant 0xf6bb4b60
458        add w8, w8, w23               // Add dest value
459        eor x6, x6, x17               // End aux function round 3 H(x,y,z)=(x^y^z)
460        add w8, w8, w13               // Add constant 0xf6bb4b60
461        add w8, w8, w6                // Add aux function result
462        ror w8, w8, #16               // Rotate left s=16 bits
463        eor x6, x17, x4               // Begin aux function round 3 H(x,y,z)=(x^y^z)
464        movz x13, #0xbc70             // Load lower half of constant 0xbebfbc70
465        add w8, w17, w8               // Add X parameter round 3 C=HH(C, D, A, B, 0xf6bb4b60, s=16, M[7])
466        movk x13, #0xbebf, lsl #16    // Load upper half of constant 0xbebfbc70
467        add w9, w9, w16               // Add dest value
468        eor x6, x6, x8                // End aux function round 3 H(x,y,z)=(x^y^z)
469        add w9, w9, w13               // Add constant 0xbebfbc70
470        add w9, w9, w6                // Add aux function result
471        eor x6, x8, x17               // Begin aux function round 3 H(x,y,z)=(x^y^z)
472        ror w9, w9, #9                // Rotate left s=23 bits
473        movz x10, #0x7ec6             // Load lower half of constant 0x289b7ec6
474        add w9, w8, w9                // Add X parameter round 3 B=HH(B, C, D, A, 0xbebfbc70, s=23, M[10])
475        movk x10, #0x289b, lsl #16    // Load upper half of constant 0x289b7ec6
476        add w4, w4, w26               // Add dest value
477        eor x6, x6, x9                // End aux function round 3 H(x,y,z)=(x^y^z)
478        add w4, w4, w10               // Add constant 0x289b7ec6
479        add w4, w4, w6                // Add aux function result
480        ror w4, w4, #28               // Rotate left s=4 bits
481        eor x6, x9, x8                // Begin aux function round 3 H(x,y,z)=(x^y^z)
482        movz x10, #0x27fa             // Load lower half of constant 0xeaa127fa
483        add w4, w9, w4                // Add X parameter round 3 A=HH(A, B, C, D, 0x289b7ec6, s=4, M[13])
484        movk x10, #0xeaa1, lsl #16    // Load upper half of constant 0xeaa127fa
485        add w17, w17, w15             // Add dest value
486        eor x6, x6, x4                // End aux function round 3 H(x,y,z)=(x^y^z)
487        add w17, w17, w10             // Add constant 0xeaa127fa
488        add w17, w17, w6              // Add aux function result
489        eor x6, x4, x9                // Begin aux function round 3 H(x,y,z)=(x^y^z)
490        ror w17, w17, #21             // Rotate left s=11 bits
491        movz x13, #0x3085             // Load lower half of constant 0xd4ef3085
492        add w17, w4, w17              // Add X parameter round 3 D=HH(D, A, B, C, 0xeaa127fa, s=11, M[0])
493        movk x13, #0xd4ef, lsl #16    // Load upper half of constant 0xd4ef3085
494        add w8, w8, w21               // Add dest value
495        eor x6, x6, x17               // End aux function round 3 H(x,y,z)=(x^y^z)
496        add w8, w8, w13               // Add constant 0xd4ef3085
497        add w8, w8, w6                // Add aux function result
498        ror w8, w8, #16               // Rotate left s=16 bits
499        eor x6, x17, x4               // Begin aux function round 3 H(x,y,z)=(x^y^z)
500        movz x13, #0x1d05             // Load lower half of constant 0x4881d05
501        add w8, w17, w8               // Add X parameter round 3 C=HH(C, D, A, B, 0xd4ef3085, s=16, M[3])
502        movk x13, #0x488, lsl #16     // Load upper half of constant 0x4881d05
503        add w9, w9, w7                // Add dest value
504        eor x6, x6, x8                // End aux function round 3 H(x,y,z)=(x^y^z)
505        add w9, w9, w13               // Add constant 0x4881d05
506        add w9, w9, w6                // Add aux function result
507        eor x6, x8, x17               // Begin aux function round 3 H(x,y,z)=(x^y^z)
508        ror w9, w9, #9                // Rotate left s=23 bits
509        movz x10, #0xd039             // Load lower half of constant 0xd9d4d039
510        add w9, w8, w9                // Add X parameter round 3 B=HH(B, C, D, A, 0x4881d05, s=23, M[6])
511        movk x10, #0xd9d4, lsl #16    // Load upper half of constant 0xd9d4d039
512        add w4, w4, w24               // Add dest value
513        eor x6, x6, x9                // End aux function round 3 H(x,y,z)=(x^y^z)
514        add w4, w4, w10               // Add constant 0xd9d4d039
515        add w4, w4, w6                // Add aux function result
516        ror w4, w4, #28               // Rotate left s=4 bits
517        eor x6, x9, x8                // Begin aux function round 3 H(x,y,z)=(x^y^z)
518        movz x10, #0x99e5             // Load lower half of constant 0xe6db99e5
519        add w4, w9, w4                // Add X parameter round 3 A=HH(A, B, C, D, 0xd9d4d039, s=4, M[9])
520        movk x10, #0xe6db, lsl #16    // Load upper half of constant 0xe6db99e5
521        add w17, w17, w11             // Add dest value
522        eor x6, x6, x4                // End aux function round 3 H(x,y,z)=(x^y^z)
523        add w17, w17, w10             // Add constant 0xe6db99e5
524        add w17, w17, w6              // Add aux function result
525        eor x6, x4, x9                // Begin aux function round 3 H(x,y,z)=(x^y^z)
526        ror w17, w17, #21             // Rotate left s=11 bits
527        movz x13, #0x7cf8             // Load lower half of constant 0x1fa27cf8
528        add w17, w4, w17              // Add X parameter round 3 D=HH(D, A, B, C, 0xe6db99e5, s=11, M[12])
529        movk x13, #0x1fa2, lsl #16    // Load upper half of constant 0x1fa27cf8
530        add w8, w8, w27               // Add dest value
531        eor x6, x6, x17               // End aux function round 3 H(x,y,z)=(x^y^z)
532        add w8, w8, w13               // Add constant 0x1fa27cf8
533        add w8, w8, w6                // Add aux function result
534        ror w8, w8, #16               // Rotate left s=16 bits
535        eor x6, x17, x4               // Begin aux function round 3 H(x,y,z)=(x^y^z)
536        movz x13, #0x5665             // Load lower half of constant 0xc4ac5665
537        add w8, w17, w8               // Add X parameter round 3 C=HH(C, D, A, B, 0x1fa27cf8, s=16, M[15])
538        movk x13, #0xc4ac, lsl #16    // Load upper half of constant 0xc4ac5665
539        add w9, w9, w3                // Add dest value
540        eor x6, x6, x8                // End aux function round 3 H(x,y,z)=(x^y^z)
541        add w9, w9, w13               // Add constant 0xc4ac5665
542        add w9, w9, w6                // Add aux function result
543        ror w9, w9, #9                // Rotate left s=23 bits
544        movz x6, #0x2244              // Load lower half of constant 0xf4292244
545        movk x6, #0xf429, lsl #16     // Load upper half of constant 0xf4292244
546        add w9, w8, w9                // Add X parameter round 3 B=HH(B, C, D, A, 0xc4ac5665, s=23, M[2])
547        add w4, w4, w15               // Add dest value
548        orn x13, x9, x17              // Begin aux function round 4 I(x,y,z)=((~z|x)^y)
549        add w4, w4, w6                // Add constant 0xf4292244
550        eor x6, x8, x13               // End aux function round 4 I(x,y,z)=((~z|x)^y)
551        add w4, w4, w6                // Add aux function result
552        ror w4, w4, #26               // Rotate left s=6 bits
553        movz x6, #0xff97              // Load lower half of constant 0x432aff97
554        movk x6, #0x432a, lsl #16     // Load upper half of constant 0x432aff97
555        add w4, w9, w4                // Add X parameter round 4 A=II(A, B, C, D, 0xf4292244, s=6, M[0])
556        orn x10, x4, x8               // Begin aux function round 4 I(x,y,z)=((~z|x)^y)
557        add w17, w17, w23             // Add dest value
558        eor x10, x9, x10              // End aux function round 4 I(x,y,z)=((~z|x)^y)
559        add w17, w17, w6              // Add constant 0x432aff97
560        add w6, w17, w10              // Add aux function result
561        ror w6, w6, #22               // Rotate left s=10 bits
562        movz x17, #0x23a7             // Load lower half of constant 0xab9423a7
563        movk x17, #0xab94, lsl #16    // Load upper half of constant 0xab9423a7
564        add w6, w4, w6                // Add X parameter round 4 D=II(D, A, B, C, 0x432aff97, s=10, M[7])
565        add w8, w8, w12               // Add dest value
566        orn x10, x6, x9               // Begin aux function round 4 I(x,y,z)=((~z|x)^y)
567        add w8, w8, w17               // Add constant 0xab9423a7
568        eor x17, x4, x10              // End aux function round 4 I(x,y,z)=((~z|x)^y)
569        add w8, w8, w17               // Add aux function result
570        ror w8, w8, #17               // Rotate left s=15 bits
571        movz x17, #0xa039             // Load lower half of constant 0xfc93a039
572        movk x17, #0xfc93, lsl #16    // Load upper half of constant 0xfc93a039
573        add w8, w6, w8                // Add X parameter round 4 C=II(C, D, A, B, 0xab9423a7, s=15, M[14])
574        orn x13, x8, x4               // Begin aux function round 4 I(x,y,z)=((~z|x)^y)
575        add w9, w9, w22               // Add dest value
576        eor x13, x6, x13              // End aux function round 4 I(x,y,z)=((~z|x)^y)
577        add w9, w9, w17               // Add constant 0xfc93a039
578        add w17, w9, w13              // Add aux function result
579        ror w17, w17, #11             // Rotate left s=21 bits
580        movz x9, #0x59c3              // Load lower half of constant 0x655b59c3
581        movk x9, #0x655b, lsl #16     // Load upper half of constant 0x655b59c3
582        add w17, w8, w17              // Add X parameter round 4 B=II(B, C, D, A, 0xfc93a039, s=21, M[5])
583        add w4, w4, w11               // Add dest value
584        orn x13, x17, x6              // Begin aux function round 4 I(x,y,z)=((~z|x)^y)
585        add w9, w4, w9                // Add constant 0x655b59c3
586        eor x4, x8, x13               // End aux function round 4 I(x,y,z)=((~z|x)^y)
587        add w9, w9, w4                // Add aux function result
588        ror w9, w9, #26               // Rotate left s=6 bits
589        movz x4, #0xcc92              // Load lower half of constant 0x8f0ccc92
590        movk x4, #0x8f0c, lsl #16     // Load upper half of constant 0x8f0ccc92
591        add w9, w17, w9               // Add X parameter round 4 A=II(A, B, C, D, 0x655b59c3, s=6, M[12])
592        orn x10, x9, x8               // Begin aux function round 4 I(x,y,z)=((~z|x)^y)
593        add w6, w6, w21               // Add dest value
594        eor x10, x17, x10             // End aux function round 4 I(x,y,z)=((~z|x)^y)
595        add w4, w6, w4                // Add constant 0x8f0ccc92
596        add w6, w4, w10               // Add aux function result
597        ror w6, w6, #22               // Rotate left s=10 bits
598        movz x4, #0xf47d              // Load lower half of constant 0xffeff47d
599        movk x4, #0xffef, lsl #16     // Load upper half of constant 0xffeff47d
600        add w6, w9, w6                // Add X parameter round 4 D=II(D, A, B, C, 0x8f0ccc92, s=10, M[3])
601        add w8, w8, w16               // Add dest value
602        orn x10, x6, x17              // Begin aux function round 4 I(x,y,z)=((~z|x)^y)
603        add w8, w8, w4                // Add constant 0xffeff47d
604        eor x4, x9, x10               // End aux function round 4 I(x,y,z)=((~z|x)^y)
605        add w8, w8, w4                // Add aux function result
606        ror w8, w8, #17               // Rotate left s=15 bits
607        movz x4, #0x5dd1              // Load lower half of constant 0x85845dd1
608        movk x4, #0x8584, lsl #16     // Load upper half of constant 0x85845dd1
609        add w8, w6, w8                // Add X parameter round 4 C=II(C, D, A, B, 0xffeff47d, s=15, M[10])
610        orn x10, x8, x9               // Begin aux function round 4 I(x,y,z)=((~z|x)^y)
611        add w15, w17, w20             // Add dest value
612        eor x17, x6, x10              // End aux function round 4 I(x,y,z)=((~z|x)^y)
613        add w15, w15, w4              // Add constant 0x85845dd1
614        add w4, w15, w17              // Add aux function result
615        ror w4, w4, #11               // Rotate left s=21 bits
616        movz x15, #0x7e4f             // Load lower half of constant 0x6fa87e4f
617        movk x15, #0x6fa8, lsl #16    // Load upper half of constant 0x6fa87e4f
618        add w17, w8, w4               // Add X parameter round 4 B=II(B, C, D, A, 0x85845dd1, s=21, M[1])
619        add w4, w9, w5                // Add dest value
620        orn x9, x17, x6               // Begin aux function round 4 I(x,y,z)=((~z|x)^y)
621        add w15, w4, w15              // Add constant 0x6fa87e4f
622        eor x4, x8, x9                // End aux function round 4 I(x,y,z)=((~z|x)^y)
623        add w9, w15, w4               // Add aux function result
624        ror w9, w9, #26               // Rotate left s=6 bits
625        movz x15, #0xe6e0             // Load lower half of constant 0xfe2ce6e0
626        movk x15, #0xfe2c, lsl #16    // Load upper half of constant 0xfe2ce6e0
627        add w4, w17, w9               // Add X parameter round 4 A=II(A, B, C, D, 0x6fa87e4f, s=6, M[8])
628        orn x9, x4, x8                // Begin aux function round 4 I(x,y,z)=((~z|x)^y)
629        add w6, w6, w27               // Add dest value
630        eor x9, x17, x9               // End aux function round 4 I(x,y,z)=((~z|x)^y)
631        add w15, w6, w15              // Add constant 0xfe2ce6e0
632        add w6, w15, w9               // Add aux function result
633        ror w6, w6, #22               // Rotate left s=10 bits
634        movz x9, #0x4314              // Load lower half of constant 0xa3014314
635        movk x9, #0xa301, lsl #16     // Load upper half of constant 0xa3014314
636        add w15, w4, w6               // Add X parameter round 4 D=II(D, A, B, C, 0xfe2ce6e0, s=10, M[15])
637        add w6, w8, w7                // Add dest value
638        orn x7, x15, x17              // Begin aux function round 4 I(x,y,z)=((~z|x)^y)
639        add w8, w6, w9                // Add constant 0xa3014314
640        eor x9, x4, x7                // End aux function round 4 I(x,y,z)=((~z|x)^y)
641        add w6, w8, w9                // Add aux function result
642        ror w6, w6, #17               // Rotate left s=15 bits
643        movz x7, #0x11a1              // Load lower half of constant 0x4e0811a1
644        movk x7, #0x4e08, lsl #16     // Load upper half of constant 0x4e0811a1
645        add w8, w15, w6               // Add X parameter round 4 C=II(C, D, A, B, 0xa3014314, s=15, M[6])
646        orn x9, x8, x4                // Begin aux function round 4 I(x,y,z)=((~z|x)^y)
647        add w6, w17, w26              // Add dest value
648        eor x17, x15, x9              // End aux function round 4 I(x,y,z)=((~z|x)^y)
649        add w9, w6, w7                // Add constant 0x4e0811a1
650        add w7, w9, w17               // Add aux function result
651        ror w7, w7, #11               // Rotate left s=21 bits
652        movz x6, #0x7e82              // Load lower half of constant 0xf7537e82
653        movk x6, #0xf753, lsl #16     // Load upper half of constant 0xf7537e82
654        add w9, w8, w7                // Add X parameter round 4 B=II(B, C, D, A, 0x4e0811a1, s=21, M[13])
655        add w17, w4, w14              // Add dest value
656        orn x7, x9, x15               // Begin aux function round 4 I(x,y,z)=((~z|x)^y)
657        add w14, w17, w6              // Add constant 0xf7537e82
658        eor x4, x8, x7                // End aux function round 4 I(x,y,z)=((~z|x)^y)
659        add w17, w14, w4              // Add aux function result
660        ror w17, w17, #26             // Rotate left s=6 bits
661        movz x6, #0xf235              // Load lower half of constant 0xbd3af235
662        movk x6, #0xbd3a, lsl #16     // Load upper half of constant 0xbd3af235
663        add w7, w9, w17               // Add X parameter round 4 A=II(A, B, C, D, 0xf7537e82, s=6, M[4])
664        orn x14, x7, x8               // Begin aux function round 4 I(x,y,z)=((~z|x)^y)
665        add w4, w15, w25              // Add dest value
666        eor x17, x9, x14              // End aux function round 4 I(x,y,z)=((~z|x)^y)
667        add w15, w4, w6               // Add constant 0xbd3af235
668        add w16, w15, w17             // Add aux function result
669        ror w16, w16, #22             // Rotate left s=10 bits
670        movz x14, #0xd2bb             // Load lower half of constant 0x2ad7d2bb
671        movk x14, #0x2ad7, lsl #16    // Load upper half of constant 0x2ad7d2bb
672        add w4, w7, w16               // Add X parameter round 4 D=II(D, A, B, C, 0xbd3af235, s=10, M[11])
673        add w6, w8, w3                // Add dest value
674        orn x15, x4, x9               // Begin aux function round 4 I(x,y,z)=((~z|x)^y)
675        add w17, w6, w14              // Add constant 0x2ad7d2bb
676        eor x16, x7, x15              // End aux function round 4 I(x,y,z)=((~z|x)^y)
677        add w8, w17, w16              // Add aux function result
678        ror w8, w8, #17               // Rotate left s=15 bits
679        movz x3, #0xd391              // Load lower half of constant 0xeb86d391
680        movk x3, #0xeb86, lsl #16     // Load upper half of constant 0xeb86d391
681        add w14, w4, w8               // Add X parameter round 4 C=II(C, D, A, B, 0x2ad7d2bb, s=15, M[2])
682        orn x6, x14, x7               // Begin aux function round 4 I(x,y,z)=((~z|x)^y)
683        add w15, w9, w24              // Add dest value
684        eor x17, x4, x6               // End aux function round 4 I(x,y,z)=((~z|x)^y)
685        add w16, w15, w3              // Add constant 0xeb86d391
686        add w8, w16, w17              // Add aux function result
687        ror w8, w8, #11               // Rotate left s=21 bits
688        ldp w6, w15, [x0]             // Reload MD5 state->A and state->B
689        ldp w5, w9, [x0, #8]          // Reload MD5 state->C and state->D
690        add w3, w14, w8               // Add X parameter round 4 B=II(B, C, D, A, 0xeb86d391, s=21, M[9])
691        add w13, w4, w9               // Add result of MD5 rounds to state->D
692        add w12, w14, w5              // Add result of MD5 rounds to state->C
693        add w10, w7, w6               // Add result of MD5 rounds to state->A
694        add w11, w3, w15              // Add result of MD5 rounds to state->B
695        stp w12, w13, [x0, #8]        // Store MD5 states C,D
696        stp w10, w11, [x0]            // Store MD5 states A,B
697        add x1, x1, #64               // Increment data pointer
698        subs w2, w2, #1               // Decrement block counter
699        b.ne ossl_md5_blocks_loop
700
701        ldp     x21,x22,[sp,#16]
702        ldp     x23,x24,[sp,#32]
703        ldp     x25,x26,[sp,#48]
704        ldp     x27,x28,[sp,#64]
705        ldp     x19,x20,[sp],#80
706        ret
707
708EOF
709
710# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
711#		CONTEXT *context,DISPATCHER_CONTEXT *disp)
712
713print $code;
714
715close STDOUT or die "error closing STDOUT: $!";
716