#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 getRandomNum();
int /*<<< orphan*/ printf(char *);
void wrongAnswer() {
  int response = getRandomNum();
  switch (response) {
  case 1:
  case 2:
  case 3:
    printf("No. Please try again!\n");
    break;
  case 4:
  case 5:
  case 6:
    printf("Wrong. Try once more!\n");
    break;
  case 7:
  case 8:
  case 9:
    printf("Don't give up!\n");
    break;
  case 10:
  case 11:
  case 12:
    printf("No. Keep trying!\n");
    break;
  default:
    printf("So wrong, dude!\n");
  }
}


x86 assembly (clang, -O0):
<wrongAnswer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
call   1030 <getRandomNum@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0xb,%eax
ja     119f <wrongAnswer+0x7f>
mov    -0x10(%rbp),%rax
lea    0xeae(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xece(%rip),%rdi
call   1040 <printf@plt>
jmp    11ab <wrongAnswer+0x8b>
lea    0xed4(%rip),%rdi
call   1040 <printf@plt>
jmp    11ab <wrongAnswer+0x8b>
lea    0xeda(%rip),%rdi
call   1040 <printf@plt>
jmp    11ab <wrongAnswer+0x8b>
lea    0xed9(%rip),%rdi
call   1040 <printf@plt>
jmp    11ab <wrongAnswer+0x8b>
lea    0xeda(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wrongAnswer>:
push   %rax
xor    %eax,%eax
call   1040 <getRandomNum@plt>
add    $0xffffffff,%eax
cmp    $0xb,%eax
ja     1146 <wrongAnswer+0x26>
cltq
lea    0xf23(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0xeff(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"No. Please try again!\0A\00"
@.str.1 = [23 x i8] c"Wrong. Try once more!\0A\00"
@.str.2 = [16 x i8] c"Don't give up!\0A\00"
@.str.3 = [18 x i8] c"No. Keep trying!\0A\00"
@.str.4 = [17 x i8] c"So wrong, dude!\0A\00"
define void @wrongAnswer() {
%1 = alloca i32
%2 = call i32 (...) @getRandomNum()
store i32 %2, i32* %1
%3 = load i32, i32* %1
switch i32 %3, label %12 [
i32 1, label %4
i32 2, label %4
i32 3, label %4
i32 4, label %6
i32 5, label %6
i32 6, label %6
i32 7, label %8
i32 8, label %8
i32 9, label %8
i32 10, label %10
i32 11, label %10
i32 12, label %10
]
4: ; preds = %0, %0, %0
%5 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %14
6: ; preds = %0, %0, %0
%7 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %14
8: ; preds = %0, %0, %0
%9 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %14
10: ; preds = %0, %0, %0
%11 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
br label %14
12: ; preds = %0
%13 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
br label %14
14: ; preds = %12, %10, %8, %6, %4
ret void
}

LLVM IR (-O2):
@str = [17 x i8] c"No. Keep trying!\00"
@str.5 = [15 x i8] c"Don't give up!\00"
@str.6 = [22 x i8] c"Wrong. Try once more!\00"
@str.7 = [22 x i8] c"No. Please try again!\00"
@str.8 = [16 x i8] c"So wrong, dude!\00"
@reltable.wrongAnswer = [12 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @str.7 to i64), i64 ptrtoint ([12 x i32]* @reltable.wrongAnswer to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @str.7 to i64), i64 ptrtoint ([12 x i32]* @reltable.wrongAnswer to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @str.7 to i64), i64 ptrtoint ([12 x i32]* @reltable.wrongAnswer to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @str.6 to i64), i64 ptrtoint ([12 x i32]* @reltable.wrongAnswer to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @str.6 to i64), i64 ptrtoint ([12 x i32]* @reltable.wrongAnswer to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @str.6 to i64), i64 ptrtoint ([12 x i32]* @reltable.wrongAnswer to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @str.5 to i64), i64 ptrtoint ([12 x i32]* @reltable.wrongAnswer to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @str.5 to i64), i64 ptrtoint ([12 x i32]* @reltable.wrongAnswer to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @str.5 to i64), i64 ptrtoint ([12 x i32]* @reltable.wrongAnswer to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([17 x i8]* @str to i64), i64 ptrtoint ([12 x i32]* @reltable.wrongAnswer to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([17 x i8]* @str to i64), i64 ptrtoint ([12 x i32]* @reltable.wrongAnswer to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([17 x i8]* @str to i64), i64 ptrtoint ([12 x i32]* @reltable.wrongAnswer to i64)) to i32)]
define void @wrongAnswer() {
%1 = tail call i32 (...) @getRandomNum()
%2 = add i32 %1, -1
%3 = icmp ult i32 %2, 12
br i1 %3, label %4, label %8
4: ; preds = %0
%5 = sext i32 %2 to i64
%6 = shl i64 %5, 2
%7 = call i8* @llvm.load.relative.i64(i8* bitcast ([12 x i32]* @reltable.wrongAnswer to i8*), i64 %6)
br label %8
8: ; preds = %0, %4
%9 = phi i8* [ %7, %4 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @str.8, i64 0, i64 0), %0 ]
%10 = tail call i32 @puts(i8* dereferenceable(1) %9)
ret void
}