#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 u_int32_t;
typedef int /*<<< orphan*/ u_char;
typedef int /*<<< orphan*/ ret2;

/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int roll_hash(int /*<<< orphan*/ const);
int roll_reset();
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int /*<<< orphan*/ strcat(char *, char *);
int strlen(char *);
int sum_hash(int /*<<< orphan*/ const, int);
char *spamsum(const u_char *in, size_t length, u_int32_t bsize) {
  const char *b64 =
      "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  char *ret, *p;
  u_int32_t total_chars;
  u_int32_t h, h2, h3;
  u_int32_t i, j, k;
  u_int32_t block_size;
  char ret2[64 / 2 + 1];
  total_chars = length;
  if (bsize == 0) {
    block_size = 3;
    while (block_size * 64 < total_chars) {
      block_size = block_size * 2;
    }
  } else {
    block_size = bsize;
  }
  ret = malloc(64 + 64 / 2 + 20);
  if (!ret)
    return NULL;
again:
  snprintf(ret, 12, "%u:", block_size);
  p = ret + strlen(ret);
  memset(p, 0, 64 + 1);
  memset(ret2, 0, sizeof(ret2));
  k = j = 0;
  h3 = h2 = 0x28021967;
  h = roll_reset();
  for (i = 0; i < length; i++) {
    h = roll_hash(in[i]);
    h2 = sum_hash(in[i], h2);
    h3 = sum_hash(in[i], h3);
    if (h % block_size == (block_size - 1)) {
      p[j] = b64[h2 % 64];
      if (j < 64 - 1) {
        h2 = 0x28021967;
        j++;
      }
    }
    if (h % (block_size * 2) == ((block_size * 2) - 1)) {
      ret2[k] = b64[h3 % 64];
      if (k < 64 / 2 - 1) {
        h3 = 0x28021967;
        k++;
      }
    }
  }
  if (h != 0) {
    p[j] = b64[h2 % 64];
    ret2[k] = b64[h3 % 64];
  }
  strcat(p + j, ":");
  strcat(p + j, ret2);
  if (bsize == 0 && block_size > 3 && j < 64 / 2) {
    block_size = block_size / 2;
    goto again;
  }
  return ret;
}


