#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);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  int i = 12, random = 0;
  srand(time(NULL));
  while (random != 12) {
    random = (rand() % (i)) + 1;
    printf("\e[0;32mrandom= %d\n", random);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xc,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
cmpl   $0xc,-0x18(%rbp)
je     11a3 <main+0x63>
mov    $0x0,%al
call   1060 <rand@plt>
cltd
idivl  -0x14(%rbp)
add    $0x1,%edx
mov    %edx,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe67(%rip),%rdi
call   1030 <printf@plt>
jmp    1174 <main+0x34>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
lea    0xea8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x2aaaaaab,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x21,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,2),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebp
add    $0x1,%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
cmp    $0xc,%ebp
jne    1160 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [19 x i8] c"\1B[0;32mrandom= %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
br label %5
5: ; preds = %2, %5
%6 = tail call i32 (...) @rand()
%7 = srem i32 %6, 12
%8 = add nsw i32 %7, 1
%9 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = icmp eq i32 %8, 12
br i1 %10, label %11, label %5
11: ; preds = %5
ret i32 0
}