#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*/ parseDigits(int *, char *);
int /*<<< orphan*/ printResult(int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
void main() {
  int digits[21];
  int i = 0;
  while (i < 21) {
    digits[i++] = 0;
  }
  char input[20];
  printf("Problem 13: Big ints.\n");
  printf("Enter first digit: ");
  scanf("%s", input);
  parseDigits(digits, input);
  printf("Enter second digit: ");
  scanf("%s", input);
  parseDigits(digits, input);
  printf("Result: ");
  printResult(digits);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x64(%rbp)
cmpl   $0x15,-0x64(%rbp)
jge    1176 <main+0x36>
mov    -0x64(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x64(%rbp)
cltq
movl   $0x0,-0x60(%rbp,%rax,4)
jmp    1152 <main+0x12>
lea    0xe83(%rip),%rdi
call   1040 <printf@plt>
lea    0xe8e(%rip),%rdi
call   1040 <printf@plt>
lea    -0x80(%rbp),%rsi
lea    0xe92(%rip),%rdi
call   1060 <scanf@plt>
lea    -0x60(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1050 <parseDigits@plt>
lea    0xe7c(%rip),%rdi
call   1040 <printf@plt>
lea    -0x80(%rbp),%rsi
lea    0xe69(%rip),%rdi
call   1060 <scanf@plt>
lea    -0x60(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1050 <parseDigits@plt>
lea    0xe68(%rip),%rdi
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
call   1030 <printResult@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movl   $0x0,0x50(%rsp)
lea    0xeaf(%rip),%rdi
call   1040 <puts@plt>
lea    0xe6e(%rip),%rdi
call   1050 <printf@plt>
lea    0xe76(%rip),%r14
lea    0x60(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    %rsp,%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <parseDigits@plt>
lea    0xe54(%rip),%rdi
call   1050 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <parseDigits@plt>
lea    0xe47(%rip),%rdi
call   1050 <printf@plt>
mov    %r15,%rdi
call   1030 <printResult@plt>
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Problem 13: Big ints.\0A\00"
@.str.1 = [20 x i8] c"Enter first digit: \00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [21 x i8] c"Enter second digit: \00"
@.str.4 = [9 x i8] c"Result: \00"
define void @main() {
%1 = alloca [21 x i32]
%2 = alloca i32
%3 = alloca [20 x i8]
store i32 0, i32* %2
br label %4
4: ; preds = %7, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 21
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = load i32, i32* %2
%9 = add nsw i32 %8, 1
store i32 %9, i32* %2
%10 = sext i32 %8 to i64
%11 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 %10
store i32 0, i32* %11
br label %4
12: ; preds = %4
%13 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %15)
%17 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 0
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%19 = call i32 @parseDigits(i32* %17, i8* %18)
%20 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%21 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %21)
%23 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 0
%24 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%25 = call i32 @parseDigits(i32* %23, i8* %24)
%26 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%27 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 0
%28 = call i32 @printResult(i32* %27)
ret void
}

LLVM IR (-O2):
@.str.1 = [20 x i8] c"Enter first digit: \00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [21 x i8] c"Enter second digit: \00"
@.str.4 = [9 x i8] c"Result: \00"
@str = [22 x i8] c"Problem 13: Big ints.\00"
define void @main() {
%1 = alloca [21 x i32]
%2 = bitcast [21 x i32]* %1 to i8*
%3 = alloca [20 x i8]
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%8 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 0
%9 = call i32 @parseDigits(i32* %8, i8* %4)
%10 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%12 = call i32 @parseDigits(i32* %8, i8* %4)
%13 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%14 = call i32 @printResult(i32* %8)
ret void
}