#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*/ divider();
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void main() {
  int num1, num2;
  int guess;
  int i, i2, i3;
  int cont;
  srand(time(NULL));
  divider();
  i = 1;
  while (i == 1) {
    i2 = 1;
    while (i2 == 1) {
      num1 = rand() % 9 + 1;
      num2 = rand() % 9 + 1;
      printf("How much is %d times %d? ", num1, num2);
      i3 = 1;
      while (i3 == 1) {
        scanf("%d", &guess);
        if (guess == (num1 * num2)) {
          printf("That is correct!\n");
          divider();
          i3 = 0;
          i2 = 0;
        } else {
          printf("Please try again.\n\n");
          printf("How much is %d times %d? ", num1, num2);
        }
      }
    }
    for (cont = -1; (cont < 0) || cont > 1;) {
      printf("Would you like to answer another question? (0 = No, 1 = Yes) ");
      scanf("%d", &cont);
    }
    if (cont == 0)
      i = 0;
    else
      divider();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    $0x0,%al
call   1030 <divider@plt>
movl   $0x1,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    12db <main+0x17b>
movl   $0x1,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    1266 <main+0x106>
mov    $0x0,%al
call   1080 <rand@plt>
mov    $0x9,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x4(%rbp)
mov    $0x0,%al
call   1080 <rand@plt>
mov    $0x9,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x18(%rbp)
cmpl   $0x1,-0x18(%rbp)
jne    1261 <main+0x101>
lea    0xe23(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
imul   -0x8(%rbp),%ecx
cmp    %ecx,%eax
jne    123a <main+0xda>
lea    0xe04(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <divider@plt>
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
jmp    125c <main+0xfc>
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xdab(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11e6 <main+0x86>
jmp    1197 <main+0x37>
movl   $0xffffffff,-0x1c(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x1c(%rbp)
mov    %al,-0x1d(%rbp)
jl     1286 <main+0x126>
cmpl   $0x1,-0x1c(%rbp)
setg   %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    1296 <main+0x136>
jmp    12b9 <main+0x159>
lea    0xda6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd6f(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1070 <scanf@plt>
jmp    126d <main+0x10d>
cmpl   $0x0,-0x1c(%rbp)
jne    12cf <main+0x16f>
movl   $0x0,-0x10(%rbp)
jmp    12d6 <main+0x176>
mov    $0x0,%al
call   1030 <divider@plt>
jmp    1186 <main+0x26>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
xor    %eax,%eax
call   1040 <divider@plt>
lea    0xe69(%rip),%r13
lea    0xebd(%rip),%rbx
xchg   %ax,%ax
xor    %eax,%eax
call   1090 <rand@plt>
cltq
imul   $0x38e38e39,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,8),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%r12d
add    $0x1,%r12d
xor    %eax,%eax
call   1090 <rand@plt>
cltq
imul   $0x38e38e39,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,8),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%r15d
add    $0x1,%r15d
mov    %r13,%rdi
mov    %r12d,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15d,%r14d
imul   %r12d,%r14d
lea    0xe08(%rip),%rdi
lea    0x4(%rsp),%rbp
nopw   0x0(%rax,%rax,1)
mov    %rbp,%rsi
call   1080 <scanf@plt>
cmp    %r14d,0x4(%rsp)
je     1250 <main+0xe0>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
mov    %r12d,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdcc(%rip),%rdi
jmp    1220 <main+0xb0>
mov    %rbx,%r12
lea    0xe14(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <divider@plt>
movl   $0xffffffff,(%rsp)
lea    0xda9(%rip),%r15
mov    %rsp,%rbx
lea    0xd9c(%rip),%rbp
xchg   %ax,%ax
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1080 <scanf@plt>
mov    (%rsp),%eax
cmp    $0x1,%eax
ja     1280 <main+0x110>
test   %eax,%eax
je     12b0 <main+0x140>
xor    %eax,%eax
call   1040 <divider@plt>
mov    %r12,%rbx
jmp    11a0 <main+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"How much is %d times %d? \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [18 x i8] c"That is correct!\0A\00"
@.str.3 = [20 x i8] c"Please try again.\0A\0A\00"
@.str.4 = [62 x i8] c"Would you like to answer another question? (0 = No, 1 = Yes) \00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = call i32 @time(i32* null)
%9 = call i32 @srand(i32 %8)
%10 = call i32 (...) @divider()
store i32 1, i32* %4
br label %11
11: ; preds = %66, %0
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %67
14: ; preds = %11
store i32 1, i32* %5
br label %15
15: ; preds = %47, %14
%16 = load i32, i32* %5
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %48
18: ; preds = %15
%19 = call i32 (...) @rand()
%20 = srem i32 %19, 9
%21 = add nsw i32 %20, 1
store i32 %21, i32* %1
%22 = call i32 (...) @rand()
%23 = srem i32 %22, 9
%24 = add nsw i32 %23, 1
store i32 %24, i32* %2
%25 = load i32, i32* %1
%26 = load i32, i32* %2
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %25, i32 %26)
store i32 1, i32* %6
br label %28
28: ; preds = %46, %18
%29 = load i32, i32* %6
%30 = icmp eq i32 %29, 1
br i1 %30, label %31, label %47
31: ; preds = %28
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%33 = load i32, i32* %3
%34 = load i32, i32* %1
%35 = load i32, i32* %2
%36 = mul nsw i32 %34, %35
%37 = icmp eq i32 %33, %36
br i1 %37, label %38, label %41
38: ; preds = %31
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%40 = call i32 (...) @divider()
store i32 0, i32* %6
store i32 0, i32* %5
br label %46
41: ; preds = %31
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%43 = load i32, i32* %1
%44 = load i32, i32* %2
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %43, i32 %44)
br label %46
46: ; preds = %41, %38
br label %28
47: ; preds = %28
br label %15
48: ; preds = %15
store i32 -1, i32* %7
br label %49
49: ; preds = %57, %48
%50 = load i32, i32* %7
%51 = icmp slt i32 %50, 0
br i1 %51, label %55, label %52
52: ; preds = %49
%53 = load i32, i32* %7
%54 = icmp sgt i32 %53, 1
br label %55
55: ; preds = %52, %49
%56 = phi i1 [ true, %49 ], [ %54, %52 ]
br i1 %56, label %57, label %60
57: ; preds = %55
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.4, i64 0, i64 0))
%59 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
br label %49
60: ; preds = %55
%61 = load i32, i32* %7
%62 = icmp eq i32 %61, 0
br i1 %62, label %63, label %64
63: ; preds = %60
store i32 0, i32* %4
br label %66
64: ; preds = %60
%65 = call i32 (...) @divider()
br label %66
66: ; preds = %64, %63
br label %11
67: ; preds = %11
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"How much is %d times %d? \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.4 = [62 x i8] c"Would you like to answer another question? (0 = No, 1 = Yes) \00"
@str = [19 x i8] c"Please try again.\0A\00"
@str.5 = [17 x i8] c"That is correct!\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @time(i32* null)
%6 = tail call i32 @srand(i32 %5)
%7 = tail call i32 (...) @divider()
br label %8
8: ; preds = %0, %36
%9 = call i32 (...) @rand()
%10 = srem i32 %9, 9
%11 = add nsw i32 %10, 1
%12 = call i32 (...) @rand()
%13 = srem i32 %12, 9
%14 = add nsw i32 %13, 1
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %14)
%16 = mul nsw i32 %14, %11
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%18 = load i32, i32* %1
%19 = icmp eq i32 %18, %16
br i1 %19, label %26, label %20
20: ; preds = %8, %20
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %14)
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%24 = load i32, i32* %1
%25 = icmp eq i32 %24, %16
br i1 %25, label %26, label %20
26: ; preds = %20, %8
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.5, i64 0, i64 0))
%28 = call i32 (...) @divider()
store i32 -1, i32* %2
br label %29
29: ; preds = %26, %29
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str.4, i64 0, i64 0))
%31 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%32 = load i32, i32* %2
%33 = icmp ugt i32 %32, 1
br i1 %33, label %29, label %34
34: ; preds = %29
%35 = icmp eq i32 %32, 0
br i1 %35, label %38, label %36
36: ; preds = %34
%37 = call i32 (...) @divider()
br label %8
38: ; preds = %34
ret void
}