#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  size_t num;
  unsigned int Nh;
  unsigned int Nl;
  int md_len;
  unsigned long *h;
  scalar_t__ data;
};
typedef TYPE_1__ SHA256_CTX;

/* Variables and functions */
int /*<<< orphan*/ OPENSSL_cleanse(unsigned char *, int);
#define SHA224_DIGEST_LENGTH 129
#define SHA256_DIGEST_LENGTH 128
int SHA_CBLOCK;
int /*<<< orphan*/ memset(unsigned char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ sha256_block_data_order(TYPE_1__ *, unsigned char *, int);
int SHA256_Final(unsigned char *md, SHA256_CTX *c) {
  unsigned char *p = (unsigned char *)c->data;
  size_t n = c->num;
  p[n] = 0x80;
  n++;
  if (n > (SHA_CBLOCK - 8)) {
    memset(p + n, 0, SHA_CBLOCK - n);
    n = 0;
    sha256_block_data_order(c, p, 1);
  }
  memset(p + n, 0, SHA_CBLOCK - 8 - n);
  p += SHA_CBLOCK - 8;
  (void)({
    unsigned int r = (c->Nh);
    asm("bswapl %0" : "=r"(r) : "0"(r));
    *((unsigned int *)(p)) = r;
    (p) += 4;
    r;
  });
  (void)({
    unsigned int r = (c->Nl);
    asm("bswapl %0" : "=r"(r) : "0"(r));
    *((unsigned int *)(p)) = r;
    (p) += 4;
    r;
  });
  p -= SHA_CBLOCK;
  sha256_block_data_order(c, p, 1);
  c->num = 0;
  OPENSSL_cleanse(p, SHA_CBLOCK);
  do {
    unsigned long ll;
    unsigned int nn;
    switch ((c)->md_len) {
    case SHA224_DIGEST_LENGTH:
      for (nn = 0; nn < SHA224_DIGEST_LENGTH / 4; nn++) {
        ll = (c)->h[nn];
        (void)({
          unsigned int r = (ll);
          asm("bswapl %0" : "=r"(r) : "0"(r));
          *((unsigned int *)((md))) = r;
          ((md)) += 4;
          r;
        });
      }
      break;
    case SHA256_DIGEST_LENGTH:
      for (nn = 0; nn < SHA256_DIGEST_LENGTH / 4; nn++) {
        ll = (c)->h[nn];
        (void)({
          unsigned int r = (ll);
          asm("bswapl %0" : "=r"(r) : "0"(r));
          *((unsigned int *)((md))) = r;
          ((md)) += 4;
          r;
        });
      }
      break;
    default:
      if ((c)->md_len > SHA256_DIGEST_LENGTH)
        return 0;
      for (nn = 0; nn < (c)->md_len / 4; nn++) {
        ll = (c)->h[nn];
        (void)({
          unsigned int r = (ll);
          asm("bswapl %0" : "=r"(r) : "0"(r));
          *((unsigned int *)((md))) = r;
          ((md)) += 4;
          r;
        });
      }
      break;
    }
  } while (0);
  return 1;
}


x86 assembly (clang, -O0):
<SHA256_Final>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    0x20(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
movb   $0x80,(%rax,%rcx,1)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    0x2e6e(%rip),%rcx
mov    (%rcx),%ecx
sub    $0x8,%ecx
movslq %ecx,%rcx
cmp    %rcx,%rax
jbe    11c4 <SHA256_Final+0x94>
mov    -0x20(%rbp),%rdi
add    -0x28(%rbp),%rdi
mov    0x2e4e(%rip),%rax
movslq (%rax),%rax
sub    -0x28(%rbp),%rax
mov    %eax,%edx
xor    %esi,%esi
call   1030 <memset@plt>
movq   $0x0,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x1,%edx
call   1050 <sha256_block_data_order@plt>
mov    -0x20(%rbp),%rdi
add    -0x28(%rbp),%rdi
mov    0x2e15(%rip),%rax
mov    (%rax),%eax
sub    $0x8,%eax
cltq
sub    -0x28(%rbp),%rax
mov    %eax,%edx
xor    %esi,%esi
call   1030 <memset@plt>
mov    0x2dfa(%rip),%rax
mov    (%rax),%ecx
sub    $0x8,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
bswap  %eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x20(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    0xc(%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
bswap  %eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x20(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    0x2d86(%rip),%rax
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x1,%edx
call   1050 <sha256_block_data_order@plt>
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x20(%rbp),%rdi
mov    0x2d49(%rip),%rax
mov    (%rax),%esi
call   1040 <OPENSSL_cleanse@plt>
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%eax
mov    %eax,-0x60(%rbp)
sub    $0x80,%eax
je     1334 <SHA256_Final+0x204>
jmp    12c0 <SHA256_Final+0x190>
mov    -0x60(%rbp),%eax
sub    $0x81,%eax
jne    1395 <SHA256_Final+0x265>
jmp    12d3 <SHA256_Final+0x1a3>
movl   $0x0,-0x44(%rbp)
cmpl   $0x20,-0x44(%rbp)
jae    132f <SHA256_Final+0x1ff>
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%rax
mov    -0x44(%rbp),%ecx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%eax
bswap  %eax
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    12da <SHA256_Final+0x1aa>
jmp    142b <SHA256_Final+0x2fb>
movl   $0x0,-0x44(%rbp)
cmpl   $0x20,-0x44(%rbp)
jae    1390 <SHA256_Final+0x260>
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%rax
mov    -0x44(%rbp),%ecx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%eax
bswap  %eax
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
mov    -0x50(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    133b <SHA256_Final+0x20b>
jmp    142b <SHA256_Final+0x2fb>
mov    -0x18(%rbp),%rax
cmpl   $0x80,0x10(%rax)
jle    13b2 <SHA256_Final+0x282>
movl   $0x0,-0x4(%rbp)
jmp    1437 <SHA256_Final+0x307>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x64(%rbp),%eax
cmp    %ecx,%eax
jae    1426 <SHA256_Final+0x2f6>
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%rax
mov    -0x44(%rbp),%ecx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %eax,-0x58(%rbp)
mov    -0x58(%rbp),%eax
bswap  %eax
mov    %eax,-0x58(%rbp)
mov    -0x58(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
mov    -0x58(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    13b9 <SHA256_Final+0x289>
jmp    142b <SHA256_Final+0x2fb>
jmp    1430 <SHA256_Final+0x300>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SHA256_Final>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r12
mov    (%rsi),%rbx
mov    0x20(%rsi),%r15
movb   $0x80,(%r15,%rbx,1)
add    $0x1,%rbx
mov    0x2e92(%rip),%r13
movslq 0x0(%r13),%rax
lea    -0x8(%rax),%rdx
cmp    %rdx,%rbx
jbe    118b <SHA256_Final+0x5b>
lea    (%r15,%rbx,1),%rdi
sub    %ebx,%eax
xor    %ebx,%ebx
xor    %esi,%esi
mov    %eax,%edx
call   1030 <memset@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x1,%edx
call   1050 <sha256_block_data_order@plt>
mov    0x0(%r13),%edx
add    $0xfffffff8,%edx
lea    (%r15,%rbx,1),%rdi
sub    %ebx,%edx
xor    %esi,%esi
call   1030 <memset@plt>
movslq 0x0(%r13),%rax
mov    0x8(%r14),%ecx
bswap  %ecx
mov    %ecx,-0x8(%rax,%r15,1)
lea    -0x4(%rax,%r15,1),%rbx
mov    0xc(%r14),%ecx
bswap  %ecx
mov    %ecx,-0x4(%rax,%r15,1)
movslq 0x0(%r13),%rax
sub    %rax,%rbx
add    $0x4,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1050 <sha256_block_data_order@plt>
movq   $0x0,(%r14)
mov    0x0(%r13),%esi
mov    %rbx,%rdi
call   1040 <OPENSSL_cleanse@plt>
mov    0x10(%r14),%ecx
cmp    $0x81,%ecx
je     1215 <SHA256_Final+0xe5>
cmp    $0x80,%ecx
jne    123a <SHA256_Final+0x10a>
mov    0x18(%r14),%rax
xor    %ecx,%ecx
nop
mov    (%rax,%rcx,8),%edx
bswap  %edx
mov    %edx,(%r12,%rcx,4)
add    $0x1,%rcx
cmp    $0x20,%rcx
jne    1200 <SHA256_Final+0xd0>
jmp    1233 <SHA256_Final+0x103>
mov    0x18(%r14),%rax
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
mov    (%rax,%rcx,8),%edx
bswap  %edx
mov    %edx,(%r12,%rcx,4)
add    $0x1,%rcx
cmp    $0x20,%rcx
jne    1220 <SHA256_Final+0xf0>
mov    $0x1,%eax
jmp    1281 <SHA256_Final+0x151>
xor    %eax,%eax
cmp    $0x80,%ecx
jg     1281 <SHA256_Final+0x151>
add    $0x3,%ecx
mov    $0x1,%eax
cmp    $0x7,%ecx
jb     1281 <SHA256_Final+0x151>
mov    0x18(%r14),%rcx
xor    %edx,%edx
nopw   0x0(%rax,%rax,1)
mov    (%rcx,%rdx,8),%esi
bswap  %esi
mov    %esi,(%r12,%rdx,4)
add    $0x1,%rdx
mov    0x10(%r14),%esi
lea    0x3(%rsi),%edi
test   %esi,%esi
cmovns %esi,%edi
sar    $0x2,%edi
cmp    %rdi,%rdx
jb     1260 <SHA256_Final+0x130>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { i64, i32, i32, i32, i64*, i64 }
@SHA_CBLOCK = global i32 0
define i32 @SHA256_Final(i8* %0, %struct.TYPE_4__* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca %struct.TYPE_4__*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i64
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
store i8* %0, i8** %4
store %struct.TYPE_4__* %1, %struct.TYPE_4__** %5
%20 = load %struct.TYPE_4__*, %struct.TYPE_4__** %5
%21 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %20, i32 0, i32 5
%22 = load i64, i64* %21
%23 = inttoptr i64 %22 to i8*
store i8* %23, i8** %6
%24 = load %struct.TYPE_4__*, %struct.TYPE_4__** %5
%25 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %24, i32 0, i32 0
%26 = load i64, i64* %25
store i64 %26, i64* %7
%27 = load i8*, i8** %6
%28 = load i64, i64* %7
%29 = getelementptr inbounds i8, i8* %27, i64 %28
store i8 -128, i8* %29
%30 = load i64, i64* %7
%31 = add i64 %30, 1
store i64 %31, i64* %7
%32 = load i64, i64* %7
%33 = load i32, i32* @SHA_CBLOCK
%34 = sub nsw i32 %33, 8
%35 = sext i32 %34 to i64
%36 = icmp ugt i64 %32, %35
br i1 %36, label %37, label %50
37: ; preds = %2
%38 = load i8*, i8** %6
%39 = load i64, i64* %7
%40 = getelementptr inbounds i8, i8* %38, i64 %39
%41 = load i32, i32* @SHA_CBLOCK
%42 = sext i32 %41 to i64
%43 = load i64, i64* %7
%44 = sub i64 %42, %43
%45 = trunc i64 %44 to i32
%46 = call i32 @memset(i8* %40, i32 0, i32 %45)
store i64 0, i64* %7
%47 = load %struct.TYPE_4__*, %struct.TYPE_4__** %5
%48 = load i8*, i8** %6
%49 = call i32 @sha256_block_data_order(%struct.TYPE_4__* %47, i8* %48, i32 1)
br label %50
50: ; preds = %37, %2
%51 = load i8*, i8** %6
%52 = load i64, i64* %7
%53 = getelementptr inbounds i8, i8* %51, i64 %52
%54 = load i32, i32* @SHA_CBLOCK
%55 = sub nsw i32 %54, 8
%56 = sext i32 %55 to i64
%57 = load i64, i64* %7
%58 = sub i64 %56, %57
%59 = trunc i64 %58 to i32
%60 = call i32 @memset(i8* %53, i32 0, i32 %59)
%61 = load i32, i32* @SHA_CBLOCK
%62 = sub nsw i32 %61, 8
%63 = load i8*, i8** %6
%64 = sext i32 %62 to i64
%65 = getelementptr inbounds i8, i8* %63, i64 %64
store i8* %65, i8** %6
%66 = load %struct.TYPE_4__*, %struct.TYPE_4__** %5
%67 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %66, i32 0, i32 1
%68 = load i32, i32* %67
store i32 %68, i32* %8
%69 = load i32, i32* %8
%70 = call i32 asm "bswapl $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i32 %69)
store i32 %70, i32* %8
%71 = load i32, i32* %8
%72 = load i8*, i8** %6
%73 = bitcast i8* %72 to i32*
store i32 %71, i32* %73
%74 = load i8*, i8** %6
%75 = getelementptr inbounds i8, i8* %74, i64 4
store i8* %75, i8** %6
%76 = load i32, i32* %8
store i32 %76, i32* %9
%77 = load i32, i32* %9
%78 = load %struct.TYPE_4__*, %struct.TYPE_4__** %5
%79 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %78, i32 0, i32 2
%80 = load i32, i32* %79
store i32 %80, i32* %10
%81 = load i32, i32* %10
%82 = call i32 asm "bswapl $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i32 %81)
store i32 %82, i32* %10
%83 = load i32, i32* %10
%84 = load i8*, i8** %6
%85 = bitcast i8* %84 to i32*
store i32 %83, i32* %85
%86 = load i8*, i8** %6
%87 = getelementptr inbounds i8, i8* %86, i64 4
store i8* %87, i8** %6
%88 = load i32, i32* %10
store i32 %88, i32* %11
%89 = load i32, i32* %11
%90 = load i32, i32* @SHA_CBLOCK
%91 = load i8*, i8** %6
%92 = sext i32 %90 to i64
%93 = sub i64 0, %92
%94 = getelementptr inbounds i8, i8* %91, i64 %93
store i8* %94, i8** %6
%95 = load %struct.TYPE_4__*, %struct.TYPE_4__** %5
%96 = load i8*, i8** %6
%97 = call i32 @sha256_block_data_order(%struct.TYPE_4__* %95, i8* %96, i32 1)
%98 = load %struct.TYPE_4__*, %struct.TYPE_4__** %5
%99 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %98, i32 0, i32 0
store i64 0, i64* %99
%100 = load i8*, i8** %6
%101 = load i32, i32* @SHA_CBLOCK
%102 = call i32 @OPENSSL_cleanse(i8* %100, i32 %101)
br label %103
103: ; preds = %50
%104 = load %struct.TYPE_4__*, %struct.TYPE_4__** %5
%105 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %104, i32 0, i32 3
%106 = load i32, i32* %105
switch i32 %106, label %161 [
i32 129, label %107
i32 128, label %134
]
107: ; preds = %103
store i32 0, i32* %13
br label %108
108: ; preds = %130, %107
%109 = load i32, i32* %13
%110 = icmp ult i32 %109, 32
br i1 %110, label %111, label %133
111: ; preds = %108
%112 = load %struct.TYPE_4__*, %struct.TYPE_4__** %5
%113 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %112, i32 0, i32 4
%114 = load i64*, i64** %113
%115 = load i32, i32* %13
%116 = zext i32 %115 to i64
%117 = getelementptr inbounds i64, i64* %114, i64 %116
%118 = load i64, i64* %117
store i64 %118, i64* %12
%119 = load i64, i64* %12
%120 = trunc i64 %119 to i32
store i32 %120, i32* %14
%121 = load i32, i32* %14
%122 = call i32 asm "bswapl $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i32 %121)
store i32 %122, i32* %14
%123 = load i32, i32* %14
%124 = load i8*, i8** %4
%125 = bitcast i8* %124 to i32*
store i32 %123, i32* %125
%126 = load i8*, i8** %4
%127 = getelementptr inbounds i8, i8* %126, i64 4
store i8* %127, i8** %4
%128 = load i32, i32* %14
store i32 %128, i32* %15
%129 = load i32, i32* %15
br label %130
130: ; preds = %111
%131 = load i32, i32* %13
%132 = add i32 %131, 1
store i32 %132, i32* %13
br label %108
133: ; preds = %108
br label %198
134: ; preds = %103
store i32 0, i32* %13
br label %135
135: ; preds = %157, %134
%136 = load i32, i32* %13
%137 = icmp ult i32 %136, 32
br i1 %137, label %138, label %160
138: ; preds = %135
%139 = load %struct.TYPE_4__*, %struct.TYPE_4__** %5
%140 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %139, i32 0, i32 4
%141 = load i64*, i64** %140
%142 = load i32, i32* %13
%143 = zext i32 %142 to i64
%144 = getelementptr inbounds i64, i64* %141, i64 %143
%145 = load i64, i64* %144
store i64 %145, i64* %12
%146 = load i64, i64* %12
%147 = trunc i64 %146 to i32
store i32 %147, i32* %16
%148 = load i32, i32* %16
%149 = call i32 asm "bswapl $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i32 %148)
store i32 %149, i32* %16
%150 = load i32, i32* %16
%151 = load i8*, i8** %4
%152 = bitcast i8* %151 to i32*
store i32 %150, i32* %152
%153 = load i8*, i8** %4
%154 = getelementptr inbounds i8, i8* %153, i64 4
store i8* %154, i8** %4
%155 = load i32, i32* %16
store i32 %155, i32* %17
%156 = load i32, i32* %17
br label %157
157: ; preds = %138
%158 = load i32, i32* %13
%159 = add i32 %158, 1
store i32 %159, i32* %13
br label %135
160: ; preds = %135
br label %198
161: ; preds = %103
%162 = load %struct.TYPE_4__*, %struct.TYPE_4__** %5
%163 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %162, i32 0, i32 3
%164 = load i32, i32* %163
%165 = icmp sgt i32 %164, 128
br i1 %165, label %166, label %167
166: ; preds = %161
store i32 0, i32* %3
br label %200
167: ; preds = %161
store i32 0, i32* %13
br label %168
168: ; preds = %194, %167
%169 = load i32, i32* %13
%170 = load %struct.TYPE_4__*, %struct.TYPE_4__** %5
%171 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %170, i32 0, i32 3
%172 = load i32, i32* %171
%173 = sdiv i32 %172, 4
%174 = icmp ult i32 %169, %173
br i1 %174, label %175, label %197
175: ; preds = %168
%176 = load %struct.TYPE_4__*, %struct.TYPE_4__** %5
%177 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %176, i32 0, i32 4
%178 = load i64*, i64** %177
%179 = load i32, i32* %13
%180 = zext i32 %179 to i64
%181 = getelementptr inbounds i64, i64* %178, i64 %180
%182 = load i64, i64* %181
store i64 %182, i64* %12
%183 = load i64, i64* %12
%184 = trunc i64 %183 to i32
store i32 %184, i32* %18
%185 = load i32, i32* %18
%186 = call i32 asm "bswapl $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i32 %185)
store i32 %186, i32* %18
%187 = load i32, i32* %18
%188 = load i8*, i8** %4
%189 = bitcast i8* %188 to i32*
store i32 %187, i32* %189
%190 = load i8*, i8** %4
%191 = getelementptr inbounds i8, i8* %190, i64 4
store i8* %191, i8** %4
%192 = load i32, i32* %18
store i32 %192, i32* %19
%193 = load i32, i32* %19
br label %194
194: ; preds = %175
%195 = load i32, i32* %13
%196 = add i32 %195, 1
store i32 %196, i32* %13
br label %168
197: ; preds = %168
br label %198
198: ; preds = %197, %160, %133
br label %199
199: ; preds = %198
store i32 1, i32* %3
br label %200
200: ; preds = %199, %166
%201 = load i32, i32* %3
ret i32 %201
}

LLVM IR (-O2):
%struct.TYPE_4__ = type { i64, i32, i32, i32, i64*, i64 }
@SHA_CBLOCK = global i32 0
define i32 @SHA256_Final(i8* nocapture writeonly %0, %struct.TYPE_4__* %1) {
%3 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %1, i64 0, i32 5
%4 = load i64, i64* %3
%5 = inttoptr i64 %4 to i8*
%6 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %1, i64 0, i32 0
%7 = load i64, i64* %6
%8 = getelementptr inbounds i8, i8* %5, i64 %7
store i8 -128, i8* %8
%9 = add i64 %7, 1
%10 = load i32, i32* @SHA_CBLOCK
%11 = add nsw i32 %10, -8
%12 = sext i32 %11 to i64
%13 = icmp ugt i64 %9, %12
br i1 %13, label %14, label %22
14: ; preds = %2
%15 = getelementptr inbounds i8, i8* %5, i64 %9
%16 = trunc i64 %9 to i32
%17 = sub i32 %10, %16
%18 = tail call i32 @memset(i8* %15, i32 0, i32 %17)
%19 = tail call i32 @sha256_block_data_order(%struct.TYPE_4__* %1, i8* %5, i32 1)
%20 = load i32, i32* @SHA_CBLOCK
%21 = add nsw i32 %20, -8
br label %22
22: ; preds = %14, %2
%23 = phi i32 [ %21, %14 ], [ %11, %2 ]
%24 = phi i64 [ 0, %14 ], [ %9, %2 ]
%25 = getelementptr inbounds i8, i8* %5, i64 %24
%26 = trunc i64 %24 to i32
%27 = sub i32 %23, %26
%28 = tail call i32 @memset(i8* %25, i32 0, i32 %27)
%29 = load i32, i32* @SHA_CBLOCK
%30 = add nsw i32 %29, -8
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %5, i64 %31
%33 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %1, i64 0, i32 1
%34 = load i32, i32* %33
%35 = tail call i32 asm "bswapl $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i32 %34)
%36 = bitcast i8* %32 to i32*
store i32 %35, i32* %36
%37 = getelementptr inbounds i8, i8* %32, i64 4
%38 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %1, i64 0, i32 2
%39 = load i32, i32* %38
%40 = tail call i32 asm "bswapl $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i32 %39)
%41 = bitcast i8* %37 to i32*
store i32 %40, i32* %41
%42 = getelementptr inbounds i8, i8* %37, i64 4
%43 = load i32, i32* @SHA_CBLOCK
%44 = sext i32 %43 to i64
%45 = sub nsw i64 0, %44
%46 = getelementptr inbounds i8, i8* %42, i64 %45
%47 = tail call i32 @sha256_block_data_order(%struct.TYPE_4__* %1, i8* %46, i32 1)
store i64 0, i64* %6
%48 = load i32, i32* @SHA_CBLOCK
%49 = tail call i32 @OPENSSL_cleanse(i8* %46, i32 %48)
%50 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %1, i64 0, i32 3
%51 = load i32, i32* %50
switch i32 %51, label %80 [
i32 129, label %55
i32 128, label %52
]
52: ; preds = %22
%53 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %1, i64 0, i32 4
%54 = load i64*, i64** %53
br label %69
55: ; preds = %22
%56 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %1, i64 0, i32 4
%57 = load i64*, i64** %56
br label %58
58: ; preds = %55, %58
%59 = phi i64 [ 0, %55 ], [ %67, %58 ]
%60 = phi i8* [ %0, %55 ], [ %66, %58 ]
%61 = getelementptr inbounds i64, i64* %57, i64 %59
%62 = load i64, i64* %61
%63 = trunc i64 %62 to i32
%64 = tail call i32 asm "bswapl $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i32 %63)
%65 = bitcast i8* %60 to i32*
store i32 %64, i32* %65
%66 = getelementptr inbounds i8, i8* %60, i64 4
%67 = add nuw nsw i64 %59, 1
%68 = icmp eq i64 %67, 32
br i1 %68, label %102, label %58
69: ; preds = %52, %69
%70 = phi i64 [ 0, %52 ], [ %78, %69 ]
%71 = phi i8* [ %0, %52 ], [ %77, %69 ]
%72 = getelementptr inbounds i64, i64* %54, i64 %70
%73 = load i64, i64* %72
%74 = trunc i64 %73 to i32
%75 = tail call i32 asm "bswapl $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i32 %74)
%76 = bitcast i8* %71 to i32*
store i32 %75, i32* %76
%77 = getelementptr inbounds i8, i8* %71, i64 4
%78 = add nuw nsw i64 %70, 1
%79 = icmp eq i64 %78, 32
br i1 %79, label %102, label %69
80: ; preds = %22
%81 = icmp sgt i32 %51, 128
br i1 %81, label %102, label %82
82: ; preds = %80
%83 = add nsw i32 %51, 3
%84 = icmp ult i32 %83, 7
br i1 %84, label %102, label %85
85: ; preds = %82
%86 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %1, i64 0, i32 4
%87 = load i64*, i64** %86
br label %88
88: ; preds = %85, %88
%89 = phi i64 [ 0, %85 ], [ %97, %88 ]
%90 = phi i8* [ %0, %85 ], [ %96, %88 ]
%91 = getelementptr inbounds i64, i64* %87, i64 %89
%92 = load i64, i64* %91
%93 = trunc i64 %92 to i32
%94 = tail call i32 asm "bswapl $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i32 %93)
%95 = bitcast i8* %90 to i32*
store i32 %94, i32* %95
%96 = getelementptr inbounds i8, i8* %90, i64 4
%97 = add nuw nsw i64 %89, 1
%98 = load i32, i32* %50
%99 = sdiv i32 %98, 4
%100 = zext i32 %99 to i64
%101 = icmp ult i64 %97, %100
br i1 %101, label %88, label %102
102: ; preds = %69, %58, %88, %82, %80
%103 = phi i32 [ 0, %80 ], [ 1, %82 ], [ 1, %88 ], [ 1, %58 ], [ 1, %69 ]
ret i32 %103
}