#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*/ n;

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ read(int, int *, int);
int main() {
  int fd = open("/dev/urandom", O_RDONLY);
  int i;
  for (i = 0; i < 16;) {
    int n;
    read(fd, &n, sizeof(n));
    printf("0x%08x\n", n);
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%esi
lea    0xeb1(%rip),%rdi
call   1050 <open@plt>
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jge    1196 <main+0x66>
mov    -0x8(%rbp),%edi
lea    -0x10(%rbp),%rsi
mov    $0x4,%edx
call   1040 <read@plt>
mov    -0x10(%rbp),%esi
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115e <main+0x2e>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    0x2ea8(%rip),%rax
mov    (%rax),%esi
lea    0xeb7(%rip),%rdi
call   1050 <open@plt>
mov    %eax,%ebx
lea    0xc(%rsp),%r14
mov    %eax,%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   1040 <read@plt>
mov    0xc(%rsp),%esi
lea    0xe9e(%rip),%r15
mov    %r15,%rdi
call   1030 <printf@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   1040 <read@plt>
mov    0xc(%rsp),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   1040 <read@plt>
mov    0xc(%rsp),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   1040 <read@plt>
mov    0xc(%rsp),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   1040 <read@plt>
mov    0xc(%rsp),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   1040 <read@plt>
mov    0xc(%rsp),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   1040 <read@plt>
mov    0xc(%rsp),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   1040 <read@plt>
mov    0xc(%rsp),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   1040 <read@plt>
mov    0xc(%rsp),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   1040 <read@plt>
mov    0xc(%rsp),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   1040 <read@plt>
mov    0xc(%rsp),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   1040 <read@plt>
mov    0xc(%rsp),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   1040 <read@plt>
mov    0xc(%rsp),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   1040 <read@plt>
mov    0xc(%rsp),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   1040 <read@plt>
mov    0xc(%rsp),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   1040 <read@plt>
mov    0xc(%rsp),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"/dev/urandom\00"
@O_RDONLY = global i32 0
@.str.1 = [8 x i8] c"0x%08x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = load i32, i32* @O_RDONLY
%6 = call i32 @open(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %5)
store i32 %6, i32* %2
store i32 0, i32* %3
br label %7
7: ; preds = %10, %0
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 16
br i1 %9, label %10, label %17
10: ; preds = %7
%11 = load i32, i32* %2
%12 = call i32 @read(i32 %11, i32* %4, i32 4)
%13 = load i32, i32* %4
%14 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %7
17: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"/dev/urandom\00"
@O_RDONLY = global i32 0
@.str.1 = [8 x i8] c"0x%08x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = load i32, i32* @O_RDONLY
%3 = tail call i32 @open(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = bitcast i32* %1 to i8*
%5 = call i32 @read(i32 %3, i32* %1, i32 4)
%6 = load i32, i32* %1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = call i32 @read(i32 %3, i32* %1, i32 4)
%9 = load i32, i32* %1
%10 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = call i32 @read(i32 %3, i32* %1, i32 4)
%12 = load i32, i32* %1
%13 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = call i32 @read(i32 %3, i32* %1, i32 4)
%15 = load i32, i32* %1
%16 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = call i32 @read(i32 %3, i32* %1, i32 4)
%18 = load i32, i32* %1
%19 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = call i32 @read(i32 %3, i32* %1, i32 4)
%21 = load i32, i32* %1
%22 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = call i32 @read(i32 %3, i32* %1, i32 4)
%24 = load i32, i32* %1
%25 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = call i32 @read(i32 %3, i32* %1, i32 4)
%27 = load i32, i32* %1
%28 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %27)
%29 = call i32 @read(i32 %3, i32* %1, i32 4)
%30 = load i32, i32* %1
%31 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = call i32 @read(i32 %3, i32* %1, i32 4)
%33 = load i32, i32* %1
%34 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %33)
%35 = call i32 @read(i32 %3, i32* %1, i32 4)
%36 = load i32, i32* %1
%37 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %36)
%38 = call i32 @read(i32 %3, i32* %1, i32 4)
%39 = load i32, i32* %1
%40 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %39)
%41 = call i32 @read(i32 %3, i32* %1, i32 4)
%42 = load i32, i32* %1
%43 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %42)
%44 = call i32 @read(i32 %3, i32* %1, i32 4)
%45 = load i32, i32* %1
%46 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %45)
%47 = call i32 @read(i32 %3, i32* %1, i32 4)
%48 = load i32, i32* %1
%49 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %48)
%50 = call i32 @read(i32 %3, i32* %1, i32 4)
%51 = load i32, i32* %1
%52 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %51)
ret i32 0
}