#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*/ correctAnswer();
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ wrongAnswer();
int answerTheQuestion(int a, int b) {
  int guess;
  int wrongGuesses = 0;
  int correct = 0;
  int result = a * b;
  do {
    printf("What is %d x %d? ", a, b);
    scanf("%d", &guess);
    if (guess == result) {
      correct = 1;
      correctAnswer();
    } else {
      wrongAnswer();
      wrongGuesses++;
    }
  } while (!correct);
  return wrongGuesses;
}


x86 assembly (clang, -O0):
<answerTheQuestion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe8d(%rip),%rdi
call   1040 <printf@plt>
lea    0xe93(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    11a7 <answerTheQuestion+0x67>
movl   $0x1,-0x14(%rbp)
mov    $0x0,%al
call   1060 <correctAnswer@plt>
jmp    11b7 <answerTheQuestion+0x77>
mov    $0x0,%al
call   1030 <wrongAnswer@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11bc <answerTheQuestion+0x7c>
cmpl   $0x0,-0x14(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1166 <answerTheQuestion+0x26>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<answerTheQuestion>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %edi,%ebp
mov    %esi,%r14d
imul   %edi,%r14d
lea    0xea2(%rip),%rdi
mov    %ebp,%esi
mov    %r15d,%edx
call   1040 <printf@plt>
lea    0xea3(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
xor    %ebx,%ebx
cmp    %r14d,0x4(%rsp)
je     11bd <answerTheQuestion+0x7d>
lea    0xe89(%rip),%r12
lea    0x4(%rsp),%r13
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <wrongAnswer@plt>
add    $0x1,%ebx
lea    0xe5f(%rip),%rdi
mov    %ebp,%esi
mov    %r15d,%edx
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
cmp    %r14d,0x4(%rsp)
jne    1190 <answerTheQuestion+0x50>
xor    %eax,%eax
call   1060 <correctAnswer@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"What is %d x %d? \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @answerTheQuestion(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %6
store i32 0, i32* %7
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = mul nsw i32 %9, %10
store i32 %11, i32* %8
br label %12
12: ; preds = %27, %2
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %14)
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%17 = load i32, i32* %5
%18 = load i32, i32* %8
%19 = icmp eq i32 %17, %18
br i1 %19, label %20, label %22
20: ; preds = %12
store i32 1, i32* %7
%21 = call i32 (...) @correctAnswer()
br label %26
22: ; preds = %12
%23 = call i32 (...) @wrongAnswer()
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 1
store i32 %25, i32* %6
br label %26
26: ; preds = %22, %20
br label %27
27: ; preds = %26
%28 = load i32, i32* %7
%29 = icmp ne i32 %28, 0
%30 = xor i1 %29, true
br i1 %30, label %12, label %31
31: ; preds = %27
%32 = load i32, i32* %6
ret i32 %32
}

LLVM IR (-O2):
@.str = [18 x i8] c"What is %d x %d? \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @answerTheQuestion(i32 %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = mul nsw i32 %1, %0
%6 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, %5
br i1 %9, label %18, label %10
10: ; preds = %2, %10
%11 = phi i32 [ %13, %10 ], [ 0, %2 ]
%12 = call i32 (...) @wrongAnswer()
%13 = add nuw nsw i32 %11, 1
%14 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%16 = load i32, i32* %3
%17 = icmp eq i32 %16, %5
br i1 %17, label %18, label %10
18: ; preds = %10, %2
%19 = phi i32 [ 0, %2 ], [ %13, %10 ]
%20 = call i32 (...) @correctAnswer()
ret i32 %19
}