#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 */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  int i = 0;
  char *bonds[] = {"Climax!",
                   "Dr. No",
                   "From Russia with Love",
                   "Goldfinger",
                   "Thunderball",
                   "You Only Live Twice",
                   "Casino Royale",
                   "On Her Majesty\'s Secret Service",
                   "Diamonds Are Forever",
                   "Live & Let Die",
                   "The Man with the Golden Gun",
                   "The Spy Who Loved Me",
                   "Moonraker",
                   "For Your Eyes Only",
                   "Octopussy",
                   "Never Say Never Again",
                   "A View To Kill",
                   "The Living Daylights",
                   "Licence to Kill",
                   "Goldeneye",
                   "Tomorrow Never Dies",
                   "This World Is Not Enough",
                   "Die Another Day",
                   "Casino Royale(DCraig)",
                   "Quantum Sol",
                   "Skyfall",
                   "Spectre"};
  printf("\n\n\n");
  int j, n;
  time_t t;
  srand((unsigned)time(&t));
  n = rand() % 27;
  printf("Congratulations you have rolled #%d, %s\n\n\n", n, bonds[n]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    -0xf0(%rbp),%rdi
lea    0x2bc2(%rip),%rsi
mov    $0xd8,%edx
call   1050 <memcpy@plt>
lea    0x1055(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xfc(%rbp),%rdi
call   1060 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x1b,%ecx
cltd
idiv   %ecx
mov    %edx,-0xf8(%rbp)
mov    -0xf8(%rbp),%esi
movslq -0xf8(%rbp),%rax
mov    -0xf0(%rbp,%rax,8),%rdx
ff
lea    0xfe3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x108d(%rip),%rdi
call   1030 <puts@plt>
lea    0x4(%rsp),%rdi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x4bda12f7,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,8),%ecx
lea    (%rcx,%rcx,2),%ecx
sub    %ecx,%eax
movslq %eax,%rsi
lea    0x104b(%rip),%rax
movslq (%rax,%rsi,4),%rdx
add    %rax,%rdx
lea    0x1012(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"Climax!\00"
@.str.1 = [7 x i8] c"Dr. No\00"
@.str.2 = [22 x i8] c"From Russia with Love\00"
@.str.3 = [11 x i8] c"Goldfinger\00"
@.str.4 = [12 x i8] c"Thunderball\00"
@.str.5 = [20 x i8] c"You Only Live Twice\00"
@.str.6 = [14 x i8] c"Casino Royale\00"
@.str.7 = [32 x i8] c"On Her Majesty's Secret Service\00"
@.str.8 = [21 x i8] c"Diamonds Are Forever\00"
@.str.9 = [15 x i8] c"Live & Let Die\00"
@.str.10 = [28 x i8] c"The Man with the Golden Gun\00"
@.str.11 = [21 x i8] c"The Spy Who Loved Me\00"
@.str.12 = [10 x i8] c"Moonraker\00"
@.str.13 = [19 x i8] c"For Your Eyes Only\00"
@.str.14 = [10 x i8] c"Octopussy\00"
@.str.15 = [22 x i8] c"Never Say Never Again\00"
@.str.16 = [15 x i8] c"A View To Kill\00"
@.str.17 = [21 x i8] c"The Living Daylights\00"
@.str.18 = [16 x i8] c"Licence to Kill\00"
@.str.19 = [10 x i8] c"Goldeneye\00"
@.str.20 = [20 x i8] c"Tomorrow Never Dies\00"
@.str.21 = [25 x i8] c"This World Is Not Enough\00"
@.str.22 = [16 x i8] c"Die Another Day\00"
@.str.23 = [22 x i8] c"Casino Royale(DCraig)\00"
@.str.24 = [12 x i8] c"Quantum Sol\00"
@.str.25 = [8 x i8] c"Skyfall\00"
@.str.26 = [8 x i8] c"Spectre\00"
@__const.main.bonds = [27 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.23, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.24, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.25, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.26, i32 0, i32 0)]
@.str.27 = [4 x i8] c"\0A\0A\0A\00"
@.str.28 = [43 x i8] c"Congratulations you have rolled #%d, %s\0A\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [27 x i8*]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%11 = bitcast [27 x i8*]* %7 to i8*
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.27, i64 0, i64 0))
%13 = call i64 @time(i32* %10)
%14 = trunc i64 %13 to i32
%15 = call i32 @srand(i32 %14)
%16 = call i32 (...) @rand()
%17 = srem i32 %16, 27
store i32 %17, i32* %9
%18 = load i32, i32* %9
%19 = load i32, i32* %9
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [27 x i8*], [27 x i8*]* %7, i64 0, i64 %20
%22 = load i8*, i8** %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.28, i64 0, i64 0), i32 %18, i8* %22)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"Climax!\00"
@.str.1 = [7 x i8] c"Dr. No\00"
@.str.2 = [22 x i8] c"From Russia with Love\00"
@.str.3 = [11 x i8] c"Goldfinger\00"
@.str.4 = [12 x i8] c"Thunderball\00"
@.str.5 = [20 x i8] c"You Only Live Twice\00"
@.str.6 = [14 x i8] c"Casino Royale\00"
@.str.7 = [32 x i8] c"On Her Majesty's Secret Service\00"
@.str.8 = [21 x i8] c"Diamonds Are Forever\00"
@.str.9 = [15 x i8] c"Live & Let Die\00"
@.str.10 = [28 x i8] c"The Man with the Golden Gun\00"
@.str.11 = [21 x i8] c"The Spy Who Loved Me\00"
@.str.12 = [10 x i8] c"Moonraker\00"
@.str.13 = [19 x i8] c"For Your Eyes Only\00"
@.str.14 = [10 x i8] c"Octopussy\00"
@.str.15 = [22 x i8] c"Never Say Never Again\00"
@.str.16 = [15 x i8] c"A View To Kill\00"
@.str.17 = [21 x i8] c"The Living Daylights\00"
@.str.18 = [16 x i8] c"Licence to Kill\00"
@.str.19 = [10 x i8] c"Goldeneye\00"
@.str.20 = [20 x i8] c"Tomorrow Never Dies\00"
@.str.21 = [25 x i8] c"This World Is Not Enough\00"
@.str.22 = [16 x i8] c"Die Another Day\00"
@.str.23 = [22 x i8] c"Casino Royale(DCraig)\00"
@.str.24 = [12 x i8] c"Quantum Sol\00"
@.str.25 = [8 x i8] c"Skyfall\00"
@.str.26 = [8 x i8] c"Spectre\00"
@reltable.main = [27 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.1 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @.str.2 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.3 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.4 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([20 x i8]* @.str.5 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.6 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([32 x i8]* @.str.7 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([21 x i8]* @.str.8 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.9 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([28 x i8]* @.str.10 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([21 x i8]* @.str.11 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.12 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @.str.13 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.14 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @.str.15 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.16 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([21 x i8]* @.str.17 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([16 x i8]* @.str.18 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.19 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([20 x i8]* @.str.20 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([25 x i8]* @.str.21 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([16 x i8]* @.str.22 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @.str.23 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.24 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.25 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.26 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32)]
@.str.28 = [43 x i8] c"Congratulations you have rolled #%d, %s\0A\0A\0A\00"
@str = [3 x i8] c"\0A\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
%5 = bitcast i32* %3 to i8*
%6 = call i64 @time(i32* %3)
%7 = trunc i64 %6 to i32
%8 = call i32 @srand(i32 %7)
%9 = call i32 (...) @rand()
%10 = srem i32 %9, 27
%11 = sext i32 %10 to i64
%12 = shl i64 %11, 2
%13 = call i8* @llvm.load.relative.i64(i8* bitcast ([27 x i32]* @reltable.main to i8*), i64 %12)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.28, i64 0, i64 0), i32 %10, i8* %13)
ret i32 0
}