#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();
void answerTheQuestion(int a, int b) {
  int guess;
  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();
    }
  } while (!correct);
}


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)
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe94(%rip),%rdi
call   1040 <printf@plt>
lea    0xe9a(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    11a0 <answerTheQuestion+0x60>
movl   $0x1,-0x10(%rbp)
mov    $0x0,%al
call   1060 <correctAnswer@plt>
jmp    11a7 <answerTheQuestion+0x67>
mov    $0x0,%al
call   1030 <wrongAnswer@plt>
jmp    11ac <answerTheQuestion+0x6c>
cmpl   $0x0,-0x10(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    115f <answerTheQuestion+0x1f>
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,%r13d
mov    %edi,%ebp
mov    %esi,%ebx
imul   %edi,%ebx
lea    0xea4(%rip),%rdi
mov    %ebp,%esi
mov    %r13d,%edx
call   1040 <printf@plt>
lea    0xea5(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
cmp    %ebx,0x4(%rsp)
je     11b5 <answerTheQuestion+0x75>
lea    0xe7c(%rip),%r14
lea    0xe87(%rip),%r15
lea    0x4(%rsp),%r12
xor    %eax,%eax
call   1030 <wrongAnswer@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %r13d,%edx
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
cmp    %ebx,0x4(%rsp)
jne    1190 <answerTheQuestion+0x50>
xor    %eax,%eax
call   1060 <correctAnswer@plt>
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 void @answerTheQuestion(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %6
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = mul nsw i32 %8, %9
store i32 %10, i32* %7
br label %11
11: ; preds = %24, %2
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %13)
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%16 = load i32, i32* %5
%17 = load i32, i32* %7
%18 = icmp eq i32 %16, %17
br i1 %18, label %19, label %21
19: ; preds = %11
store i32 1, i32* %6
%20 = call i32 (...) @correctAnswer()
br label %23
21: ; preds = %11
%22 = call i32 (...) @wrongAnswer()
br label %23
23: ; preds = %21, %19
br label %24
24: ; preds = %23
%25 = load i32, i32* %6
%26 = icmp ne i32 %25, 0
%27 = xor i1 %26, true
br i1 %27, label %11, label %28
28: ; preds = %24
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"What is %d x %d? \00"
@.str.1 = [3 x i8] c"%d\00"
define void @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 %16, label %10
10: ; preds = %2, %10
%11 = call i32 (...) @wrongAnswer()
%12 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%14 = load i32, i32* %3
%15 = icmp eq i32 %14, %5
br i1 %15, label %16, label %10
16: ; preds = %10, %2
%17 = call i32 (...) @correctAnswer()
ret void
}