x86 assembly (clang, -O0):
<spamsum>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
lea    0xe63(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    11db <spamsum+0x5b>
movl   $0x3,-0x58(%rbp)
mov    -0x58(%rbp),%eax
shl    $0x6,%eax
cmp    -0x3c(%rbp),%eax
jge    11d6 <spamsum+0x56>
mov    -0x58(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    11b9 <spamsum+0x39>
jmp    11e1 <spamsum+0x61>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    $0x74,%edi
call   1080 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1207 <spamsum+0x87>
movq   $0x0,-0x8(%rbp)
jmp    1488 <spamsum+0x308>
jmp    120c <spamsum+0x8c>
mov    -0x30(%rbp),%rdi
mov    -0x58(%rbp),%ecx
mov    $0xc,%esi
lea    0xe22(%rip),%rdx
call   1050 <snprintf@plt>
mov    -0x30(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x30(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x88(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0x41,%edx
call   1060 <memset@plt>
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x21,%edx
call   1060 <memset@plt>
movl   $0x0,-0x50(%rbp)
movl   $0x0,-0x54(%rbp)
movl   $0x28021967,-0x44(%rbp)
movl   $0x28021967,-0x48(%rbp)
mov    $0x0,%al
call   1070 <roll_reset@plt>
mov    %eax,-0x40(%rbp)
movl   $0x0,-0x4c(%rbp)
movslq -0x4c(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    13c1 <spamsum+0x241>
mov    -0x10(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1030 <roll_hash@plt>
mov    %eax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x44(%rbp),%esi
call   10a0 <sum_hash@plt>
mov    %eax,-0x44(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x48(%rbp),%esi
call   10a0 <sum_hash@plt>
mov    %eax,-0x48(%rbp)
mov    -0x40(%rbp),%eax
cltd
idivl  -0x58(%rbp)
mov    -0x58(%rbp),%eax
sub    $0x1,%eax
cmp    %eax,%edx
jne    1347 <spamsum+0x1c7>
mov    -0x28(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x44(%rbp),%eax
mov    $0x40,%ecx
cltd
idiv   %ecx
mov    -0x90(%rbp),%rax
movslq %edx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x38(%rbp),%rax
movslq -0x50(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
cmpl   $0x3f,-0x50(%rbp)
jge    1342 <spamsum+0x1c2>
movl   $0x28021967,-0x44(%rbp)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    1347 <spamsum+0x1c7>
mov    -0x40(%rbp),%eax
mov    -0x58(%rbp),%ecx
shl    $0x1,%ecx
cltd
idiv   %ecx
mov    -0x58(%rbp),%eax
shl    $0x1,%eax
sub    $0x1,%eax
cmp    %eax,%edx
jne    13ae <spamsum+0x22e>
mov    -0x28(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x48(%rbp),%eax
mov    $0x40,%ecx
cltd
idiv   %ecx
mov    -0x98(%rbp),%rax
movslq %edx,%rcx
mov    (%rax,%rcx,1),%cl
movslq -0x54(%rbp),%rax
mov    %cl,-0x80(%rbp,%rax,1)
cmpl   $0x1f,-0x54(%rbp)
jge    13a9 <spamsum+0x229>
movl   $0x28021967,-0x48(%rbp)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    13ae <spamsum+0x22e>
jmp    13b3 <spamsum+0x233>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1298 <spamsum+0x118>
cmpl   $0x0,-0x40(%rbp)
je     1424 <spamsum+0x2a4>
mov    -0x28(%rbp),%rax
mov    %rax,-0xa8(%rbp)
mov    -0x44(%rbp),%eax
mov    $0x40,%ecx
cltd
idiv   %ecx
mov    -0xa8(%rbp),%rax
movslq %edx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x38(%rbp),%rax
movslq -0x50(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x28(%rbp),%rax
mov    %rax,-0xa0(%rbp)
mov    -0x48(%rbp),%eax
mov    $0x40,%ecx
cltd
idiv   %ecx
mov    -0xa0(%rbp),%rax
movslq %edx,%rcx
mov    (%rax,%rcx,1),%cl
movslq -0x54(%rbp),%rax
mov    %cl,-0x80(%rbp,%rax,1)
mov    -0x38(%rbp),%rdi
movslq -0x50(%rbp),%rax
add    %rax,%rdi
lea    0xc0d(%rip),%rsi
call   1090 <strcat@plt>
mov    -0x38(%rbp),%rdi
movslq -0x50(%rbp),%rax
add    %rax,%rdi
lea    -0x80(%rbp),%rsi
call   1090 <strcat@plt>
cmpl   $0x0,-0x1c(%rbp)
jne    1480 <spamsum+0x300>
cmpl   $0x3,-0x58(%rbp)
jle    1480 <spamsum+0x300>
cmpl   $0x20,-0x50(%rbp)
jge    1480 <spamsum+0x300>
mov    -0x58(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x58(%rbp)
jmp    120c <spamsum+0x8c>
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spamsum>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%r12
mov    %rdi,0x38(%rsp)
mov    %edx,%r14d
mov    %edx,0x20(%rsp)
test   %edx,%edx
jne    11c1 <spamsum+0x41>
mov    $0x3,%eax
cs nopw 0x0(%rax,%rax,1)
mov    %eax,%r14d
mov    %eax,%ecx
shl    $0x6,%ecx
lea    (%r14,%r14,1),%eax
cmp    %r12d,%ecx
jl     11b0 <spamsum+0x30>
mov    $0x74,%edi
call   1080 <malloc@plt>
mov    %rax,0x30(%rsp)
test   %rax,%rax
je     1447 <spamsum+0x2c7>
lea    0x40(%rsp),%rbx
mov    %r12,0x18(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x30(%rsp),%rbp
mov    %rbp,%rdi
mov    $0xc,%esi
lea    0xe3d(%rip),%rdx
mov    %r14d,%ecx
call   1050 <snprintf@plt>
mov    %rbp,%rdi
call   1040 <strlen@plt>
movslq %eax,%rdi
add    %rbp,%rdi
mov    %rdi,0x10(%rsp)
xor    %esi,%esi
mov    $0x41,%edx
call   1060 <memset@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x21,%edx
call   1060 <memset@plt>
xor    %eax,%eax
call   1070 <roll_reset@plt>
test   %r12,%r12
je     1380 <spamsum+0x200>
lea    -0x1(%r14),%eax
mov    %eax,0x2c(%rsp)
lea    (%r14,%r14,1),%eax
mov    %eax,0x28(%rsp)
lea    (%r14,%r14,1),%eax
add    $0xffffffff,%eax
mov    %eax,0x24(%rsp)
mov    $0x28021967,%r13d
xor    %ebp,%ebp
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
mov    $0x28021967,%r12d
jmp    129f <spamsum+0x11f>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rbp
cmp    %rbp,0x18(%rsp)
je     139f <spamsum+0x21f>
mov    %r14,%rbx
mov    0x38(%rsp),%r14
mov    (%r14,%rbp,4),%edi
call   1030 <roll_hash@plt>
mov    %eax,%r15d
mov    (%r14,%rbp,4),%edi
mov    %r12d,%esi
call   10a0 <sum_hash@plt>
mov    %eax,%r12d
mov    (%r14,%rbp,4),%edi
mov    %rbx,%r14
mov    %r13d,%esi
call   10a0 <sum_hash@plt>
mov    %eax,%r13d
mov    %r15d,%eax
cltd
idiv   %r14d
cmp    0x2c(%rsp),%edx
jne    1327 <spamsum+0x1a7>
lea    0x3f(%r12),%eax
test   %r12d,%r12d
cmovns %r12d,%eax
and    $0xffffffc0,%eax
mov    %r12d,%ecx
sub    %eax,%ecx
movslq %ecx,%rax
lea    0xd01(%rip),%rcx
movzbl (%rax,%rcx,1),%eax
movslq 0x8(%rsp),%rcx
mov    0x10(%rsp),%rdx
mov    %al,(%rdx,%rcx,1)
xor    %edx,%edx
cmp    $0x3f,%ecx
setl   %dl
mov    $0x28021967,%eax
cmovl  %eax,%r12d
add    %ecx,%edx
mov    %edx,0x8(%rsp)
mov    %r15d,%eax
cltd
idivl  0x28(%rsp)
cmp    0x24(%rsp),%edx
jne    1290 <spamsum+0x110>
lea    0x3f(%r13),%eax
test   %r13d,%r13d
cmovns %r13d,%eax
and    $0xffffffc0,%eax
mov    %r13d,%ecx
sub    %eax,%ecx
movslq %ecx,%rax
lea    0xcaa(%rip),%rcx
movzbl (%rax,%rcx,1),%eax
movslq 0xc(%rsp),%rcx
mov    %al,0x40(%rsp,%rcx,1)
xor    %edx,%edx
cmp    $0x1f,%ecx
setl   %dl
mov    $0x28021967,%eax
cmovl  %eax,%r13d
add    %ecx,%edx
mov    %edx,0xc(%rsp)
jmp    1290 <spamsum+0x110>
nop
mov    %eax,%r15d
movl   $0x0,0x8(%rsp)
mov    $0x28021967,%r12d
mov    $0x28021967,%r13d
movl   $0x0,0xc(%rsp)
movslq 0x8(%rsp),%rax
test   %r15d,%r15d
je     1400 <spamsum+0x280>
lea    0x3f(%r12),%ecx
test   %r12d,%r12d
cmovns %r12d,%ecx
and    $0xffffffc0,%ecx
sub    %ecx,%r12d
movslq %r12d,%rcx
lea    0xc3b(%rip),%rdx
mov    (%rcx,%rdx,1),%cl
mov    0x10(%rsp),%rbp
mov    %cl,0x0(%rbp,%rax,1)
lea    0x3f(%r13),%ecx
test   %r13d,%r13d
cmovns %r13d,%ecx
and    $0xffffffc0,%ecx
sub    %ecx,%r13d
movslq %r13d,%rcx
mov    (%rcx,%rdx,1),%cl
movslq 0xc(%rsp),%rdx
mov    %cl,0x40(%rsp,%rdx,1)
mov    0x18(%rsp),%r12
lea    0x40(%rsp),%rbx
jmp    140f <spamsum+0x28f>
nopl   (%rax)
mov    0x18(%rsp),%r12
lea    0x40(%rsp),%rbx
mov    0x10(%rsp),%rbp
add    %rax,%rbp
mov    %rbp,%rdi
lea    0xc27(%rip),%rsi
call   1090 <strcat@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1090 <strcat@plt>
cmpl   $0x0,0x20(%rsp)
jne    1447 <spamsum+0x2c7>
cmp    $0x4,%r14d
jl     1447 <spamsum+0x2c7>
shr    %r14d
cmpl   $0x20,0x8(%rsp)
jl     11f0 <spamsum+0x70>
mov    0x30(%rsp),%rax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [65 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\00"
@.str.1 = [4 x i8] c"%u:\00"
@.str.2 = [2 x i8] c":\00"
define i8* @spamsum(i32* %0, i64 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca [33 x i8]
store i32* %0, i32** %5
store i64 %1, i64* %6
store i32 %2, i32* %7
store i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i8** %8
%20 = load i64, i64* %6
%21 = trunc i64 %20 to i32
store i32 %21, i32* %11
%22 = load i32, i32* %7
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %34
24: ; preds = %3
store i32 3, i32* %18
br label %25
25: ; preds = %30, %24
%26 = load i32, i32* %18
%27 = mul nsw i32 %26, 64
%28 = load i32, i32* %11
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %33
30: ; preds = %25
%31 = load i32, i32* %18
%32 = mul nsw i32 %31, 2
store i32 %32, i32* %18
br label %25
33: ; preds = %25
br label %36
34: ; preds = %3
%35 = load i32, i32* %7
store i32 %35, i32* %18
br label %36
36: ; preds = %34, %33
%37 = call i8* @malloc(i32 116)
store i8* %37, i8** %9
%38 = load i8*, i8** %9
%39 = icmp ne i8* %38, null
br i1 %39, label %41, label %40
40: ; preds = %36
store i8* null, i8** %4
br label %182
41: ; preds = %36
br label %42
42: ; preds = %177, %41
%43 = load i8*, i8** %9
%44 = load i32, i32* %18
%45 = call i32 @snprintf(i8* %43, i32 12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %44)
%46 = load i8*, i8** %9
%47 = load i8*, i8** %9
%48 = call i32 @strlen(i8* %47)
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8, i8* %46, i64 %49
store i8* %50, i8** %10
%51 = load i8*, i8** %10
%52 = call i32 @memset(i8* %51, i32 0, i32 65)
%53 = getelementptr inbounds [33 x i8], [33 x i8]* %19, i64 0, i64 0
%54 = call i32 @memset(i8* %53, i32 0, i32 33)
store i32 0, i32* %16
store i32 0, i32* %17
store i32 671226215, i32* %13
store i32 671226215, i32* %14
%55 = call i32 (...) @roll_reset()
store i32 %55, i32* %12
store i32 0, i32* %15
br label %56
56: ; preds = %131, %42
%57 = load i32, i32* %15
%58 = sext i32 %57 to i64
%59 = load i64, i64* %6
%60 = icmp ult i64 %58, %59
br i1 %60, label %61, label %134
61: ; preds = %56
%62 = load i32*, i32** %5
%63 = load i32, i32* %15
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i32, i32* %62, i64 %64
%66 = load i32, i32* %65
%67 = call i32 @roll_hash(i32 %66)
store i32 %67, i32* %12
%68 = load i32*, i32** %5
%69 = load i32, i32* %15
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds i32, i32* %68, i64 %70
%72 = load i32, i32* %71
%73 = load i32, i32* %13
%74 = call i32 @sum_hash(i32 %72, i32 %73)
store i32 %74, i32* %13
%75 = load i32*, i32** %5
%76 = load i32, i32* %15
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i32, i32* %75, i64 %77
%79 = load i32, i32* %78
%80 = load i32, i32* %14
%81 = call i32 @sum_hash(i32 %79, i32 %80)
store i32 %81, i32* %14
%82 = load i32, i32* %12
%83 = load i32, i32* %18
%84 = srem i32 %82, %83
%85 = load i32, i32* %18
%86 = sub nsw i32 %85, 1
%87 = icmp eq i32 %84, %86
br i1 %87, label %88, label %105
88: ; preds = %61
%89 = load i8*, i8** %8
%90 = load i32, i32* %13
%91 = srem i32 %90, 64
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds i8, i8* %89, i64 %92
%94 = load i8, i8* %93
%95 = load i8*, i8** %10
%96 = load i32, i32* %16
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds i8, i8* %95, i64 %97
store i8 %94, i8* %98
%99 = load i32, i32* %16
%100 = icmp slt i32 %99, 63
br i1 %100, label %101, label %104
101: ; preds = %88
store i32 671226215, i32* %13
%102 = load i32, i32* %16
%103 = add nsw i32 %102, 1
store i32 %103, i32* %16
br label %104
104: ; preds = %101, %88
br label %105
105: ; preds = %104, %61
%106 = load i32, i32* %12
%107 = load i32, i32* %18
%108 = mul nsw i32 %107, 2
%109 = srem i32 %106, %108
%110 = load i32, i32* %18
%111 = mul nsw i32 %110, 2
%112 = sub nsw i32 %111, 1
%113 = icmp eq i32 %109, %112
br i1 %113, label %114, label %130
114: ; preds = %105
%115 = load i8*, i8** %8
%116 = load i32, i32* %14
%117 = srem i32 %116, 64
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds i8, i8* %115, i64 %118
%120 = load i8, i8* %119
%121 = load i32, i32* %17
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds [33 x i8], [33 x i8]* %19, i64 0, i64 %122
store i8 %120, i8* %123
%124 = load i32, i32* %17
%125 = icmp slt i32 %124, 31
br i1 %125, label %126, label %129
126: ; preds = %114
store i32 671226215, i32* %14
%127 = load i32, i32* %17
%128 = add nsw i32 %127, 1
store i32 %128, i32* %17
br label %129
129: ; preds = %126, %114
br label %130
130: ; preds = %129, %105
br label %131
131: ; preds = %130
%132 = load i32, i32* %15
%133 = add nsw i32 %132, 1
store i32 %133, i32* %15
br label %56
134: ; preds = %56
%135 = load i32, i32* %12
%136 = icmp ne i32 %135, 0
br i1 %136, label %137, label %157
137: ; preds = %134
%138 = load i8*, i8** %8
%139 = load i32, i32* %13
%140 = srem i32 %139, 64
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds i8, i8* %138, i64 %141
%143 = load i8, i8* %142
%144 = load i8*, i8** %10
%145 = load i32, i32* %16
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds i8, i8* %144, i64 %146
store i8 %143, i8* %147
%148 = load i8*, i8** %8
%149 = load i32, i32* %14
%150 = srem i32 %149, 64
%151 = sext i32 %150 to i64
%152 = getelementptr inbounds i8, i8* %148, i64 %151
%153 = load i8, i8* %152
%154 = load i32, i32* %17
%155 = sext i32 %154 to i64
%156 = getelementptr inbounds [33 x i8], [33 x i8]* %19, i64 0, i64 %155
store i8 %153, i8* %156
br label %157
157: ; preds = %137, %134
%158 = load i8*, i8** %10
%159 = load i32, i32* %16
%160 = sext i32 %159 to i64
%161 = getelementptr inbounds i8, i8* %158, i64 %160
%162 = call i32 @strcat(i8* %161, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%163 = load i8*, i8** %10
%164 = load i32, i32* %16
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds i8, i8* %163, i64 %165
%167 = getelementptr inbounds [33 x i8], [33 x i8]* %19, i64 0, i64 0
%168 = call i32 @strcat(i8* %166, i8* %167)
%169 = load i32, i32* %7
%170 = icmp eq i32 %169, 0
br i1 %170, label %171, label %180
171: ; preds = %157
%172 = load i32, i32* %18
%173 = icmp sgt i32 %172, 3
br i1 %173, label %174, label %180
174: ; preds = %171
%175 = load i32, i32* %16
%176 = icmp slt i32 %175, 32
br i1 %176, label %177, label %180
177: ; preds = %174
%178 = load i32, i32* %18
%179 = sdiv i32 %178, 2
store i32 %179, i32* %18
br label %42
180: ; preds = %174, %171, %157
%181 = load i8*, i8** %9
store i8* %181, i8** %4
br label %182
182: ; preds = %180, %40
%183 = load i8*, i8** %4
ret i8* %183
}

LLVM IR (-O2):
@.str = [65 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\00"
@.str.1 = [4 x i8] c"%u:\00"
@.str.2 = [2 x i8] c":\00"
define i8* @spamsum(i32* nocapture %0, i64 %1, i32 %2) {
%4 = alloca [33 x i8]
%5 = getelementptr inbounds [33 x i8], [33 x i8]* %4, i64 0, i64 0
%6 = trunc i64 %1 to i32
%7 = icmp eq i32 %2, 0
br i1 %7, label %8, label %13
8: ; preds = %3, %8
%9 = phi i32 [ %12, %8 ], [ 3, %3 ]
%10 = shl nsw i32 %9, 6
%11 = icmp slt i32 %10, %6
%12 = shl nsw i32 %9, 1
br i1 %11, label %8, label %13
13: ; preds = %8, %3
%14 = phi i32 [ %2, %3 ], [ %9, %8 ]
%15 = tail call dereferenceable_or_null(116) i8* @malloc(i32 116)
%16 = icmp eq i8* %15, null
br i1 %16, label %111, label %17
17: ; preds = %13
%18 = icmp eq i64 %1, 0
br label %19
19: ; preds = %101, %17
%20 = phi i32 [ %110, %101 ], [ %14, %17 ]
%21 = call i32 @snprintf(i8* %15, i32 12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = call i32 @strlen(i8* %15)
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %15, i64 %23
%25 = call i32 @memset(i8* %24, i32 0, i32 65)
%26 = call i32 @memset(i8* %5, i32 0, i32 33)
%27 = call i32 (...) @roll_reset()
br i1 %18, label %79, label %28
28: ; preds = %19
%29 = add nsw i32 %20, -1
%30 = shl nsw i32 %20, 1
%31 = add nsw i32 %30, -1
br label %32
32: ; preds = %28, %74
%33 = phi i64 [ 0, %28 ], [ %77, %74 ]
%34 = phi i32 [ 0, %28 ], [ %76, %74 ]
%35 = phi i32 [ 0, %28 ], [ %60, %74 ]
%36 = phi i32 [ 671226215, %28 ], [ %75, %74 ]
%37 = phi i32 [ 671226215, %28 ], [ %59, %74 ]
%38 = getelementptr inbounds i32, i32* %0, i64 %33
%39 = load i32, i32* %38
%40 = call i32 @roll_hash(i32 %39)
%41 = load i32, i32* %38
%42 = call i32 @sum_hash(i32 %41, i32 %37)
%43 = load i32, i32* %38
%44 = call i32 @sum_hash(i32 %43, i32 %36)
%45 = srem i32 %40, %20
%46 = icmp eq i32 %45, %29
br i1 %46, label %47, label %58
47: ; preds = %32
%48 = srem i32 %42, 64
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [65 x i8], [65 x i8]* @.str, i64 0, i64 %49
%51 = load i8, i8* %50
%52 = sext i32 %35 to i64
%53 = getelementptr inbounds i8, i8* %24, i64 %52
store i8 %51, i8* %53
%54 = icmp slt i32 %35, 63
%55 = select i1 %54, i32 671226215, i32 %42
%56 = zext i1 %54 to i32
%57 = add nsw i32 %35, %56
br label %58
58: ; preds = %47, %32
%59 = phi i32 [ %42, %32 ], [ %55, %47 ]
%60 = phi i32 [ %35, %32 ], [ %57, %47 ]
%61 = srem i32 %40, %30
%62 = icmp eq i32 %61, %31
br i1 %62, label %63, label %74
63: ; preds = %58
%64 = srem i32 %44, 64
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [65 x i8], [65 x i8]* @.str, i64 0, i64 %65
%67 = load i8, i8* %66
%68 = sext i32 %34 to i64
%69 = getelementptr inbounds [33 x i8], [33 x i8]* %4, i64 0, i64 %68
store i8 %67, i8* %69
%70 = icmp slt i32 %34, 31
%71 = select i1 %70, i32 671226215, i32 %44
%72 = zext i1 %70 to i32
%73 = add nsw i32 %34, %72
br label %74
74: ; preds = %63, %58
%75 = phi i32 [ %44, %58 ], [ %71, %63 ]
%76 = phi i32 [ %34, %58 ], [ %73, %63 ]
%77 = add nuw i64 %33, 1
%78 = icmp eq i64 %77, %1
br i1 %78, label %79, label %32
79: ; preds = %74, %19
%80 = phi i32 [ %27, %19 ], [ %40, %74 ]
%81 = phi i32 [ 671226215, %19 ], [ %59, %74 ]
%82 = phi i32 [ 671226215, %19 ], [ %75, %74 ]
%83 = phi i32 [ 0, %19 ], [ %60, %74 ]
%84 = phi i32 [ 0, %19 ], [ %76, %74 ]
%85 = icmp eq i32 %80, 0
br i1 %85, label %86, label %88
86: ; preds = %79
%87 = sext i32 %83 to i64
br label %101
88: ; preds = %79
%89 = srem i32 %81, 64
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds [65 x i8], [65 x i8]* @.str, i64 0, i64 %90
%92 = load i8, i8* %91
%93 = sext i32 %83 to i64
%94 = getelementptr inbounds i8, i8* %24, i64 %93
store i8 %92, i8* %94
%95 = srem i32 %82, 64
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds [65 x i8], [65 x i8]* @.str, i64 0, i64 %96
%98 = load i8, i8* %97
%99 = sext i32 %84 to i64
%100 = getelementptr inbounds [33 x i8], [33 x i8]* %4, i64 0, i64 %99
store i8 %98, i8* %100
br label %101
101: ; preds = %86, %88
%102 = phi i64 [ %87, %86 ], [ %93, %88 ]
%103 = getelementptr inbounds i8, i8* %24, i64 %102
%104 = call i32 @strcat(i8* %103, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%105 = call i32 @strcat(i8* %103, i8* %5)
%106 = icmp sgt i32 %20, 3
%107 = and i1 %7, %106
%108 = icmp slt i32 %83, 32
%109 = select i1 %107, i1 %108, i1 false
%110 = lshr i32 %20, 1
br i1 %109, label %19, label %111
111: ; preds = %101, %13
ret i8* %15
}