#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 myRandom(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  int i, Array[12];
  srand(time(NULL));
  i = myRandom(80);
  int count;
  count = 0;
  while (i >= 0) {
    count = count + 1;
    printf("Number = %3d\n", i);
    Array[count - 1] = i;
    i = myRandom(-1);
    if (count == 12) {
      break;
    }
  }
  printf("Final  = %3d\n", i);
  for (i = 0; i < 12; i = i + 1) {
    printf("Array! %3d\n", Array[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x50,%edi
call   1060 <myRandom@plt>
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     11c5 <main+0x85>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%ecx
mov    -0x44(%rbp),%eax
sub    $0x1,%eax
cltq
mov    %ecx,-0x40(%rbp,%rax,4)
mov    $0xffffffff,%edi
call   1060 <myRandom@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xc,-0x44(%rbp)
jne    11c0 <main+0x80>
jmp    11c5 <main+0x85>
jmp    1173 <main+0x33>
mov    -0x8(%rbp),%esi
lea    0xe3f(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xc,-0x8(%rbp)
jge    1207 <main+0xc7>
movslq -0x8(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
lea    0xe28(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11db <main+0x9b>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x50,%edi
call   1060 <myRandom@plt>
mov    %eax,%ebx
test   %eax,%eax
js     11fa <main+0xba>
xor    %ebp,%ebp
lea    0xe87(%rip),%r14
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %ebx,0x20(%rsp,%rbp,4)
mov    $0xffffffff,%edi
call   1060 <myRandom@plt>
mov    %eax,%ebx
cmp    $0xb,%rbp
je     11a8 <main+0x68>
add    $0x1,%rbp
test   %ebx,%ebx
jns    1180 <main+0x40>
mov    0x20(%rsp),%r15d
mov    0x24(%rsp),%r14d
mov    0x28(%rsp),%ebp
mov    0x2c(%rsp),%r13d
mov    0x30(%rsp),%r12d
mov    0x34(%rsp),%eax
mov    %eax,0x4(%rsp)
mov    0x38(%rsp),%eax
mov    %eax,0x8(%rsp)
mov    0x3c(%rsp),%eax
mov    %eax,0xc(%rsp)
mov    0x40(%rsp),%eax
mov    %eax,0x10(%rsp)
mov    0x44(%rsp),%eax
mov    %eax,0x14(%rsp)
mov    0x48(%rsp),%eax
mov    %eax,0x18(%rsp)
mov    0x4c(%rsp),%eax
mov    %eax,0x1c(%rsp)
jmp    11fa <main+0xba>
lea    0xe0d(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
lea    0xe0d(%rip),%rbx
mov    %rbx,%rdi
mov    %r15d,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r13d,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r12d,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    0x4(%rsp),%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    0x8(%rsp),%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    0xc(%rsp),%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    0x10(%rsp),%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    0x14(%rsp),%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    0x18(%rsp),%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    0x1c(%rsp),%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Number = %3d\0A\00"
@.str.1 = [14 x i8] c"Final = %3d\0A\00"
@.str.2 = [12 x i8] c"Array! %3d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [12 x i32]
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @time(i32* null)
%6 = call i32 @srand(i32 %5)
%7 = call i32 @myRandom(i32 80)
store i32 %7, i32* %2
store i32 0, i32* %4
br label %8
8: ; preds = %25, %0
%9 = load i32, i32* %2
%10 = icmp sge i32 %9, 0
br i1 %10, label %11, label %26
11: ; preds = %8
%12 = load i32, i32* %4
%13 = add nsw i32 %12, 1
store i32 %13, i32* %4
%14 = load i32, i32* %2
%15 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = load i32, i32* %2
%17 = load i32, i32* %4
%18 = sub nsw i32 %17, 1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 %19
store i32 %16, i32* %20
%21 = call i32 @myRandom(i32 -1)
store i32 %21, i32* %2
%22 = load i32, i32* %4
%23 = icmp eq i32 %22, 12
br i1 %23, label %24, label %25
24: ; preds = %11
br label %26
25: ; preds = %11
br label %8
26: ; preds = %24, %8
%27 = load i32, i32* %2
%28 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %27)
store i32 0, i32* %2
br label %29
29: ; preds = %38, %26
%30 = load i32, i32* %2
%31 = icmp slt i32 %30, 12
br i1 %31, label %32, label %41
32: ; preds = %29
%33 = load i32, i32* %2
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %36)
br label %38
38: ; preds = %32
%39 = load i32, i32* %2
%40 = add nsw i32 %39, 1
store i32 %40, i32* %2
br label %29
41: ; preds = %29
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"Number = %3d\0A\00"
@.str.1 = [14 x i8] c"Final = %3d\0A\00"
@.str.2 = [12 x i8] c"Array! %3d\0A\00"
define i32 @main() {
%1 = alloca [12 x i32]
%2 = bitcast [12 x i32]* %1 to i8*
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = tail call i32 @myRandom(i32 80)
%6 = icmp sgt i32 %5, -1
br i1 %6, label %7, label %42
7: ; preds = %0, %7
%8 = phi i64 [ %10, %7 ], [ 0, %0 ]
%9 = phi i32 [ %13, %7 ], [ %5, %0 ]
%10 = add nuw nsw i64 %8, 1
%11 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %9)
%12 = getelementptr inbounds [12 x i32], [12 x i32]* %1, i64 0, i64 %8
store i32 %9, i32* %12
%13 = tail call i32 @myRandom(i32 -1)
%14 = icmp ne i64 %10, 12
%15 = icmp sgt i32 %13, -1
%16 = select i1 %14, i1 %15, i1 false
br i1 %16, label %7, label %17
17: ; preds = %7
%18 = getelementptr inbounds [12 x i32], [12 x i32]* %1, i64 0, i64 0
%19 = load i32, i32* %18
%20 = getelementptr inbounds [12 x i32], [12 x i32]* %1, i64 0, i64 1
%21 = load i32, i32* %20
%22 = getelementptr inbounds [12 x i32], [12 x i32]* %1, i64 0, i64 2
%23 = load i32, i32* %22
%24 = getelementptr inbounds [12 x i32], [12 x i32]* %1, i64 0, i64 3
%25 = load i32, i32* %24
%26 = getelementptr inbounds [12 x i32], [12 x i32]* %1, i64 0, i64 4
%27 = load i32, i32* %26
%28 = getelementptr inbounds [12 x i32], [12 x i32]* %1, i64 0, i64 5
%29 = load i32, i32* %28
%30 = getelementptr inbounds [12 x i32], [12 x i32]* %1, i64 0, i64 6
%31 = load i32, i32* %30
%32 = getelementptr inbounds [12 x i32], [12 x i32]* %1, i64 0, i64 7
%33 = load i32, i32* %32
%34 = getelementptr inbounds [12 x i32], [12 x i32]* %1, i64 0, i64 8
%35 = load i32, i32* %34
%36 = getelementptr inbounds [12 x i32], [12 x i32]* %1, i64 0, i64 9
%37 = load i32, i32* %36
%38 = getelementptr inbounds [12 x i32], [12 x i32]* %1, i64 0, i64 10
%39 = load i32, i32* %38
%40 = getelementptr inbounds [12 x i32], [12 x i32]* %1, i64 0, i64 11
%41 = load i32, i32* %40
br label %42
42: ; preds = %17, %0
%43 = phi i32 [ undef, %0 ], [ %41, %17 ]
%44 = phi i32 [ undef, %0 ], [ %39, %17 ]
%45 = phi i32 [ undef, %0 ], [ %37, %17 ]
%46 = phi i32 [ undef, %0 ], [ %35, %17 ]
%47 = phi i32 [ undef, %0 ], [ %33, %17 ]
%48 = phi i32 [ undef, %0 ], [ %31, %17 ]
%49 = phi i32 [ undef, %0 ], [ %29, %17 ]
%50 = phi i32 [ undef, %0 ], [ %27, %17 ]
%51 = phi i32 [ undef, %0 ], [ %25, %17 ]
%52 = phi i32 [ undef, %0 ], [ %23, %17 ]
%53 = phi i32 [ undef, %0 ], [ %21, %17 ]
%54 = phi i32 [ undef, %0 ], [ %19, %17 ]
%55 = phi i32 [ %5, %0 ], [ %13, %17 ]
%56 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %55)
%57 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %54)
%58 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %53)
%59 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %52)
%60 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %51)
%61 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %50)
%62 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %49)
%63 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %48)
%64 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %47)
%65 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %46)
%66 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %45)
%67 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %44)
%68 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %43)
ret i32 0
}