#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 */

/* Type definitions */
typedef int /*<<< orphan*/ SHA512_CTX;

/* Variables and functions */
int /*<<< orphan*/ SHA512_Final(unsigned char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ SHA512_Init(int /*<<< orphan*/ *);
int /*<<< orphan*/ SHA512_Update(int /*<<< orphan*/ *, char *, int);
void *alloca(int);
int /*<<< orphan*/ bzero(char *, int);
char *memcpy(char *, ...);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int strcspn(char *, char *);
int strlen(char *);
void setup_spint0(char *key, char *salt, char *result) {
  char *p_bytes;
  char *s_bytes;
  char *cp;
  char *bigbuf, *bigbuf2;
  int bbl, bbl2;
  int cnt;
  int key_len = strlen(key);
  int salt_len = ((strcspn(salt, "$")) < (16) ? strcspn(salt, "$") : 16);
  unsigned char *alt_result;
  unsigned char *temp_result;
  SHA512_CTX ctx;
  bigbuf = alloca(4255);
  bigbuf2 = alloca(4255);
  p_bytes = alloca(16);
  s_bytes = alloca(16);
  alt_result = alloca(4255);
  temp_result = alloca(4255);
  bbl = 0;
  bbl2 = 0;
  bzero(result, 96);
  memcpy(bigbuf, key, key_len);
  bbl += key_len;
  memcpy(bigbuf + bbl, salt, salt_len);
  bbl += salt_len;
  memcpy(bigbuf2, key, key_len);
  bbl2 += key_len;
  memcpy(bigbuf2 + bbl2, salt, salt_len);
  bbl2 += salt_len;
  memcpy(bigbuf2 + bbl2, key, key_len);
  bbl2 += key_len;
  SHA512_Init(&ctx);
  SHA512_Update(&ctx, bigbuf2, bbl2);
  SHA512_Final((unsigned char *)alt_result, &ctx);
  bbl2 = 0;
  for (cnt = key_len; cnt > 64; cnt -= 64) {
    memcpy(bigbuf + bbl, alt_result, 64);
    bbl += 64;
  }
  memcpy(bigbuf + bbl, alt_result, cnt);
  bbl += cnt;
  for (cnt = key_len; cnt > 0; cnt >>= 1)
    if ((cnt & 1) != 0) {
      memcpy(bigbuf + bbl, alt_result, 64);
      bbl += 64;
    } else {
      memcpy(bigbuf + bbl, key, key_len);
      bbl += key_len;
    }
  SHA512_Init(&ctx);
  SHA512_Update(&ctx, bigbuf, bbl);
  SHA512_Final((unsigned char *)alt_result, &ctx);
  bbl = 0;
  for (cnt = 0; cnt < key_len; ++cnt) {
    memcpy(bigbuf2 + bbl2, key, key_len);
    bbl2 += key_len;
  }
  SHA512_Init(&ctx);
  SHA512_Update(&ctx, bigbuf2, bbl2);
  SHA512_Final((unsigned char *)temp_result, &ctx);
  bbl2 = 0;
  cp = p_bytes = alloca(key_len);
  bzero(p_bytes, 16);
  for (cnt = key_len; cnt >= 64; cnt -= 64)
    cp = memcpy(cp, temp_result, 64);
  memcpy(cp, temp_result, cnt);
  bbl2 = 0;
  for (cnt = 0; cnt < (16 + (alt_result[0] & 255)); ++cnt) {
    memcpy(bigbuf2 + bbl2, salt, salt_len);
    bbl2 += salt_len;
  }
  SHA512_Init(&ctx);
  SHA512_Update(&ctx, bigbuf2, bbl2);
  SHA512_Final((unsigned char *)temp_result, &ctx);
  bbl2 = 0;
  cp = s_bytes = alloca(salt_len);
  bzero(s_bytes, 16);
  for (cnt = salt_len; cnt >= 64; cnt -= 64)
    cp = memcpy(cp, temp_result, 64);
  memcpy(cp, temp_result, cnt);
  bbl = 0;
  memset(result, 0, 16);
  memcpy(result, s_bytes, strlen(salt));
  memcpy(result + 16, alt_result, 64);
  memcpy(result + 64 + 16, p_bytes, key_len);
}


x86 assembly (clang, -O0):
<setup_spint0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x50(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe42(%rip),%rsi
call   1060 <strcspn@plt>
cmp    $0x10,%eax
jge    11e4 <setup_spint0+0x54>
mov    -0x10(%rbp),%rdi
lea    0xe29(%rip),%rsi
call   1060 <strcspn@plt>
mov    %eax,-0x70(%rbp)
jmp    11f1 <setup_spint0+0x61>
mov    $0x10,%eax
mov    %eax,-0x70(%rbp)
jmp    11f1 <setup_spint0+0x61>
mov    -0x70(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    $0x109f,%edi
call   1070 <alloca@plt>
mov    %rax,-0x38(%rbp)
mov    $0x109f,%edi
call   1070 <alloca@plt>
mov    %rax,-0x40(%rbp)
mov    $0x10,%edi
call   1070 <alloca@plt>
mov    %rax,-0x20(%rbp)
mov    $0x10,%edi
call   1070 <alloca@plt>
mov    %rax,-0x28(%rbp)
mov    $0x109f,%edi
call   1070 <alloca@plt>
mov    %rax,-0x60(%rbp)
mov    $0x109f,%edi
call   1070 <alloca@plt>
mov    %rax,-0x68(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x60,%esi
call   10a0 <bzero@plt>
mov    -0x38(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x50(%rbp),%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
mov    -0x50(%rbp),%eax
add    -0x44(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x38(%rbp),%rdi
movslq -0x44(%rbp),%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x54(%rbp),%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
mov    -0x54(%rbp),%eax
add    -0x44(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x50(%rbp),%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
mov    -0x50(%rbp),%eax
add    -0x48(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x40(%rbp),%rdi
movslq -0x48(%rbp),%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x54(%rbp),%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
mov    -0x54(%rbp),%eax
add    -0x48(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x40(%rbp),%rdi
movslq -0x48(%rbp),%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
mov    -0x50(%rbp),%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
mov    -0x50(%rbp),%eax
add    -0x48(%rbp),%eax
mov    %eax,-0x48(%rbp)
lea    -0x6c(%rbp),%rdi
call   10b0 <SHA512_Init@plt>
mov    -0x40(%rbp),%rsi
mov    -0x48(%rbp),%edx
lea    -0x6c(%rbp),%rdi
call   1050 <SHA512_Update@plt>
mov    -0x60(%rbp),%rdi
lea    -0x6c(%rbp),%rsi
call   1090 <SHA512_Final@plt>
movl   $0x0,-0x48(%rbp)
mov    -0x50(%rbp),%eax
mov    %eax,-0x4c(%rbp)
cmpl   $0x40,-0x4c(%rbp)
jle    1372 <setup_spint0+0x1e2>
mov    -0x38(%rbp),%rdi
movslq -0x44(%rbp),%rax
add    %rax,%rdi
mov    -0x60(%rbp),%rsi
xor    %eax,%eax
mov    $0x40,%edx
call   1080 <memcpy@plt>
mov    -0x44(%rbp),%eax
add    $0x40,%eax
mov    %eax,-0x44(%rbp)
mov    -0x4c(%rbp),%eax
sub    $0x40,%eax
mov    %eax,-0x4c(%rbp)
jmp    1336 <setup_spint0+0x1a6>
mov    -0x38(%rbp),%rdi
movslq -0x44(%rbp),%rax
add    %rax,%rdi
mov    -0x60(%rbp),%rsi
mov    -0x4c(%rbp),%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
mov    -0x4c(%rbp),%eax
add    -0x44(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x50(%rbp),%eax
mov    %eax,-0x4c(%rbp)
cmpl   $0x0,-0x4c(%rbp)
jle    1411 <setup_spint0+0x281>
mov    -0x4c(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     13dc <setup_spint0+0x24c>
mov    -0x38(%rbp),%rdi
movslq -0x44(%rbp),%rax
add    %rax,%rdi
mov    -0x60(%rbp),%rsi
xor    %eax,%eax
mov    $0x40,%edx
call   1080 <memcpy@plt>
mov    -0x44(%rbp),%eax
add    $0x40,%eax
mov    %eax,-0x44(%rbp)
jmp    13fe <setup_spint0+0x26e>
mov    -0x38(%rbp),%rdi
movslq -0x44(%rbp),%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
mov    -0x50(%rbp),%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
mov    -0x50(%rbp),%eax
add    -0x44(%rbp),%eax
mov    %eax,-0x44(%rbp)
jmp    1403 <setup_spint0+0x273>
mov    -0x4c(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    139a <setup_spint0+0x20a>
lea    -0x6c(%rbp),%rdi
call   10b0 <SHA512_Init@plt>
mov    -0x38(%rbp),%rsi
mov    -0x44(%rbp),%edx
lea    -0x6c(%rbp),%rdi
call   1050 <SHA512_Update@plt>
mov    -0x60(%rbp),%rdi
lea    -0x6c(%rbp),%rsi
call   1090 <SHA512_Final@plt>
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x50(%rbp),%eax
jge    1481 <setup_spint0+0x2f1>
mov    -0x40(%rbp),%rdi
movslq -0x48(%rbp),%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
mov    -0x50(%rbp),%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
mov    -0x50(%rbp),%eax
add    -0x48(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1445 <setup_spint0+0x2b5>
lea    -0x6c(%rbp),%rdi
call   10b0 <SHA512_Init@plt>
mov    -0x40(%rbp),%rsi
mov    -0x48(%rbp),%edx
lea    -0x6c(%rbp),%rdi
call   1050 <SHA512_Update@plt>
mov    -0x68(%rbp),%rdi
lea    -0x6c(%rbp),%rsi
call   1090 <SHA512_Final@plt>
movl   $0x0,-0x48(%rbp)
mov    -0x50(%rbp),%edi
call   1070 <alloca@plt>
mov    %rax,-0x20(%rbp)
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x10,%esi
call   10a0 <bzero@plt>
mov    -0x50(%rbp),%eax
mov    %eax,-0x4c(%rbp)
cmpl   $0x40,-0x4c(%rbp)
jl     1502 <setup_spint0+0x372>
mov    -0x30(%rbp),%rdi
mov    -0x68(%rbp),%rsi
xor    %eax,%eax
mov    $0x40,%edx
call   1080 <memcpy@plt>
mov    %rax,-0x30(%rbp)
mov    -0x4c(%rbp),%eax
sub    $0x40,%eax
mov    %eax,-0x4c(%rbp)
jmp    14d2 <setup_spint0+0x342>
mov    -0x30(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    -0x4c(%rbp),%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    -0x60(%rbp),%rcx
movzbl (%rcx),%ecx
and    $0xff,%ecx
add    $0x10,%ecx
cmp    %ecx,%eax
jge    156d <setup_spint0+0x3dd>
mov    -0x40(%rbp),%rdi
movslq -0x48(%rbp),%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x54(%rbp),%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
mov    -0x54(%rbp),%eax
add    -0x48(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1522 <setup_spint0+0x392>
lea    -0x6c(%rbp),%rdi
call   10b0 <SHA512_Init@plt>
mov    -0x40(%rbp),%rsi
mov    -0x48(%rbp),%edx
lea    -0x6c(%rbp),%rdi
call   1050 <SHA512_Update@plt>
mov    -0x68(%rbp),%rdi
lea    -0x6c(%rbp),%rsi
call   1090 <SHA512_Final@plt>
movl   $0x0,-0x48(%rbp)
mov    -0x54(%rbp),%edi
call   1070 <alloca@plt>
mov    %rax,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0x10,%esi
call   10a0 <bzero@plt>
mov    -0x54(%rbp),%eax
mov    %eax,-0x4c(%rbp)
cmpl   $0x40,-0x4c(%rbp)
jl     15ee <setup_spint0+0x45e>
mov    -0x30(%rbp),%rdi
mov    -0x68(%rbp),%rsi
xor    %eax,%eax
mov    $0x40,%edx
call   1080 <memcpy@plt>
mov    %rax,-0x30(%rbp)
mov    -0x4c(%rbp),%eax
sub    $0x40,%eax
mov    %eax,-0x4c(%rbp)
jmp    15be <setup_spint0+0x42e>
mov    -0x30(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    -0x4c(%rbp),%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
movl   $0x0,-0x44(%rbp)
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x80(%rbp),%rdi
mov    -0x78(%rbp),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
mov    -0x18(%rbp),%rdi
add    $0x10,%rdi
mov    -0x60(%rbp),%rsi
xor    %eax,%eax
mov    $0x40,%edx
call   1080 <memcpy@plt>
mov    -0x18(%rbp),%rdi
add    $0x40,%rdi
add    $0x10,%rdi
mov    -0x20(%rbp),%rsi
mov    -0x50(%rbp),%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setup_spint0>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rsi,0x30(%rsp)
mov    %rdi,%rbp
call   1030 <strlen@plt>
mov    %eax,0x8(%rsp)
lea    0xe44(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcspn@plt>
mov    %eax,%r14d
cmp    $0x10,%eax
mov    $0x10,%eax
cmovge %eax,%r14d
mov    $0x109f,%edi
call   1070 <alloca@plt>
mov    %rax,%r13
mov    $0x109f,%edi
call   1070 <alloca@plt>
mov    %rax,%r12
mov    $0x10,%edi
call   1070 <alloca@plt>
mov    $0x10,%edi
call   1070 <alloca@plt>
mov    $0x109f,%edi
call   1070 <alloca@plt>
mov    %rax,0x18(%rsp)
mov    $0x109f,%edi
call   1070 <alloca@plt>
mov    %rax,0x28(%rsp)
mov    %r15,0x50(%rsp)
mov    %r15,%rdi
mov    $0x60,%esi
call   10a0 <bzero@plt>
mov    %r13,0x10(%rsp)
mov    %r13,%rdi
mov    %rbp,%rsi
mov    0x8(%rsp),%ebx
mov    %ebx,%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
movslq %ebx,%rbx
lea    (%rbx,%r13,1),%rdi
mov    0x30(%rsp),%r15
mov    %r15,%rsi
mov    %r14d,%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
lea    (%r14,%rbx,1),%r13d
mov    %r12,%rdi
mov    %rbp,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
lea    (%r12,%rbx,1),%rdi
mov    %r15,%rsi
mov    %r14,0x48(%rsp)
mov    %r14d,%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
movslq %r13d,%r14
lea    (%r12,%r14,1),%rdi
mov    %rbp,0x40(%rsp)
mov    %rbp,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
lea    (%r14,%rbx,1),%r15d
lea    0xc(%rsp),%rbp
mov    %rbp,%rdi
call   10b0 <SHA512_Init@plt>
mov    %rbp,%rdi
mov    %r12,0x20(%rsp)
mov    %r12,%rsi
mov    %r15d,%edx
call   1050 <SHA512_Update@plt>
mov    0x18(%rsp),%rdi
mov    %rbp,%rsi
call   1090 <SHA512_Final@plt>
mov    0x10(%rsp),%rax
mov    0x8(%rsp),%edx
cmp    $0x41,%ebx
mov    %rbx,0x38(%rsp)
jl     1334 <setup_spint0+0x1a4>
lea    (%rax,%r14,1),%rbp
shl    $0x20,%r14
movabs $0x4000000000,%r15
mov    0x18(%rsp),%r12
xchg   %ax,%ax
mov    %edx,%ebx
add    %r15,%r14
mov    %rbp,%rdi
mov    %r12,%rsi
mov    $0x40,%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
lea    -0x40(%rbx),%edx
add    $0x40,%rbp
add    $0x40,%r13d
cmp    $0x80,%ebx
ja     1300 <setup_spint0+0x170>
sar    $0x20,%r14
add    %edx,%r13d
mov    %r13d,%r15d
mov    0x10(%rsp),%rbp
add    %rbp,%r14
xor    %r13d,%r13d
mov    %r14,%rdi
mov    0x18(%rsp),%r12
mov    %r12,%rsi
xor    %eax,%eax
call   1080 <memcpy@plt>
mov    0x8(%rsp),%r14d
test   %r14d,%r14d
jle    141d <setup_spint0+0x28d>
mov    %r14d,%ebx
mov    0x40(%rsp),%r13
jmp    1393 <setup_spint0+0x203>
nopl   0x0(%rax)
mov    %r13,%rsi
mov    %r14d,%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
mov    %r14d,%ebp
add    %ebp,%r15d
mov    %ebx,%eax
shr    %eax
cmp    $0x1,%ebx
mov    %eax,%ebx
mov    0x10(%rsp),%rbp
jbe    13b4 <setup_spint0+0x224>
movslq %r15d,%rdi
add    %rbp,%rdi
test   $0x1,%bl
je     1370 <setup_spint0+0x1e0>
mov    $0x40,%ebp
mov    %r12,%rsi
mov    $0x40,%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
jmp    1380 <setup_spint0+0x1f0>
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   10b0 <SHA512_Init@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r15d,%edx
call   1050 <SHA512_Update@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1090 <SHA512_Final@plt>
test   %r14d,%r14d
jle    1445 <setup_spint0+0x2b5>
mov    %r14d,%ebp
mov    %r13,%r15
xor    %r13d,%r13d
mov    0x20(%rsp),%rbx
mov    0x38(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14d,%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
add    %r12,%rbx
add    %r14d,%r13d
add    $0xffffffff,%ebp
jne    1400 <setup_spint0+0x270>
jmp    1448 <setup_spint0+0x2b8>
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   10b0 <SHA512_Init@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r15d,%edx
call   1050 <SHA512_Update@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1090 <SHA512_Final@plt>
jmp    1448 <setup_spint0+0x2b8>
xor    %r13d,%r13d
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   10b0 <SHA512_Init@plt>
mov    %rbx,%rdi
mov    0x20(%rsp),%rsi
mov    %r13d,%edx
call   1050 <SHA512_Update@plt>
mov    0x28(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1090 <SHA512_Final@plt>
mov    %r14d,%edi
call   1070 <alloca@plt>
mov    %r14d,%ebx
mov    %rax,%r14
mov    %rax,%rdi
mov    $0x10,%esi
call   10a0 <bzero@plt>
mov    %ebx,%edx
mov    %r14,%rax
cmp    $0x40,%ebx
jl     14cc <setup_spint0+0x33c>
mov    %r14,%rax
mov    0x8(%rsp),%ecx
mov    %ecx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rax,%rdi
mov    %rbp,%rsi
mov    $0x40,%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
lea    -0x40(%rbx),%edx
cmp    $0x7f,%ebx
mov    %edx,%ebx
ja     14b0 <setup_spint0+0x320>
mov    %r14,0x10(%rsp)
mov    %rax,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1080 <memcpy@plt>
mov    0x48(%rsp),%r12
movslq %r12d,%r15
xor    %r13d,%r13d
mov    0x20(%rsp),%rbx
xor    %ebp,%ebp
mov    0x30(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r12d,%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
add    $0x1,%ebp
mov    0x18(%rsp),%rax
movzbl (%rax),%eax
add    $0x10,%eax
add    %r15,%rbx
add    %r12d,%r13d
cmp    %eax,%ebp
jb     1500 <setup_spint0+0x370>
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   10b0 <SHA512_Init@plt>
mov    %rbx,%rdi
mov    0x20(%rsp),%rsi
mov    %r13d,%edx
call   1050 <SHA512_Update@plt>
mov    0x28(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1090 <SHA512_Final@plt>
mov    %r12d,%edi
call   1070 <alloca@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x10,%esi
call   10a0 <bzero@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r12d,%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
mov    0x50(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
lea    0x10(%rbp),%rdi
mov    0x18(%rsp),%rsi
mov    $0x40,%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
add    $0x50,%rbp
mov    %rbp,%rdi
mov    0x10(%rsp),%rsi
mov    0x8(%rsp),%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"$\00"
define void @setup_spint0(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8*
%18 = alloca i8*
%19 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%20 = load i8*, i8** %4
%21 = call i32 @strlen(i8* %20)
store i32 %21, i32* %15
%22 = load i8*, i8** %5
%23 = call i32 @strcspn(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%24 = icmp slt i32 %23, 16
br i1 %24, label %25, label %28
25: ; preds = %3
%26 = load i8*, i8** %5
%27 = call i32 @strcspn(i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %29
28: ; preds = %3
br label %29
29: ; preds = %28, %25
%30 = phi i32 [ %27, %25 ], [ 16, %28 ]
store i32 %30, i32* %16
%31 = call i8* @alloca(i32 4255)
store i8* %31, i8** %10
%32 = call i8* @alloca(i32 4255)
store i8* %32, i8** %11
%33 = call i8* @alloca(i32 16)
store i8* %33, i8** %7
%34 = call i8* @alloca(i32 16)
store i8* %34, i8** %8
%35 = call i8* @alloca(i32 4255)
store i8* %35, i8** %17
%36 = call i8* @alloca(i32 4255)
store i8* %36, i8** %18
store i32 0, i32* %12
store i32 0, i32* %13
%37 = load i8*, i8** %6
%38 = call i32 @bzero(i8* %37, i32 96)
%39 = load i8*, i8** %10
%40 = load i8*, i8** %4
%41 = load i32, i32* %15
%42 = call i8* (i8*, ...) @memcpy(i8* %39, i8* %40, i32 %41)
%43 = load i32, i32* %15
%44 = load i32, i32* %12
%45 = add nsw i32 %44, %43
store i32 %45, i32* %12
%46 = load i8*, i8** %10
%47 = load i32, i32* %12
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %46, i64 %48
%50 = load i8*, i8** %5
%51 = load i32, i32* %16
%52 = call i8* (i8*, ...) @memcpy(i8* %49, i8* %50, i32 %51)
%53 = load i32, i32* %16
%54 = load i32, i32* %12
%55 = add nsw i32 %54, %53
store i32 %55, i32* %12
%56 = load i8*, i8** %11
%57 = load i8*, i8** %4
%58 = load i32, i32* %15
%59 = call i8* (i8*, ...) @memcpy(i8* %56, i8* %57, i32 %58)
%60 = load i32, i32* %15
%61 = load i32, i32* %13
%62 = add nsw i32 %61, %60
store i32 %62, i32* %13
%63 = load i8*, i8** %11
%64 = load i32, i32* %13
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i8, i8* %63, i64 %65
%67 = load i8*, i8** %5
%68 = load i32, i32* %16
%69 = call i8* (i8*, ...) @memcpy(i8* %66, i8* %67, i32 %68)
%70 = load i32, i32* %16
%71 = load i32, i32* %13
%72 = add nsw i32 %71, %70
store i32 %72, i32* %13
%73 = load i8*, i8** %11
%74 = load i32, i32* %13
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds i8, i8* %73, i64 %75
%77 = load i8*, i8** %4
%78 = load i32, i32* %15
%79 = call i8* (i8*, ...) @memcpy(i8* %76, i8* %77, i32 %78)
%80 = load i32, i32* %15
%81 = load i32, i32* %13
%82 = add nsw i32 %81, %80
store i32 %82, i32* %13
%83 = call i32 @SHA512_Init(i32* %19)
%84 = load i8*, i8** %11
%85 = load i32, i32* %13
%86 = call i32 @SHA512_Update(i32* %19, i8* %84, i32 %85)
%87 = load i8*, i8** %17
%88 = call i32 @SHA512_Final(i8* %87, i32* %19)
store i32 0, i32* %13
%89 = load i32, i32* %15
store i32 %89, i32* %14
br label %90
90: ; preds = %102, %29
%91 = load i32, i32* %14
%92 = icmp sgt i32 %91, 64
br i1 %92, label %93, label %105
93: ; preds = %90
%94 = load i8*, i8** %10
%95 = load i32, i32* %12
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds i8, i8* %94, i64 %96
%98 = load i8*, i8** %17
%99 = call i8* (i8*, ...) @memcpy(i8* %97, i8* %98, i32 64)
%100 = load i32, i32* %12
%101 = add nsw i32 %100, 64
store i32 %101, i32* %12
br label %102
102: ; preds = %93
%103 = load i32, i32* %14
%104 = sub nsw i32 %103, 64
store i32 %104, i32* %14
br label %90
105: ; preds = %90
%106 = load i8*, i8** %10
%107 = load i32, i32* %12
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds i8, i8* %106, i64 %108
%110 = load i8*, i8** %17
%111 = load i32, i32* %14
%112 = call i8* (i8*, ...) @memcpy(i8* %109, i8* %110, i32 %111)
%113 = load i32, i32* %14
%114 = load i32, i32* %12
%115 = add nsw i32 %114, %113
store i32 %115, i32* %12
%116 = load i32, i32* %15
store i32 %116, i32* %14
br label %117
117: ; preds = %145, %105
%118 = load i32, i32* %14
%119 = icmp sgt i32 %118, 0
br i1 %119, label %120, label %148
120: ; preds = %117
%121 = load i32, i32* %14
%122 = and i32 %121, 1
%123 = icmp ne i32 %122, 0
br i1 %123, label %124, label %133
124: ; preds = %120
%125 = load i8*, i8** %10
%126 = load i32, i32* %12
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds i8, i8* %125, i64 %127
%129 = load i8*, i8** %17
%130 = call i8* (i8*, ...) @memcpy(i8* %128, i8* %129, i32 64)
%131 = load i32, i32* %12
%132 = add nsw i32 %131, 64
store i32 %132, i32* %12
br label %144
133: ; preds = %120
%134 = load i8*, i8** %10
%135 = load i32, i32* %12
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds i8, i8* %134, i64 %136
%138 = load i8*, i8** %4
%139 = load i32, i32* %15
%140 = call i8* (i8*, ...) @memcpy(i8* %137, i8* %138, i32 %139)
%141 = load i32, i32* %15
%142 = load i32, i32* %12
%143 = add nsw i32 %142, %141
store i32 %143, i32* %12
br label %144
144: ; preds = %133, %124
br label %145
145: ; preds = %144
%146 = load i32, i32* %14
%147 = ashr i32 %146, 1
store i32 %147, i32* %14
br label %117
148: ; preds = %117
%149 = call i32 @SHA512_Init(i32* %19)
%150 = load i8*, i8** %10
%151 = load i32, i32* %12
%152 = call i32 @SHA512_Update(i32* %19, i8* %150, i32 %151)
%153 = load i8*, i8** %17
%154 = call i32 @SHA512_Final(i8* %153, i32* %19)
store i32 0, i32* %12
store i32 0, i32* %14
br label %155
155: ; preds = %170, %148
%156 = load i32, i32* %14
%157 = load i32, i32* %15
%158 = icmp slt i32 %156, %157
br i1 %158, label %159, label %173
159: ; preds = %155
%160 = load i8*, i8** %11
%161 = load i32, i32* %13
%162 = sext i32 %161 to i64
%163 = getelementptr inbounds i8, i8* %160, i64 %162
%164 = load i8*, i8** %4
%165 = load i32, i32* %15
%166 = call i8* (i8*, ...) @memcpy(i8* %163, i8* %164, i32 %165)
%167 = load i32, i32* %15
%168 = load i32, i32* %13
%169 = add nsw i32 %168, %167
store i32 %169, i32* %13
br label %170
170: ; preds = %159
%171 = load i32, i32* %14
%172 = add nsw i32 %171, 1
store i32 %172, i32* %14
br label %155
173: ; preds = %155
%174 = call i32 @SHA512_Init(i32* %19)
%175 = load i8*, i8** %11
%176 = load i32, i32* %13
%177 = call i32 @SHA512_Update(i32* %19, i8* %175, i32 %176)
%178 = load i8*, i8** %18
%179 = call i32 @SHA512_Final(i8* %178, i32* %19)
store i32 0, i32* %13
%180 = load i32, i32* %15
%181 = call i8* @alloca(i32 %180)
store i8* %181, i8** %7
store i8* %181, i8** %9
%182 = load i8*, i8** %7
%183 = call i32 @bzero(i8* %182, i32 16)
%184 = load i32, i32* %15
store i32 %184, i32* %14
br label %185
185: ; preds = %192, %173
%186 = load i32, i32* %14
%187 = icmp sge i32 %186, 64
br i1 %187, label %188, label %195
188: ; preds = %185
%189 = load i8*, i8** %9
%190 = load i8*, i8** %18
%191 = call i8* (i8*, ...) @memcpy(i8* %189, i8* %190, i32 64)
store i8* %191, i8** %9
br label %192
192: ; preds = %188
%193 = load i32, i32* %14
%194 = sub nsw i32 %193, 64
store i32 %194, i32* %14
br label %185
195: ; preds = %185
%196 = load i8*, i8** %9
%197 = load i8*, i8** %18
%198 = load i32, i32* %14
%199 = call i8* (i8*, ...) @memcpy(i8* %196, i8* %197, i32 %198)
store i32 0, i32* %13
store i32 0, i32* %14
br label %200
200: ; preds = %220, %195
%201 = load i32, i32* %14
%202 = load i8*, i8** %17
%203 = getelementptr inbounds i8, i8* %202, i64 0
%204 = load i8, i8* %203
%205 = zext i8 %204 to i32
%206 = and i32 %205, 255
%207 = add nsw i32 16, %206
%208 = icmp slt i32 %201, %207
br i1 %208, label %209, label %223
209: ; preds = %200
%210 = load i8*, i8** %11
%211 = load i32, i32* %13
%212 = sext i32 %211 to i64
%213 = getelementptr inbounds i8, i8* %210, i64 %212
%214 = load i8*, i8** %5
%215 = load i32, i32* %16
%216 = call i8* (i8*, ...) @memcpy(i8* %213, i8* %214, i32 %215)
%217 = load i32, i32* %16
%218 = load i32, i32* %13
%219 = add nsw i32 %218, %217
store i32 %219, i32* %13
br label %220
220: ; preds = %209
%221 = load i32, i32* %14
%222 = add nsw i32 %221, 1
store i32 %222, i32* %14
br label %200
223: ; preds = %200
%224 = call i32 @SHA512_Init(i32* %19)
%225 = load i8*, i8** %11
%226 = load i32, i32* %13
%227 = call i32 @SHA512_Update(i32* %19, i8* %225, i32 %226)
%228 = load i8*, i8** %18
%229 = call i32 @SHA512_Final(i8* %228, i32* %19)
store i32 0, i32* %13
%230 = load i32, i32* %16
%231 = call i8* @alloca(i32 %230)
store i8* %231, i8** %8
store i8* %231, i8** %9
%232 = load i8*, i8** %8
%233 = call i32 @bzero(i8* %232, i32 16)
%234 = load i32, i32* %16
store i32 %234, i32* %14
br label %235
235: ; preds = %242, %223
%236 = load i32, i32* %14
%237 = icmp sge i32 %236, 64
br i1 %237, label %238, label %245
238: ; preds = %235
%239 = load i8*, i8** %9
%240 = load i8*, i8** %18
%241 = call i8* (i8*, ...) @memcpy(i8* %239, i8* %240, i32 64)
store i8* %241, i8** %9
br label %242
242: ; preds = %238
%243 = load i32, i32* %14
%244 = sub nsw i32 %243, 64
store i32 %244, i32* %14
br label %235
245: ; preds = %235
%246 = load i8*, i8** %9
%247 = load i8*, i8** %18
%248 = load i32, i32* %14
%249 = call i8* (i8*, ...) @memcpy(i8* %246, i8* %247, i32 %248)
store i32 0, i32* %12
%250 = load i8*, i8** %6
%251 = call i32 @memset(i8* %250, i32 0, i32 16)
%252 = load i8*, i8** %6
%253 = load i8*, i8** %8
%254 = load i8*, i8** %5
%255 = call i32 @strlen(i8* %254)
%256 = call i8* (i8*, ...) @memcpy(i8* %252, i8* %253, i32 %255)
%257 = load i8*, i8** %6
%258 = getelementptr inbounds i8, i8* %257, i64 16
%259 = load i8*, i8** %17
%260 = call i8* (i8*, ...) @memcpy(i8* %258, i8* %259, i32 64)
%261 = load i8*, i8** %6
%262 = getelementptr inbounds i8, i8* %261, i64 64
%263 = getelementptr inbounds i8, i8* %262, i64 16
%264 = load i8*, i8** %7
%265 = load i32, i32* %15
%266 = call i8* (i8*, ...) @memcpy(i8* %263, i8* %264, i32 %265)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"$\00"
define void @setup_spint0(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = tail call i32 @strlen(i8* %0)
%6 = tail call i32 @strcspn(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = icmp slt i32 %6, 16
%8 = select i1 %7, i32 %6, i32 16
%9 = bitcast i32* %4 to i8*
%10 = tail call i8* @alloca(i32 4255)
%11 = tail call i8* @alloca(i32 4255)
%12 = tail call i8* @alloca(i32 16)
%13 = tail call i8* @alloca(i32 16)
%14 = tail call i8* @alloca(i32 4255)
%15 = tail call i8* @alloca(i32 4255)
%16 = tail call i32 @bzero(i8* %2, i32 96)
%17 = tail call i8* (i8*, ...) @memcpy(i8* %10, i8* %0, i32 %5)
%18 = sext i32 %5 to i64
%19 = getelementptr inbounds i8, i8* %10, i64 %18
%20 = tail call i8* (i8*, ...) @memcpy(i8* %19, i8* %1, i32 %8)
%21 = add i32 %8, %5
%22 = tail call i8* (i8*, ...) @memcpy(i8* %11, i8* %0, i32 %5)
%23 = getelementptr inbounds i8, i8* %11, i64 %18
%24 = tail call i8* (i8*, ...) @memcpy(i8* %23, i8* %1, i32 %8)
%25 = sext i32 %21 to i64
%26 = getelementptr inbounds i8, i8* %11, i64 %25
%27 = tail call i8* (i8*, ...) @memcpy(i8* %26, i8* %0, i32 %5)
%28 = add nsw i32 %21, %5
%29 = call i32 @SHA512_Init(i32* %4)
%30 = call i32 @SHA512_Update(i32* %4, i8* %11, i32 %28)
%31 = call i32 @SHA512_Final(i8* %14, i32* %4)
%32 = icmp sgt i32 %5, 64
br i1 %32, label %33, label %46
33: ; preds = %3, %33
%34 = phi i64 [ %38, %33 ], [ %25, %3 ]
%35 = phi i32 [ %39, %33 ], [ %5, %3 ]
%36 = getelementptr inbounds i8, i8* %10, i64 %34
%37 = call i8* (i8*, ...) @memcpy(i8* %36, i8* %14, i32 64)
%38 = add nsw i64 %34, 64
%39 = add nsw i32 %35, -64
%40 = icmp ugt i32 %35, 128
br i1 %40, label %33, label %41
41: ; preds = %33
%42 = trunc i64 %38 to i32
%43 = shl i64 %38, 32
%44 = ashr exact i64 %43, 32
%45 = add nsw i32 %39, %42
br label %46
46: ; preds = %41, %3
%47 = phi i32 [ %45, %41 ], [ %28, %3 ]
%48 = phi i64 [ %44, %41 ], [ %25, %3 ]
%49 = phi i32 [ %39, %41 ], [ %5, %3 ]
%50 = getelementptr inbounds i8, i8* %10, i64 %48
%51 = call i8* (i8*, ...) @memcpy(i8* %50, i8* %14, i32 %49)
%52 = icmp sgt i32 %5, 0
br i1 %52, label %53, label %83
53: ; preds = %46, %64
%54 = phi i32 [ %66, %64 ], [ %47, %46 ]
%55 = phi i32 [ %67, %64 ], [ %5, %46 ]
%56 = and i32 %55, 1
%57 = icmp eq i32 %56, 0
%58 = sext i32 %54 to i64
%59 = getelementptr inbounds i8, i8* %10, i64 %58
br i1 %57, label %62, label %60
60: ; preds = %53
%61 = call i8* (i8*, ...) @memcpy(i8* %59, i8* %14, i32 64)
br label %64
62: ; preds = %53
%63 = call i8* (i8*, ...) @memcpy(i8* %59, i8* %0, i32 %5)
br label %64
64: ; preds = %60, %62
%65 = phi i32 [ 64, %60 ], [ %5, %62 ]
%66 = add nsw i32 %54, %65
%67 = lshr i32 %55, 1
%68 = icmp ult i32 %55, 2
br i1 %68, label %69, label %53
69: ; preds = %64
%70 = call i32 @SHA512_Init(i32* %4)
%71 = call i32 @SHA512_Update(i32* %4, i8* %10, i32 %66)
%72 = call i32 @SHA512_Final(i8* %14, i32* %4)
br i1 %52, label %73, label %87
73: ; preds = %69, %73
%74 = phi i64 [ %78, %73 ], [ 0, %69 ]
%75 = phi i32 [ %79, %73 ], [ 0, %69 ]
%76 = getelementptr inbounds i8, i8* %11, i64 %74
%77 = call i8* (i8*, ...) @memcpy(i8* %76, i8* %0, i32 %5)
%78 = add nsw i64 %74, %18
%79 = add nuw nsw i32 %75, 1
%80 = icmp eq i32 %79, %5
br i1 %80, label %81, label %73
81: ; preds = %73
%82 = trunc i64 %78 to i32
br label %87
83: ; preds = %46
%84 = call i32 @SHA512_Init(i32* %4)
%85 = call i32 @SHA512_Update(i32* %4, i8* %10, i32 %47)
%86 = call i32 @SHA512_Final(i8* %14, i32* %4)
br label %87
87: ; preds = %83, %81, %69
%88 = phi i32 [ 0, %69 ], [ %82, %81 ], [ 0, %83 ]
%89 = call i32 @SHA512_Init(i32* %4)
%90 = call i32 @SHA512_Update(i32* %4, i8* %11, i32 %88)
%91 = call i32 @SHA512_Final(i8* %15, i32* %4)
%92 = call i8* @alloca(i32 %5)
%93 = call i32 @bzero(i8* %92, i32 16)
%94 = icmp sgt i32 %5, 63
br i1 %94, label %95, label %101
95: ; preds = %87, %95
%96 = phi i8* [ %98, %95 ], [ %92, %87 ]
%97 = phi i32 [ %99, %95 ], [ %5, %87 ]
%98 = call i8* (i8*, ...) @memcpy(i8* %96, i8* %15, i32 64)
%99 = add nsw i32 %97, -64
%100 = icmp ugt i32 %97, 127
br i1 %100, label %95, label %101
101: ; preds = %95, %87
%102 = phi i32 [ %5, %87 ], [ %99, %95 ]
%103 = phi i8* [ %92, %87 ], [ %98, %95 ]
%104 = call i8* (i8*, ...) @memcpy(i8* %103, i8* %15, i32 %102)
%105 = sext i32 %8 to i64
br label %106
106: ; preds = %101, %106
%107 = phi i64 [ 0, %101 ], [ %111, %106 ]
%108 = phi i32 [ 0, %101 ], [ %112, %106 ]
%109 = getelementptr inbounds i8, i8* %11, i64 %107
%110 = call i8* (i8*, ...) @memcpy(i8* %109, i8* %1, i32 %8)
%111 = add nsw i64 %107, %105
%112 = add nuw nsw i32 %108, 1
%113 = load i8, i8* %14
%114 = zext i8 %113 to i32
%115 = add nuw nsw i32 %114, 16
%116 = icmp ult i32 %112, %115
br i1 %116, label %106, label %117
117: ; preds = %106
%118 = trunc i64 %111 to i32
%119 = call i32 @SHA512_Init(i32* %4)
%120 = call i32 @SHA512_Update(i32* %4, i8* %11, i32 %118)
%121 = call i32 @SHA512_Final(i8* %15, i32* %4)
%122 = call i8* @alloca(i32 %8)
%123 = call i32 @bzero(i8* %122, i32 16)
%124 = call i8* (i8*, ...) @memcpy(i8* %122, i8* %15, i32 %8)
%125 = call i32 @memset(i8* %2, i32 0, i32 16)
%126 = call i32 @strlen(i8* %1)
%127 = call i8* (i8*, ...) @memcpy(i8* %2, i8* %122, i32 %126)
%128 = getelementptr inbounds i8, i8* %2, i64 16
%129 = call i8* (i8*, ...) @memcpy(i8* %128, i8* %14, i32 64)
%130 = getelementptr inbounds i8, i8* %2, i64 80
%131 = call i8* (i8*, ...) @memcpy(i8* %130, i8* %92, i32 %5)
ret void
}