#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*/ getchar();
int /*<<< orphan*/ printf(char *);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void main() {
  int computer;
  printf("rock papper scissor ......");
  getchar();
  printf("papper! \n");
  srand(time(NULL));
  computer = rand() % 3;
  if (computer == 0) {
    printf("computer: rock \n");
  } else if (computer == 1) {
    printf("computer: scissor \n");
  } else {
    printf("computer: papper \n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    11b4 <main+0x64>
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
jmp    11e0 <main+0x90>
cmpl   $0x1,-0x4(%rbp)
jne    11cf <main+0x7f>
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
jmp    11db <main+0x8b>
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
jmp    11e0 <main+0x90>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xe98(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
lea    0xea0(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x55555556,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,2),%ecx
mov    %eax,%edx
sub    %ecx,%edx
cmp    $0x1,%edx
lea    0xe7a(%rip),%rdx
lea    0xe61(%rip),%rsi
cmove  %rdx,%rsi
cmp    %ecx,%eax
lea    0xe79(%rip),%rdi
cmovne %rsi,%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"rock papper scissor ......\00"
@.str.1 = [10 x i8] c"papper! \0A\00"
@.str.2 = [17 x i8] c"computer: rock \0A\00"
@.str.3 = [20 x i8] c"computer: scissor \0A\00"
@.str.4 = [19 x i8] c"computer: papper \0A\00"
define void @main() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @getchar()
%4 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @time(i32* null)
%6 = call i32 @srand(i32 %5)
%7 = call i32 (...) @rand()
%8 = srem i32 %7, 3
store i32 %8, i32* %1
%9 = load i32, i32* %1
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %21
13: ; preds = %0
%14 = load i32, i32* %1
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %20
18: ; preds = %13
%19 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
br label %20
20: ; preds = %18, %16
br label %21
21: ; preds = %20, %11
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"rock papper scissor ......\00"
@str = [9 x i8] c"papper! \00"
@str.5 = [18 x i8] c"computer: papper \00"
@str.6 = [19 x i8] c"computer: scissor \00"
@str.7 = [16 x i8] c"computer: rock \00"
define void @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @getchar()
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @time(i32* null)
%5 = tail call i32 @srand(i32 %4)
%6 = tail call i32 (...) @rand()
%7 = srem i32 %6, 3
%8 = icmp eq i32 %7, 1
%9 = select i1 %8, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @str.6, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @str.5, i64 0, i64 0)
%10 = icmp eq i32 %7, 0
%11 = select i1 %10, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @str.7, i64 0, i64 0), i8* %9
%12 = tail call i32 @puts(i8* dereferenceable(1) %11)
ret void
}