#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 convertToInt(char);
int /*<<< orphan*/ printf(char *, int, ...);
int calcScoreHelper(int currtotal, char *scoresheet, int frame,
                    int allpinsflag) {
  int first, second, third;
  char thirdchar;
  char firstchar = *scoresheet;
  *scoresheet++;
  char secondchar = *scoresheet;
  printf("FRAME %d\n", frame);
  printf("1st char - %c\n", firstchar);
  printf("2nd char - %c\n", secondchar);
  if ((firstchar == 0) || (frame > 10)) {
    return currtotal;
  } else {
    first = convertToInt(firstchar);
    second = convertToInt(secondchar);
    if ((first < 10) && (second == 10)) {
      second = 10 - first;
      allpinsflag = 1;
    } else if (first == 10) {
      *scoresheet++;
      thirdchar = *scoresheet;
      third = convertToInt(thirdchar);
      *scoresheet--;
      *scoresheet--;
      allpinsflag = 2;
    } else if (second != 10 && allpinsflag > 0) {
      allpinsflag = 0;
    }
    switch (allpinsflag) {
    case 1:
      currtotal += (first * 2) + second;
      printf("%d: SPARE 1st char - %d\n", 86, first);
      printf("%d: SPARE 2nd char - %d\n", 87, second);
      printf("%d: SPARE currtotal = %d\n", 88, currtotal);
      break;
    case 2:
      currtotal += first + second + third;
      printf("%d: STRIKE 1st char - %d\n", 92, first);
      printf("%d: STRIKE 2nd char - %d\n", 93, second);
      printf("%d: STRIKE 3rd char - %d\n", 94, third);
      printf("%d: STRIKE currtotal = %d\n", 95, currtotal);
      break;
    default:
      currtotal += first + second;
      printf("%d: DEFAULT currtotal = %d\n", 99, currtotal);
      break;
    }
    frame++;
    *scoresheet++;
    return calcScoreHelper(currtotal, scoresheet, frame, allpinsflag);
  }
  return -1;
}


