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

/* Variables and functions */
int /*<<< orphan*/ assert(int);
scalar_t__ bcd_add(char *, char *, int, char *);
int bcd_decode(char *);
int bcd_div(char *, char *, int, char *, int, char *);
scalar_t__ bcd_encode(int, int, char *);
int bcd_eq(char *, char *);
scalar_t__ bcd_gt(char *, char *);
scalar_t__ bcd_mul(char *, char *, int, char *);
int bcd_sub(char *, char *, int, char *);
int /*<<< orphan*/ printf(char *, int, ...);
int rand();
int main() {
  int i, j, k, a, b;
  char s[128], t[128], u[128], v[128];
  for (i = 0; i < 1000; i++) {
    j = rand() % 10;
    a = rand() % 100000000 >> j;
    j = rand() % 25;
    b = rand() % 10000000 >> j;
    if (rand() % 20 == 11) {
      a = b;
      printf(">>>>>>>>>>>> %d\n", a);
    } else
      printf("%d %d\n", a, b);
    assert(bcd_encode(a, 128, s) == 0);
    assert(bcd_encode(b, 128, t) == 0);
    if (a > b) {
      assert(bcd_gt(s, t) && !bcd_eq(s, t));
    }
    if (a == b)
      assert(bcd_eq(s, t));
    assert(bcd_add(s, t, 128, u) == 0 && a + b == bcd_decode(u));
    if (a >= b)
      assert(bcd_sub(s, t, 128, u) == 0 && a - b == bcd_decode(u));
    else
      assert(bcd_sub(s, t, 128, u) == -1);
    assert(bcd_mul(s, t, 128, u) == 0 && a * b == bcd_decode(u));
    if (b == 0)
      assert(bcd_div(s, t, 128, u, 128, v) == -1);
    else
      assert(bcd_div(s, t, 128, u, 128, v) == 0 && a / b == bcd_decode(u) &&
             a % b == bcd_decode(v));
  }
  assert(bcd_encode(5676765, 128, s) == 0);
  assert(bcd_encode(0, 128, t) == 0);
  assert(bcd_mul(s, t, 128, u) == 0 && u[0] == 1 && u[1] == 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x250,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    15d5 <main+0x425>
mov    $0x0,%al
call   10d0 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    $0x0,%al
call   10d0 <rand@plt>
mov    $0x5f5e100,%ecx
cltd
idiv   %ecx
mov    -0xc(%rbp),%ecx
sar    %cl,%edx
mov    %edx,-0x14(%rbp)
mov    $0x0,%al
call   10d0 <rand@plt>
mov    $0x19,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    $0x0,%al
call   10d0 <rand@plt>
mov    $0x989680,%ecx
cltd
idiv   %ecx
mov    -0xc(%rbp),%ecx
sar    %cl,%edx
mov    %edx,-0x18(%rbp)
mov    $0x0,%al
call   10d0 <rand@plt>
mov    $0x14,%ecx
cltd
idiv   %ecx
cmp    $0xb,%edx
jne    125c <main+0xac>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xdb0(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1270 <main+0xc0>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xda8(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x14(%rbp),%edi
lea    -0xa0(%rbp),%rdx
mov    $0x80,%esi
call   10b0 <bcd_encode@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x18(%rbp),%edi
lea    -0x120(%rbp),%rdx
mov    $0x80,%esi
call   10b0 <bcd_encode@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    131f <main+0x16f>
lea    -0xa0(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   1080 <bcd_gt@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x221(%rbp)
je     130f <main+0x15f>
lea    -0xa0(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   1050 <bcd_eq@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x221(%rbp)
mov    -0x221(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    1345 <main+0x195>
lea    -0xa0(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   1050 <bcd_eq@plt>
mov    %eax,%edi
call   1090 <assert@plt>
lea    -0xa0(%rbp),%rdi
lea    -0x120(%rbp),%rsi
lea    -0x1a0(%rbp),%rcx
mov    $0x80,%edx
call   10c0 <bcd_add@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x222(%rbp)
jne    13a4 <main+0x1f4>
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x228(%rbp)
lea    -0x1a0(%rbp),%rdi
call   1030 <bcd_decode@plt>
mov    %eax,%ecx
mov    -0x228(%rbp),%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0x222(%rbp)
mov    -0x222(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jl     1432 <main+0x282>
lea    -0xa0(%rbp),%rdi
lea    -0x120(%rbp),%rsi
lea    -0x1a0(%rbp),%rcx
mov    $0x80,%edx
call   10a0 <bcd_sub@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x229(%rbp)
jne    141d <main+0x26d>
mov    -0x14(%rbp),%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x230(%rbp)
lea    -0x1a0(%rbp),%rdi
call   1030 <bcd_decode@plt>
mov    %eax,%ecx
mov    -0x230(%rbp),%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0x229(%rbp)
mov    -0x229(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
jmp    1461 <main+0x2b1>
lea    -0xa0(%rbp),%rdi
lea    -0x120(%rbp),%rsi
lea    -0x1a0(%rbp),%rcx
mov    $0x80,%edx
call   10a0 <bcd_sub@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
lea    -0xa0(%rbp),%rdi
lea    -0x120(%rbp),%rsi
lea    -0x1a0(%rbp),%rcx
mov    $0x80,%edx
call   1040 <bcd_mul@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x231(%rbp)
jne    14c1 <main+0x311>
mov    -0x14(%rbp),%eax
imul   -0x18(%rbp),%eax
mov    %eax,-0x238(%rbp)
lea    -0x1a0(%rbp),%rdi
call   1030 <bcd_decode@plt>
mov    %eax,%ecx
mov    -0x238(%rbp),%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0x231(%rbp)
mov    -0x231(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
cmpl   $0x0,-0x18(%rbp)
jne    151a <main+0x36a>
lea    -0xa0(%rbp),%rdi
lea    -0x120(%rbp),%rsi
lea    -0x1a0(%rbp),%rcx
lea    -0x220(%rbp),%r9
mov    $0x80,%r8d
mov    %r8d,%edx
call   1060 <bcd_div@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
jmp    15c2 <main+0x412>
lea    -0xa0(%rbp),%rdi
lea    -0x120(%rbp),%rsi
lea    -0x1a0(%rbp),%rcx
lea    -0x220(%rbp),%r9
mov    $0x80,%r8d
mov    %r8d,%edx
call   1060 <bcd_div@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x239(%rbp)
jne    15b2 <main+0x402>
mov    -0x14(%rbp),%eax
cltd
idivl  -0x18(%rbp)
mov    %eax,-0x240(%rbp)
lea    -0x1a0(%rbp),%rdi
call   1030 <bcd_decode@plt>
mov    -0x240(%rbp),%ecx
mov    %eax,%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x239(%rbp)
jne    15b2 <main+0x402>
mov    -0x14(%rbp),%eax
cltd
idivl  -0x18(%rbp)
mov    %edx,-0x244(%rbp)
lea    -0x220(%rbp),%rdi
call   1030 <bcd_decode@plt>
mov    -0x244(%rbp),%edx
cmp    %eax,%edx
sete   %al
mov    %al,-0x239(%rbp)
mov    -0x239(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
jmp    15c7 <main+0x417>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11c9 <main+0x19>
lea    -0xa0(%rbp),%rdx
mov    $0x569edd,%edi
mov    $0x80,%esi
call   10b0 <bcd_encode@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
lea    -0x120(%rbp),%rdx
xor    %edi,%edi
mov    $0x80,%esi
call   10b0 <bcd_encode@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
lea    -0xa0(%rbp),%rdi
lea    -0x120(%rbp),%rsi
lea    -0x1a0(%rbp),%rcx
mov    $0x80,%edx
call   1040 <bcd_mul@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x245(%rbp)
jne    167f <main+0x4cf>
movsbl -0x1a0(%rbp),%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
mov    %al,-0x245(%rbp)
jne    167f <main+0x4cf>
movsbl -0x19f(%rbp),%eax
cmp    $0x0,%eax
sete   %al
mov    %al,-0x245(%rbp)
mov    -0x245(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
xor    %eax,%eax
add    $0x250,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x208,%rsp
mov    $0x3e8,%r12d
lea    0x180(%rsp),%r15
lea    0x80(%rsp),%r13
jmp    11f4 <main+0x44>
nopl   0x0(%rax)
xor    %eax,%eax
movzbl %al,%edi
call   1090 <assert@plt>
add    $0xffffffff,%r12d
je     14d1 <main+0x321>
xor    %eax,%eax
call   10d0 <rand@plt>
movslq %eax,%rbx
imul   $0x66666667,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ebx
xor    %eax,%eax
call   10d0 <rand@plt>
movslq %eax,%rbp
imul   $0x55e63b89,%rbp,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x39,%rax
add    %ecx,%eax
imul   $0x5f5e100,%eax,%eax
sub    %eax,%ebp
mov    %ebx,%ecx
sar    %cl,%ebp
xor    %eax,%eax
call   10d0 <rand@plt>
movslq %eax,%rbx
imul   $0x51eb851f,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x23,%rax
add    %ecx,%eax
lea    (%rax,%rax,4),%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ebx
xor    %eax,%eax
call   10d0 <rand@plt>
movslq %eax,%r14
imul   $0x6b5fca6b,%r14,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x36,%rax
add    %ecx,%eax
imul   $0x989680,%eax,%eax
sub    %eax,%r14d
mov    %ebx,%ecx
sar    %cl,%r14d
xor    %eax,%eax
call   10d0 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
cmp    $0xb,%eax
jne    12e0 <main+0x130>
lea    0xd3a(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r14d,%ebp
jmp    12f3 <main+0x143>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xd2a(%rip),%rdi
mov    %ebp,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rsp,%rbx
mov    %ebp,%edi
mov    $0x80,%esi
mov    %r15,%rdx
call   10b0 <bcd_encode@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1090 <assert@plt>
mov    %r14d,%edi
mov    $0x80,%esi
mov    %r13,%rdx
call   10b0 <bcd_encode@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1090 <assert@plt>
cmp    %r14d,%ebp
jle    1362 <main+0x1b2>
mov    %r15,%rdi
mov    %r13,%rsi
call   1080 <bcd_gt@plt>
test   %rax,%rax
je     1358 <main+0x1a8>
mov    %r15,%rdi
mov    %r13,%rsi
call   1050 <bcd_eq@plt>
test   %eax,%eax
sete   %al
jmp    135a <main+0x1aa>
xor    %eax,%eax
movzbl %al,%edi
call   1090 <assert@plt>
cmp    %r14d,%ebp
jne    1379 <main+0x1c9>
mov    %r15,%rdi
mov    %r13,%rsi
call   1050 <bcd_eq@plt>
mov    %eax,%edi
call   1090 <assert@plt>
mov    %r15,%rdi
mov    %r13,%rsi
mov    $0x80,%edx
mov    %rbx,%rcx
call   10c0 <bcd_add@plt>
test   %rax,%rax
je     13a0 <main+0x1f0>
xor    %eax,%eax
jmp    13b4 <main+0x204>
cs nopw 0x0(%rax,%rax,1)
nop
lea    (%r14,%rbp,1),%ebx
mov    %rsp,%rdi
call   1030 <bcd_decode@plt>
cmp    %eax,%ebx
mov    %rsp,%rbx
sete   %al
movzbl %al,%edi
call   1090 <assert@plt>
mov    %r15,%rdi
mov    %r13,%rsi
mov    $0x80,%edx
mov    %rbx,%rcx
call   10a0 <bcd_sub@plt>
mov    %ebp,%ebx
sub    %r14d,%ebx
jge    13e0 <main+0x230>
cmp    $0xffffffff,%eax
sete   %al
jmp    13ea <main+0x23a>
xchg   %ax,%ax
test   %eax,%eax
je     14ab <main+0x2fb>
xor    %eax,%eax
mov    %rsp,%rbx
movzbl %al,%edi
call   1090 <assert@plt>
mov    %r15,%rdi
mov    %r13,%rsi
mov    $0x80,%edx
mov    %rbx,%rcx
call   1040 <bcd_mul@plt>
test   %rax,%rax
je     1420 <main+0x270>
xor    %eax,%eax
jmp    1436 <main+0x286>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebp,%ebx
imul   %r14d,%ebx
mov    %rsp,%rdi
call   1030 <bcd_decode@plt>
cmp    %eax,%ebx
mov    %rsp,%rbx
sete   %al
movzbl %al,%edi
call   1090 <assert@plt>
mov    %r15,%rdi
mov    %r13,%rsi
mov    $0x80,%edx
mov    %rbx,%rcx
mov    $0x80,%r8d
lea    0x100(%rsp),%r9
call   1060 <bcd_div@plt>
test   %r14d,%r14d
je     14a0 <main+0x2f0>
test   %eax,%eax
jne    11e0 <main+0x30>
mov    %ebp,%eax
cltd
idiv   %r14d
mov    %rbx,%rdi
mov    %edx,%ebx
mov    %eax,%ebp
call   1030 <bcd_decode@plt>
cmp    %eax,%ebp
jne    11e0 <main+0x30>
lea    0x100(%rsp),%rdi
call   1030 <bcd_decode@plt>
cmp    %eax,%ebx
jmp    14a3 <main+0x2f3>
nopw   0x0(%rax,%rax,1)
cmp    $0xffffffff,%eax
sete   %al
jmp    11e2 <main+0x32>
mov    %r15,%r13
mov    %rsp,%r15
mov    %r15,%rdi
call   1030 <bcd_decode@plt>
cmp    %eax,%ebx
mov    %r15,%rbx
mov    %r13,%r15
lea    0x80(%rsp),%r13
sete   %al
jmp    13ed <main+0x23d>
lea    0x180(%rsp),%rbx
mov    $0x569edd,%edi
mov    $0x80,%esi
mov    %rbx,%rdx
call   10b0 <bcd_encode@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1090 <assert@plt>
lea    0x80(%rsp),%rbp
xor    %edi,%edi
mov    $0x80,%esi
mov    %rbp,%rdx
call   10b0 <bcd_encode@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1090 <assert@plt>
mov    %rsp,%rcx
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x80,%edx
call   1040 <bcd_mul@plt>
test   %rax,%rax
sete   %al
cmpb   $0x1,(%rsp)
sete   %cl
and    %al,%cl
cmpb   $0x0,0x1(%rsp)
sete   %al
and    %cl,%al
movzbl %al,%edi
call   1090 <assert@plt>
xor    %eax,%eax
add    $0x208,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c">>>>>>>>>>>> %d\0A\00"
@.str.1 = [7 x i8] c"%d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [128 x i8]
%8 = alloca [128 x i8]
%9 = alloca [128 x i8]
%10 = alloca [128 x i8]
store i32 0, i32* %1
store i32 0, i32* %2
br label %11
11: ; preds = %177, %0
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 1000
br i1 %13, label %14, label %180
14: ; preds = %11
%15 = call i32 (...) @rand()
%16 = srem i32 %15, 10
store i32 %16, i32* %3
%17 = call i32 (...) @rand()
%18 = srem i32 %17, 100000000
%19 = load i32, i32* %3
%20 = ashr i32 %18, %19
store i32 %20, i32* %5
%21 = call i32 (...) @rand()
%22 = srem i32 %21, 25
store i32 %22, i32* %3
%23 = call i32 (...) @rand()
%24 = srem i32 %23, 10000000
%25 = load i32, i32* %3
%26 = ashr i32 %24, %25
store i32 %26, i32* %6
%27 = call i32 (...) @rand()
%28 = srem i32 %27, 20
%29 = icmp eq i32 %28, 11
br i1 %29, label %30, label %34
30: ; preds = %14
%31 = load i32, i32* %6
store i32 %31, i32* %5
%32 = load i32, i32* %5
%33 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %32)
br label %38
34: ; preds = %14
%35 = load i32, i32* %5
%36 = load i32, i32* %6
%37 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %35, i32 %36)
br label %38
38: ; preds = %34, %30
%39 = load i32, i32* %5
%40 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%41 = call i64 @bcd_encode(i32 %39, i32 128, i8* %40)
%42 = icmp eq i64 %41, 0
%43 = zext i1 %42 to i32
%44 = call i32 @assert(i32 %43)
%45 = load i32, i32* %6
%46 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%47 = call i64 @bcd_encode(i32 %45, i32 128, i8* %46)
%48 = icmp eq i64 %47, 0
%49 = zext i1 %48 to i32
%50 = call i32 @assert(i32 %49)
%51 = load i32, i32* %5
%52 = load i32, i32* %6
%53 = icmp sgt i32 %51, %52
br i1 %53, label %54, label %69
54: ; preds = %38
%55 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%56 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%57 = call i64 @bcd_gt(i8* %55, i8* %56)
%58 = icmp ne i64 %57, 0
br i1 %58, label %59, label %65
59: ; preds = %54
%60 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%61 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%62 = call i32 @bcd_eq(i8* %60, i8* %61)
%63 = icmp ne i32 %62, 0
%64 = xor i1 %63, true
br label %65
65: ; preds = %59, %54
%66 = phi i1 [ false, %54 ], [ %64, %59 ]
%67 = zext i1 %66 to i32
%68 = call i32 @assert(i32 %67)
br label %69
69: ; preds = %65, %38
%70 = load i32, i32* %5
%71 = load i32, i32* %6
%72 = icmp eq i32 %70, %71
br i1 %72, label %73, label %78
73: ; preds = %69
%74 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%75 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%76 = call i32 @bcd_eq(i8* %74, i8* %75)
%77 = call i32 @assert(i32 %76)
br label %78
78: ; preds = %73, %69
%79 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%80 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%81 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%82 = call i64 @bcd_add(i8* %79, i8* %80, i32 128, i8* %81)
%83 = icmp eq i64 %82, 0
br i1 %83, label %84, label %91
84: ; preds = %78
%85 = load i32, i32* %5
%86 = load i32, i32* %6
%87 = add nsw i32 %85, %86
%88 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%89 = call i32 @bcd_decode(i8* %88)
%90 = icmp eq i32 %87, %89
br label %91
91: ; preds = %84, %78
%92 = phi i1 [ false, %78 ], [ %90, %84 ]
%93 = zext i1 %92 to i32
%94 = call i32 @assert(i32 %93)
%95 = load i32, i32* %5
%96 = load i32, i32* %6
%97 = icmp sge i32 %95, %96
br i1 %97, label %98, label %115
98: ; preds = %91
%99 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%100 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%101 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%102 = call i32 @bcd_sub(i8* %99, i8* %100, i32 128, i8* %101)
%103 = icmp eq i32 %102, 0
br i1 %103, label %104, label %111
104: ; preds = %98
%105 = load i32, i32* %5
%106 = load i32, i32* %6
%107 = sub nsw i32 %105, %106
%108 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%109 = call i32 @bcd_decode(i8* %108)
%110 = icmp eq i32 %107, %109
br label %111
111: ; preds = %104, %98
%112 = phi i1 [ false, %98 ], [ %110, %104 ]
%113 = zext i1 %112 to i32
%114 = call i32 @assert(i32 %113)
br label %123
115: ; preds = %91
%116 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%117 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%118 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%119 = call i32 @bcd_sub(i8* %116, i8* %117, i32 128, i8* %118)
%120 = icmp eq i32 %119, -1
%121 = zext i1 %120 to i32
%122 = call i32 @assert(i32 %121)
br label %123
123: ; preds = %115, %111
%124 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%125 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%126 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%127 = call i64 @bcd_mul(i8* %124, i8* %125, i32 128, i8* %126)
%128 = icmp eq i64 %127, 0
br i1 %128, label %129, label %136
129: ; preds = %123
%130 = load i32, i32* %5
%131 = load i32, i32* %6
%132 = mul nsw i32 %130, %131
%133 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%134 = call i32 @bcd_decode(i8* %133)
%135 = icmp eq i32 %132, %134
br label %136
136: ; preds = %129, %123
%137 = phi i1 [ false, %123 ], [ %135, %129 ]
%138 = zext i1 %137 to i32
%139 = call i32 @assert(i32 %138)
%140 = load i32, i32* %6
%141 = icmp eq i32 %140, 0
br i1 %141, label %142, label %151
142: ; preds = %136
%143 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%144 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%145 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%146 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%147 = call i32 @bcd_div(i8* %143, i8* %144, i32 128, i8* %145, i32 128, i8* %146)
%148 = icmp eq i32 %147, -1
%149 = zext i1 %148 to i32
%150 = call i32 @assert(i32 %149)
br label %176
151: ; preds = %136
%152 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%153 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%154 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%155 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%156 = call i32 @bcd_div(i8* %152, i8* %153, i32 128, i8* %154, i32 128, i8* %155)
%157 = icmp eq i32 %156, 0
br i1 %157, label %158, label %172
158: ; preds = %151
%159 = load i32, i32* %5
%160 = load i32, i32* %6
%161 = sdiv i32 %159, %160
%162 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%163 = call i32 @bcd_decode(i8* %162)
%164 = icmp eq i32 %161, %163
br i1 %164, label %165, label %172
165: ; preds = %158
%166 = load i32, i32* %5
%167 = load i32, i32* %6
%168 = srem i32 %166, %167
%169 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%170 = call i32 @bcd_decode(i8* %169)
%171 = icmp eq i32 %168, %170
br label %172
172: ; preds = %165, %158, %151
%173 = phi i1 [ false, %158 ], [ false, %151 ], [ %171, %165 ]
%174 = zext i1 %173 to i32
%175 = call i32 @assert(i32 %174)
br label %176
176: ; preds = %172, %142
br label %177
177: ; preds = %176
%178 = load i32, i32* %2
%179 = add nsw i32 %178, 1
store i32 %179, i32* %2
br label %11
180: ; preds = %11
%181 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%182 = call i64 @bcd_encode(i32 5676765, i32 128, i8* %181)
%183 = icmp eq i64 %182, 0
%184 = zext i1 %183 to i32
%185 = call i32 @assert(i32 %184)
%186 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%187 = call i64 @bcd_encode(i32 0, i32 128, i8* %186)
%188 = icmp eq i64 %187, 0
%189 = zext i1 %188 to i32
%190 = call i32 @assert(i32 %189)
%191 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%192 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%193 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%194 = call i64 @bcd_mul(i8* %191, i8* %192, i32 128, i8* %193)
%195 = icmp eq i64 %194, 0
br i1 %195, label %196, label %206
196: ; preds = %180
%197 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%198 = load i8, i8* %197
%199 = sext i8 %198 to i32
%200 = icmp eq i32 %199, 1
br i1 %200, label %201, label %206
201: ; preds = %196
%202 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 1
%203 = load i8, i8* %202
%204 = sext i8 %203 to i32
%205 = icmp eq i32 %204, 0
br label %206
206: ; preds = %201, %196, %180
%207 = phi i1 [ false, %196 ], [ false, %180 ], [ %205, %201 ]
%208 = zext i1 %207 to i32
%209 = call i32 @assert(i32 %208)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c">>>>>>>>>>>> %d\0A\00"
@.str.1 = [7 x i8] c"%d %d\0A\00"
define i32 @main() {
%1 = alloca [128 x i8]
%2 = alloca [128 x i8]
%3 = alloca [128 x i8]
%4 = alloca [128 x i8]
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
br label %9
9: ; preds = %0, %103
%10 = phi i32 [ 0, %0 ], [ %107, %103 ]
%11 = call i32 (...) @rand()
%12 = srem i32 %11, 10
%13 = call i32 (...) @rand()
%14 = srem i32 %13, 100000000
%15 = ashr i32 %14, %12
%16 = call i32 (...) @rand()
%17 = srem i32 %16, 25
%18 = call i32 (...) @rand()
%19 = srem i32 %18, 10000000
%20 = ashr i32 %19, %17
%21 = call i32 (...) @rand()
%22 = srem i32 %21, 20
%23 = icmp eq i32 %22, 11
br i1 %23, label %24, label %26
24: ; preds = %9
%25 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %20)
br label %28
26: ; preds = %9
%27 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %15, i32 %20)
br label %28
28: ; preds = %26, %24
%29 = phi i32 [ %20, %24 ], [ %15, %26 ]
%30 = call i64 @bcd_encode(i32 %29, i32 128, i8* %5)
%31 = icmp eq i64 %30, 0
%32 = zext i1 %31 to i32
%33 = call i32 @assert(i32 %32)
%34 = call i64 @bcd_encode(i32 %20, i32 128, i8* %6)
%35 = icmp eq i64 %34, 0
%36 = zext i1 %35 to i32
%37 = call i32 @assert(i32 %36)
%38 = icmp sgt i32 %29, %20
br i1 %38, label %39, label %49
39: ; preds = %28
%40 = call i64 @bcd_gt(i8* %5, i8* %6)
%41 = icmp eq i64 %40, 0
br i1 %41, label %45, label %42
42: ; preds = %39
%43 = call i32 @bcd_eq(i8* %5, i8* %6)
%44 = icmp eq i32 %43, 0
br label %45
45: ; preds = %42, %39
%46 = phi i1 [ false, %39 ], [ %44, %42 ]
%47 = zext i1 %46 to i32
%48 = call i32 @assert(i32 %47)
br label %49
49: ; preds = %45, %28
%50 = icmp eq i32 %29, %20
br i1 %50, label %51, label %54
51: ; preds = %49
%52 = call i32 @bcd_eq(i8* %5, i8* %6)
%53 = call i32 @assert(i32 %52)
br label %54
54: ; preds = %51, %49
%55 = call i64 @bcd_add(i8* %5, i8* %6, i32 128, i8* %7)
%56 = icmp eq i64 %55, 0
br i1 %56, label %57, label %61
57: ; preds = %54
%58 = add nsw i32 %29, %20
%59 = call i32 @bcd_decode(i8* %7)
%60 = icmp eq i32 %58, %59
br label %61
61: ; preds = %57, %54
%62 = phi i1 [ false, %54 ], [ %60, %57 ]
%63 = zext i1 %62 to i32
%64 = call i32 @assert(i32 %63)
%65 = icmp slt i32 %29, %20
%66 = call i32 @bcd_sub(i8* %5, i8* %6, i32 128, i8* %7)
br i1 %65, label %73, label %67
67: ; preds = %61
%68 = icmp eq i32 %66, 0
br i1 %68, label %69, label %75
69: ; preds = %67
%70 = sub nsw i32 %29, %20
%71 = call i32 @bcd_decode(i8* %7)
%72 = icmp eq i32 %70, %71
br label %75
73: ; preds = %61
%74 = icmp eq i32 %66, -1
br label %75
75: ; preds = %67, %69, %73
%76 = phi i1 [ %74, %73 ], [ false, %67 ], [ %72, %69 ]
%77 = zext i1 %76 to i32
%78 = call i32 @assert(i32 %77)
%79 = call i64 @bcd_mul(i8* %5, i8* %6, i32 128, i8* %7)
%80 = icmp eq i64 %79, 0
br i1 %80, label %81, label %85
81: ; preds = %75
%82 = mul nsw i32 %29, %20
%83 = call i32 @bcd_decode(i8* %7)
%84 = icmp eq i32 %82, %83
br label %85
85: ; preds = %81, %75
%86 = phi i1 [ false, %75 ], [ %84, %81 ]
%87 = zext i1 %86 to i32
%88 = call i32 @assert(i32 %87)
%89 = icmp eq i32 %20, 0
%90 = call i32 @bcd_div(i8* %5, i8* %6, i32 128, i8* %7, i32 128, i8* %8)
br i1 %89, label %91, label %93
91: ; preds = %85
%92 = icmp eq i32 %90, -1
br label %103
93: ; preds = %85
%94 = icmp eq i32 %90, 0
br i1 %94, label %95, label %103
95: ; preds = %93
%96 = sdiv i32 %29, %20
%97 = srem i32 %29, %20
%98 = call i32 @bcd_decode(i8* %7)
%99 = icmp eq i32 %96, %98
br i1 %99, label %100, label %103
100: ; preds = %95
%101 = call i32 @bcd_decode(i8* %8)
%102 = icmp eq i32 %97, %101
br label %103
103: ; preds = %93, %95, %100, %91
%104 = phi i1 [ %92, %91 ], [ false, %95 ], [ false, %93 ], [ %102, %100 ]
%105 = zext i1 %104 to i32
%106 = call i32 @assert(i32 %105)
%107 = add nuw nsw i32 %10, 1
%108 = icmp eq i32 %107, 1000
br i1 %108, label %109, label %9
109: ; preds = %103
%110 = call i64 @bcd_encode(i32 5676765, i32 128, i8* %5)
%111 = icmp eq i64 %110, 0
%112 = zext i1 %111 to i32
%113 = call i32 @assert(i32 %112)
%114 = call i64 @bcd_encode(i32 0, i32 128, i8* %6)
%115 = icmp eq i64 %114, 0
%116 = zext i1 %115 to i32
%117 = call i32 @assert(i32 %116)
%118 = call i64 @bcd_mul(i8* %5, i8* %6, i32 128, i8* %7)
%119 = icmp eq i64 %118, 0
%120 = load i8, i8* %7
%121 = icmp eq i8 %120, 1
%122 = select i1 %119, i1 %121, i1 false
%123 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 1
%124 = load i8, i8* %123
%125 = icmp eq i8 %124, 0
%126 = select i1 %122, i1 %125, i1 false
%127 = zext i1 %126 to i32
%128 = call i32 @assert(i32 %127)
ret i32 0
}