#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 randomInteger(int, int);
void sayCorrect(int sum) {
  int i;
  i = randomInteger(1, 4);
  switch (i) {
  case 1:
    printf("Correct!\n");
    break;
  case 2:
    printf("You got it. The answer is %d.\n", sum);
    break;
  case 3:
    printf("That's answer.\n");
    break;
  case 4:
    printf("That's right.\n");
  default:
    break;
  }
}


x86 assembly (clang, -O0):
<sayCorrect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x1,%edi
mov    $0x4,%esi
call   1040 <randomInteger@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     11b0 <sayCorrect+0x90>
mov    -0x10(%rbp),%rax
lea    0xea3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b5 <sayCorrect+0x95>
mov    -0x4(%rbp),%esi
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b5 <sayCorrect+0x95>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b5 <sayCorrect+0x95>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b5 <sayCorrect+0x95>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sayCorrect>:
push   %rbx
mov    %edi,%ebx
mov    $0x1,%edi
mov    $0x4,%esi
call   1050 <randomInteger@plt>
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     1167 <sayCorrect+0x37>
lea    0xeaf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeeb(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>
pop    %rbx
ret
lea    0xea0(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>
lea    0xebc(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>
lea    0xea1(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"Correct!\0A\00"
@.str.1 = [31 x i8] c"You got it. The answer is %d.\0A\00"
@.str.2 = [16 x i8] c"That's answer.\0A\00"
@.str.3 = [15 x i8] c"That's right.\0A\00"
define void @sayCorrect(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 @randomInteger(i32 1, i32 4)
store i32 %4, i32* %3
%5 = load i32, i32* %3
switch i32 %5, label %15 [
i32 1, label %6
i32 2, label %8
i32 3, label %11
i32 4, label %13
]
6: ; preds = %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %16
8: ; preds = %1
%9 = load i32, i32* %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %9)
br label %16
11: ; preds = %1
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %16
13: ; preds = %1
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %15
15: ; preds = %1, %13
br label %16
16: ; preds = %15, %11, %8, %6
ret void
}

LLVM IR (-O2):
@.str.1 = [31 x i8] c"You got it. The answer is %d.\0A\00"
@str = [14 x i8] c"That's right.\00"
@str.4 = [15 x i8] c"That's answer.\00"
@str.5 = [9 x i8] c"Correct!\00"
define void @sayCorrect(i32 %0) {
%2 = tail call i32 @randomInteger(i32 1, i32 4)
switch i32 %2, label %11 [
i32 1, label %3
i32 2, label %5
i32 3, label %7
i32 4, label %9
]
3: ; preds = %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.5, i64 0, i64 0))
br label %11
5: ; preds = %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %0)
br label %11
7: ; preds = %1
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.4, i64 0, i64 0))
br label %11
9: ; preds = %1
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
br label %11
11: ; preds = %9, %1, %7, %5, %3
ret void
}