#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*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ memcmp(char *, char *, int);
int open(char *, int /*<<< orphan*/);
int read(int, char *, int);
int main(void) {
  char a[64];
  char b[64];
  int fd;
  fd = open("/dev/urandom", O_RDONLY);
  if ((fd == -1) || (read(fd, a, 64) < 64))
    return 111;
  close(fd);
  fd = open("/dev/urandom", O_RDONLY);
  if ((fd == -1) || (read(fd, b, 64) < 64))
    return 111;
  close(fd);
  return (!memcmp(a, b, 64));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e8f(%rip),%rax
mov    (%rax),%esi
lea    0xe9e(%rip),%rdi
call   1060 <open@plt>
mov    %eax,-0x94(%rbp)
cmpl   $0xffffffff,-0x94(%rbp)
je     1197 <main+0x57>
mov    -0x94(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    $0x40,%edx
call   1040 <read@plt>
cmp    $0x40,%eax
jge    11a3 <main+0x63>
movl   $0x6f,-0x4(%rbp)
jmp    1232 <main+0xf2>
mov    -0x94(%rbp),%edi
call   1030 <close@plt>
mov    0x2e33(%rip),%rax
mov    (%rax),%esi
lea    0xe42(%rip),%rdi
call   1060 <open@plt>
mov    %eax,-0x94(%rbp)
cmpl   $0xffffffff,-0x94(%rbp)
je     11f6 <main+0xb6>
mov    -0x94(%rbp),%edi
lea    -0x90(%rbp),%rsi
mov    $0x40,%edx
call   1040 <read@plt>
cmp    $0x40,%eax
jge    1202 <main+0xc2>
movl   $0x6f,-0x4(%rbp)
jmp    1232 <main+0xf2>
mov    -0x94(%rbp),%edi
call   1030 <close@plt>
lea    -0x50(%rbp),%rdi
lea    -0x90(%rbp),%rsi
mov    $0x40,%edx
call   1050 <memcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x80,%rsp
mov    0x2e96(%rip),%r14
mov    (%r14),%esi
lea    0xea4(%rip),%rdi
call   1060 <open@plt>
mov    $0x6f,%ebx
cmp    $0xffffffff,%eax
je     11d4 <main+0x94>
mov    %eax,%ebp
lea    0x40(%rsp),%rsi
mov    %eax,%edi
mov    $0x40,%edx
call   1040 <read@plt>
cmp    $0x40,%eax
jl     11d4 <main+0x94>
mov    %ebp,%edi
call   1030 <close@plt>
mov    (%r14),%esi
lea    0xe6c(%rip),%rdi
call   1060 <open@plt>
cmp    $0xffffffff,%eax
je     11d4 <main+0x94>
mov    %eax,%ebp
mov    %rsp,%rsi
mov    %eax,%edi
mov    $0x40,%edx
call   1040 <read@plt>
cmp    $0x40,%eax
jl     11d4 <main+0x94>
mov    %ebp,%edi
call   1030 <close@plt>
lea    0x40(%rsp),%rdi
mov    %rsp,%rsi
mov    $0x40,%edx
call   1050 <memcmp@plt>
xor    %ebx,%ebx
test   %eax,%eax
sete   %bl
mov    %ebx,%eax
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"/dev/urandom\00"
@O_RDONLY = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [64 x i8]
%3 = alloca [64 x i8]
%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* %4
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, -1
br i1 %8, label %14, label %9
9: ; preds = %0
%10 = load i32, i32* %4
%11 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%12 = call i32 @read(i32 %10, i8* %11, i32 64)
%13 = icmp slt i32 %12, 64
br i1 %13, label %14, label %15
14: ; preds = %9, %0
store i32 111, i32* %1
br label %37
15: ; preds = %9
%16 = load i32, i32* %4
%17 = call i32 @close(i32 %16)
%18 = load i32, i32* @O_RDONLY
%19 = call i32 @open(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %18)
store i32 %19, i32* %4
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, -1
br i1 %21, label %27, label %22
22: ; preds = %15
%23 = load i32, i32* %4
%24 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%25 = call i32 @read(i32 %23, i8* %24, i32 64)
%26 = icmp slt i32 %25, 64
br i1 %26, label %27, label %28
27: ; preds = %22, %15
store i32 111, i32* %1
br label %37
28: ; preds = %22
%29 = load i32, i32* %4
%30 = call i32 @close(i32 %29)
%31 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%32 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%33 = call i32 @memcmp(i8* %31, i8* %32, i32 64)
%34 = icmp ne i32 %33, 0
%35 = xor i1 %34, true
%36 = zext i1 %35 to i32
store i32 %36, i32* %1
br label %37
37: ; preds = %28, %27, %14
%38 = load i32, i32* %1
ret i32 %38
}

LLVM IR (-O2):
@.str = [13 x i8] c"/dev/urandom\00"
@O_RDONLY = global i32 0
define i32 @main() {
%1 = alloca [64 x i8]
%2 = alloca [64 x i8]
%3 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%5 = load i32, i32* @O_RDONLY
%6 = tail call i32 @open(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = icmp eq i32 %6, -1
br i1 %7, label %24, label %8
8: ; preds = %0
%9 = call i32 @read(i32 %6, i8* %3, i32 64)
%10 = icmp slt i32 %9, 64
br i1 %10, label %24, label %11
11: ; preds = %8
%12 = tail call i32 @close(i32 %6)
%13 = load i32, i32* @O_RDONLY
%14 = tail call i32 @open(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = icmp eq i32 %14, -1
br i1 %15, label %24, label %16
16: ; preds = %11
%17 = call i32 @read(i32 %14, i8* %4, i32 64)
%18 = icmp slt i32 %17, 64
br i1 %18, label %24, label %19
19: ; preds = %16
%20 = tail call i32 @close(i32 %14)
%21 = call i32 @memcmp(i8* %3, i8* %4, i32 64)
%22 = icmp eq i32 %21, 0
%23 = zext i1 %22 to i32
br label %24
24: ; preds = %11, %16, %0, %8, %19
%25 = phi i32 [ %23, %19 ], [ 111, %8 ], [ 111, %0 ], [ 111, %16 ], [ 111, %11 ]
ret i32 %25
}