#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
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;
      printf("Well done!\n");
    } else {
      printf("No. Please try again.\n");
    }
  } 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    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    1189 <answerTheQuestion+0x69>
movl   $0x1,-0x10(%rbp)
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1197 <answerTheQuestion+0x77>
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    119c <answerTheQuestion+0x7c>
cmpl   $0x0,-0x10(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    113f <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,%r14d
mov    %edi,%ebp
mov    %esi,%ebx
imul   %edi,%ebx
lea    0xeb4(%rip),%rdi
mov    %ebp,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb3(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
cmp    %ebx,0x4(%rsp)
je     11bc <answerTheQuestion+0x8c>
lea    0xe8a(%rip),%r15
lea    0xe95(%rip),%r12
lea    0x4(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0xe7e(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
cmp    %ebx,0x4(%rsp)
jne    1190 <answerTheQuestion+0x60>
lea    0xe68(%rip),%rdi
call   1030 <puts@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"
@.str.2 = [12 x i8] c"Well done!\0A\00"
@.str.3 = [23 x i8] c"No. Please try again.\0A\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 (i8*, ...) @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 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %23
21: ; preds = %11
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
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"
@str = [22 x i8] c"No. Please try again.\00"
@str.4 = [11 x i8] c"Well done!\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 (i8*, ...) @printf(i8* dereferenceable(1) 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 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) 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 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.4, i64 0, i64 0))
ret void
}