x86 assembly (clang, -O0):
<calcScoreHelper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x26(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x27(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x26(%rbp),%esi
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x27(%rbp),%esi
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x26(%rbp),%eax
cmp    $0x0,%eax
je     11af <calcScoreHelper+0x7f>
cmpl   $0xa,-0x14(%rbp)
jle    11ba <calcScoreHelper+0x8a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13a4 <calcScoreHelper+0x274>
movsbl -0x26(%rbp),%edi
call   1040 <convertToInt@plt>
mov    %eax,-0x1c(%rbp)
movsbl -0x27(%rbp),%edi
call   1040 <convertToInt@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0xa,-0x1c(%rbp)
jge    11fd <calcScoreHelper+0xcd>
cmpl   $0xa,-0x20(%rbp)
jne    11fd <calcScoreHelper+0xcd>
mov    $0xa,%eax
sub    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
movl   $0x1,-0x18(%rbp)
jmp    1271 <calcScoreHelper+0x141>
cmpl   $0xa,-0x1c(%rbp)
jne    124c <calcScoreHelper+0x11c>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x25(%rbp)
movsbl -0x25(%rbp),%edi
call   1040 <convertToInt@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
movl   $0x2,-0x18(%rbp)
jmp    126c <calcScoreHelper+0x13c>
cmpl   $0xa,-0x20(%rbp)
je     1267 <calcScoreHelper+0x137>
cmpl   $0x0,-0x18(%rbp)
jle    1267 <calcScoreHelper+0x137>
movl   $0x0,-0x18(%rbp)
jmp    126c <calcScoreHelper+0x13c>
jmp    1271 <calcScoreHelper+0x141>
mov    -0x18(%rbp),%eax
mov    %eax,-0x2c(%rbp)
sub    $0x1,%eax
je     1296 <calcScoreHelper+0x166>
jmp    1285 <calcScoreHelper+0x155>
mov    -0x2c(%rbp),%eax
sub    $0x2,%eax
je     12ec <calcScoreHelper+0x1bc>
jmp    1358 <calcScoreHelper+0x228>
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
add    -0x20(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x1c(%rbp),%edx
lea    0xd79(%rip),%rdi
mov    $0x56,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%edx
lea    0xd7c(%rip),%rdi
mov    $0x57,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edx
lea    0xd7f(%rip),%rdi
mov    $0x58,%esi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    137a <calcScoreHelper+0x24a>
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
add    -0x24(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x1c(%rbp),%edx
lea    0xd6f(%rip),%rdi
mov    $0x5c,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%edx
lea    0xd73(%rip),%rdi
mov    $0x5d,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%edx
lea    0xd77(%rip),%rdi
mov    $0x5e,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edx
lea    0xd7b(%rip),%rdi
mov    $0x5f,%esi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    137a <calcScoreHelper+0x24a>
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
lea    0xd6f(%rip),%rdi
mov    $0x63,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   1050 <calcScoreHelper@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calcScoreHelper>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,0xc(%rsp)
mov    %edx,%r13d
mov    %rsi,%rbp
mov    %rdi,0x10(%rsp)
mov    (%rsi),%r15b
mov    0x1(%rsi),%r12b
lea    0xeb5(%rip),%rdi
mov    %edx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movsbl %r15b,%esi
lea    0xeab(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movsbl %r12b,%esi
lea    0xea8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0xa,%r13d
jg     1363 <calcScoreHelper+0x243>
test   %r15b,%r15b
je     1363 <calcScoreHelper+0x243>
lea    0x1(%rbp),%r14
nop
movsbl %r15b,%edi
call   1040 <convertToInt@plt>
mov    %eax,%r15d
movsbl %r12b,%edi
call   1040 <convertToInt@plt>
mov    %eax,%r12d
cmp    $0x9,%r15d
jg     1220 <calcScoreHelper+0x100>
cmp    $0xa,%r12d
jne    1220 <calcScoreHelper+0x100>
mov    $0xa,%r12d
sub    %r15d,%r12d
mov    0x10(%rsp),%rbx
lea    (%rbx,%r15,2),%ebx
add    %r12d,%ebx
lea    0xe58(%rip),%rdi
mov    $0x56,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe5b(%rip),%rdi
mov    $0x57,%esi
mov    %r12d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe5e(%rip),%rdi
mov    $0x58,%esi
mov    %rbx,0x10(%rsp)
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
movl   $0x1,0xc(%rsp)
jmp    1300 <calcScoreHelper+0x1e0>
nopl   0x0(%rax)
cmp    $0xa,%r15d
jne    12b0 <calcScoreHelper+0x190>
movsbl 0x2(%rbp),%edi
call   1040 <convertToInt@plt>
mov    %eax,%ebx
mov    %rbp,%r14
mov    %r15d,%ebp
add    0x10(%rsp),%ebp
add    %r12d,%ebp
add    %ebx,%ebp
lea    0xe29(%rip),%rdi
mov    $0x5c,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe2d(%rip),%rdi
mov    $0x5d,%esi
mov    %r12d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe31(%rip),%rdi
mov    $0x5e,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe36(%rip),%rdi
mov    $0x5f,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <printf@plt>
movl   $0x2,0xc(%rsp)
mov    %ebp,%eax
mov    %rax,0x10(%rsp)
jmp    1300 <calcScoreHelper+0x1e0>
nopl   0x0(%rax,%rax,1)
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    12c0 <calcScoreHelper+0x1a0>
xor    %ebx,%ebx
cmp    $0xa,%r12d
jne    12d4 <calcScoreHelper+0x1b4>
cmp    $0x2,%eax
je     135e <calcScoreHelper+0x23e>
mov    %eax,%ebx
cmp    $0x1,%eax
je     11bd <calcScoreHelper+0x9d>
add    0x10(%rsp),%r15d
add    %r12d,%r15d
lea    0xdfa(%rip),%rdi
mov    $0x63,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebx,0xc(%rsp)
mov    %r15,0x10(%rsp)
nopl   0x0(%rax,%rax,1)
lea    0x1(%r13),%ebx
movzbl 0x1(%r14),%r15d
movzbl 0x2(%r14),%r12d
lea    0xceb(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movsbl %r15b,%esi
lea    0xce1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movsbl %r12b,%esi
lea    0xcde(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0x9,%r13d
jg     1363 <calcScoreHelper+0x243>
lea    0x1(%r14),%rbp
add    $0x2,%r14
mov    %ebx,%r13d
test   %r15b,%r15b
jne    1190 <calcScoreHelper+0x70>
jmp    1363 <calcScoreHelper+0x243>
jmp    1238 <calcScoreHelper+0x118>
mov    0x10(%rsp),%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [10 x i8] c"FRAME %d\0A\00"
@.str.1 = [15 x i8] c"1st char - %c\0A\00"
@.str.2 = [15 x i8] c"2nd char - %c\0A\00"
@.str.3 = [25 x i8] c"%d: SPARE 1st char - %d\0A\00"
@.str.4 = [25 x i8] c"%d: SPARE 2nd char - %d\0A\00"
@.str.5 = [26 x i8] c"%d: SPARE currtotal = %d\0A\00"
@.str.6 = [26 x i8] c"%d: STRIKE 1st char - %d\0A\00"
@.str.7 = [26 x i8] c"%d: STRIKE 2nd char - %d\0A\00"
@.str.8 = [26 x i8] c"%d: STRIKE 3rd char - %d\0A\00"
@.str.9 = [27 x i8] c"%d: STRIKE currtotal = %d\0A\00"
@.str.10 = [28 x i8] c"%d: DEFAULT currtotal = %d\0A\00"
define i32 @calcScoreHelper(i32 %0, i8* nocapture %1, i32 %2, i32 %3) {
%5 = load i8, i8* %1
%6 = getelementptr inbounds i8, i8* %1, i64 1
%7 = load i8, i8* %6
%8 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %2)
%9 = sext i8 %5 to i32
%10 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = sext i8 %7 to i32
%12 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %11)
%13 = icmp eq i8 %5, 0
%14 = icmp sgt i32 %2, 10
%15 = or i1 %14, %13
br i1 %15, label %82, label %16
16: ; preds = %4, %65
%17 = phi i8 [ %73, %65 ], [ %7, %4 ]
%18 = phi i8* [ %72, %65 ], [ %6, %4 ]
%19 = phi i8 [ %71, %65 ], [ %5, %4 ]
%20 = phi i32 [ %67, %65 ], [ %3, %4 ]
%21 = phi i32 [ %69, %65 ], [ %2, %4 ]
%22 = phi i8* [ %70, %65 ], [ %1, %4 ]
%23 = phi i32 [ %68, %65 ], [ %0, %4 ]
%24 = tail call i32 @convertToInt(i8 signext %19)
%25 = tail call i32 @convertToInt(i8 signext %17)
%26 = icmp slt i32 %24, 10
%27 = icmp eq i32 %25, 10
%28 = select i1 %26, i1 %27, i1 false
br i1 %28, label %29, label %31
29: ; preds = %16
%30 = sub nsw i32 10, %24
br label %42
31: ; preds = %16
%32 = icmp eq i32 %24, 10
br i1 %32, label %33, label %37
33: ; preds = %31
%34 = getelementptr inbounds i8, i8* %22, i64 2
%35 = load i8, i8* %34
%36 = tail call i32 @convertToInt(i8 signext %35)
br label %50
37: ; preds = %31
%38 = icmp ne i32 %25, 10
%39 = icmp sgt i32 %20, 0
%40 = and i1 %39, %38
br i1 %40, label %60, label %41
41: ; preds = %37
switch i32 %20, label %60 [
i32 1, label %42
i32 2, label %50
]
42: ; preds = %29, %41
%43 = phi i32 [ %30, %29 ], [ %25, %41 ]
%44 = shl nsw i32 %24, 1
%45 = add i32 %44, %23
%46 = add i32 %45, %43
%47 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 86, i32 %24)
%48 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 87, i32 %43)
%49 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i32 88, i32 %46)
br label %65
50: ; preds = %33, %41
%51 = phi i8* [ %22, %33 ], [ %18, %41 ]
%52 = phi i32 [ %36, %33 ], [ undef, %41 ]
%53 = add i32 %24, %23
%54 = add i32 %53, %25
%55 = add i32 %54, %52
%56 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i32 92, i32 %24)
%57 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i32 93, i32 %25)
%58 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i32 94, i32 %52)
%59 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0), i32 95, i32 %55)
br label %65
60: ; preds = %37, %41
%61 = phi i32 [ %20, %41 ], [ 0, %37 ]
%62 = add i32 %24, %23
%63 = add i32 %62, %25
%64 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i64 0, i64 0), i32 99, i32 %63)
br label %65
65: ; preds = %60, %50, %42
%66 = phi i8* [ %18, %60 ], [ %51, %50 ], [ %18, %42 ]
%67 = phi i32 [ %61, %60 ], [ 2, %50 ], [ 1, %42 ]
%68 = phi i32 [ %63, %60 ], [ %55, %50 ], [ %46, %42 ]
%69 = add nsw i32 %21, 1
%70 = getelementptr inbounds i8, i8* %66, i64 1
%71 = load i8, i8* %70
%72 = getelementptr inbounds i8, i8* %66, i64 2
%73 = load i8, i8* %72
%74 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %69)
%75 = sext i8 %71 to i32
%76 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %75)
%77 = sext i8 %73 to i32
%78 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %77)
%79 = icmp eq i8 %71, 0
%80 = icmp sgt i32 %21, 9
%81 = or i1 %80, %79
br i1 %81, label %82, label %16
82: ; preds = %65, %4
%83 = phi i32 [ %0, %4 ], [ %68, %65 ]
ret i32 %83
}