#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 rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int iRandomNum = 0;
  srand(time(NULL));
  iRandomNum = (rand() % 4) + 1;
  system("clear");
  printf("\n(Mis)Fortune Cookie\n");
  switch (iRandomNum) {
  case 1:
    printf("\nYou will be shot to death today.\n");
    break;
  case 2:
    printf("\nYou will drown in a nearby lake.\n");
    break;
  case 3:
    printf("\nYou will lose all of your money.\n");
    break;
  case 4:
    printf("\nYou have AIDS.\n");
    break;
  }
  printf("\nYour Unlucky Lotto Numbers: ");
  printf("%d ", (rand() % 49) + 1);
  printf("%d ", (rand() % 49) + 1);
  printf("%d ", (rand() % 49) + 1);
  printf("%d ", (rand() % 49) + 1);
  printf("%d ", (rand() % 49) + 1);
  printf("%d\n", (rand() % 49) + 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,-0x18(%rbp)
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    -0x18(%rbp),%eax
mov    %al,-0x11(%rbp)
call   1070 <rand@plt>
mov    %eax,%edx
mov    %edx,%ecx
add    $0x3,%ecx
test   %edx,%edx
mov    %edx,%eax
cmovs  %ecx,%eax
and    $0xfffffffc,%eax
neg    %eax
mov    %eax,%ecx
mov    %edx,%eax
lea    0x1(%rax,%rcx,1),%eax
mov    %eax,-0x8(%rbp)
lea    0xe67(%rip),%rdi
call   1030 <system@plt>
mov    -0x11(%rbp),%al
lea    0xe5e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     122d <main+0xdd>
mov    -0x10(%rbp),%rax
lea    0xe23(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    122d <main+0xdd>
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    122d <main+0xdd>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    122d <main+0xdd>
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x31,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    $0x1,%esi
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x31,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    $0x1,%esi
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x31,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    $0x1,%esi
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x31,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    $0x1,%esi
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x31,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    $0x1,%esi
lea    0xde6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x31,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    $0x1,%esi
lea    0xdc8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
xor    %eax,%eax
call   1080 <rand@plt>
mov    %eax,%ebx
lea    0x3(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xfffffffc,%eax
sub    %eax,%ebx
lea    0xe74(%rip),%rdi
call   1040 <system@plt>
lea    0xe94(%rip),%rdi
call   1030 <puts@plt>
cmp    $0x3,%ebx
ja     11b8 <main+0x58>
movslq %ebx,%rax
lea    0xf0c(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
call   1030 <puts@plt>
lea    0xe47(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x5397829d,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
imul   $0x31,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1,%esi
lea    0xe2f(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x5397829d,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
imul   $0x31,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x5397829d,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
imul   $0x31,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x5397829d,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
imul   $0x31,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x5397829d,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
imul   $0x31,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x5397829d,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
imul   $0x31,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1,%esi
lea    0xd32(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [22 x i8] c"\0A(Mis)Fortune Cookie\0A\00"
@.str.2 = [35 x i8] c"\0AYou will be shot to death today.\0A\00"
@.str.3 = [35 x i8] c"\0AYou will drown in a nearby lake.\0A\00"
@.str.4 = [35 x i8] c"\0AYou will lose all of your money.\0A\00"
@.str.5 = [17 x i8] c"\0AYou have AIDS.\0A\00"
@.str.6 = [30 x i8] c"\0AYour Unlucky Lotto Numbers: \00"
@.str.7 = [4 x i8] c"%d \00"
@.str.8 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 @time(i32* null)
%4 = call i32 @srand(i32 %3)
%5 = call i32 (...) @rand()
%6 = srem i32 %5, 4
%7 = add nsw i32 %6, 1
store i32 %7, i32* %2
%8 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32, i32* %2
switch i32 %10, label %19 [
i32 1, label %11
i32 2, label %13
i32 3, label %15
i32 4, label %17
]
11: ; preds = %0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
br label %19
13: ; preds = %0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
br label %19
15: ; preds = %0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0))
br label %19
17: ; preds = %0
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
br label %19
19: ; preds = %0, %17, %15, %13, %11
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
%21 = call i32 (...) @rand()
%22 = srem i32 %21, 49
%23 = add nsw i32 %22, 1
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %23)
%25 = call i32 (...) @rand()
%26 = srem i32 %25, 49
%27 = add nsw i32 %26, 1
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %27)
%29 = call i32 (...) @rand()
%30 = srem i32 %29, 49
%31 = add nsw i32 %30, 1
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %31)
%33 = call i32 (...) @rand()
%34 = srem i32 %33, 49
%35 = add nsw i32 %34, 1
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %35)
%37 = call i32 (...) @rand()
%38 = srem i32 %37, 49
%39 = add nsw i32 %38, 1
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %39)
%41 = call i32 (...) @rand()
%42 = srem i32 %41, 49
%43 = add nsw i32 %42, 1
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %43)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.6 = [30 x i8] c"\0AYour Unlucky Lotto Numbers: \00"
@.str.7 = [4 x i8] c"%d \00"
@.str.8 = [4 x i8] c"%d\0A\00"
@str = [21 x i8] c"\0A(Mis)Fortune Cookie\00"
@str.9 = [16 x i8] c"\0AYou have AIDS.\00"
@str.10 = [34 x i8] c"\0AYou will lose all of your money.\00"
@str.11 = [34 x i8] c"\0AYou will drown in a nearby lake.\00"
@str.12 = [34 x i8] c"\0AYou will be shot to death today.\00"
@reltable.main = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([34 x i8]* @str.12 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([34 x i8]* @str.11 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([34 x i8]* @str.10 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([16 x i8]* @str.9 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32)]
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32 (...) @rand()
%4 = srem i32 %3, 4
%5 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%7 = icmp ult i32 %4, 4
br i1 %7, label %8, label %13
8: ; preds = %0
%9 = sext i32 %4 to i64
%10 = shl i64 %9, 2
%11 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.main to i8*), i64 %10)
%12 = tail call i32 @puts(i8* dereferenceable(1) %11)
br label %13
13: ; preds = %0, %8
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
%15 = tail call i32 (...) @rand()
%16 = srem i32 %15, 49
%17 = add nsw i32 %16, 1
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %17)
%19 = tail call i32 (...) @rand()
%20 = srem i32 %19, 49
%21 = add nsw i32 %20, 1
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %21)
%23 = tail call i32 (...) @rand()
%24 = srem i32 %23, 49
%25 = add nsw i32 %24, 1
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %25)
%27 = tail call i32 (...) @rand()
%28 = srem i32 %27, 49
%29 = add nsw i32 %28, 1
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %29)
%31 = tail call i32 (...) @rand()
%32 = srem i32 %31, 49
%33 = add nsw i32 %32, 1
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %33)
%35 = tail call i32 (...) @rand()
%36 = srem i32 %35, 49
%37 = add nsw i32 %36, 1
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %37)
ret i32 0
}