#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*/ assert(int);
scalar_t__ getentropy(char *, int);
int main() {
  char buf[256] = {0};
  assert(getentropy(buf, 256) == 0);
  for (int i = 0; i < 256; i++) {
    if (buf[i] != 0) {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x110(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1040 <memset@plt>
lea    -0x110(%rbp),%rdi
mov    $0x100,%esi
call   1030 <getentropy@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
movl   $0x0,-0x114(%rbp)
cmpl   $0x100,-0x114(%rbp)
jge    11ce <main+0x9e>
movslq -0x114(%rbp),%rax
movsbl -0x110(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     11b5 <main+0x85>
movl   $0x0,-0x4(%rbp)
jmp    11d5 <main+0xa5>
jmp    11ba <main+0x8a>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    1181 <main+0x51>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x108,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x100,%esi
call   1030 <getentropy@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
mov    $0x1,%al
cmpb   $0x0,(%rsp)
je     11c1 <main+0xa1>
xor    $0x1,%al
movzbl %al,%eax
add    $0x108,%rsp
ret
mov    $0xffffffffffffffff,%rcx
nopl   0x0(%rax,%rax,1)
cmpb   $0x0,0x2(%rsp,%rcx,1)
jne    11b4 <main+0x94>
cmpb   $0x0,0x3(%rsp,%rcx,1)
jne    11b4 <main+0x94>
cmpb   $0x0,0x4(%rsp,%rcx,1)
jne    11b4 <main+0x94>
cmp    $0xfb,%rcx
je     1205 <main+0xe5>
lea    0x4(%rcx),%rdx
cmpb   $0x0,0x5(%rsp,%rcx,1)
mov    %rdx,%rcx
je     11d0 <main+0xb0>
cmp    $0xff,%rdx
jmp    1210 <main+0xf0>
add    $0x4,%rcx
cmp    $0xff,%rcx
setb   %al
jmp    11b4 <main+0x94>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [256 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [256 x i8]* %2 to i8*
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%6 = call i64 @getentropy(i8* %5, i32 256)
%7 = icmp eq i64 %6, 0
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
store i32 0, i32* %3
br label %10
10: ; preds = %22, %0
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 256
br i1 %12, label %13, label %25
13: ; preds = %10
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %13
store i32 0, i32* %1
br label %26
21: ; preds = %13
br label %22
22: ; preds = %21
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %10
25: ; preds = %10
store i32 1, i32* %1
br label %26
26: ; preds = %25, %20
%27 = load i32, i32* %1
ret i32 %27
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = call i64 @getentropy(i8* %2, i32 256)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
br i1 %9, label %10, label %37
10: ; preds = %0, %29
%11 = phi i64 [ %27, %29 ], [ 0, %0 ]
%12 = or i64 %11, 1
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %37
16: ; preds = %10
%17 = or i64 %11, 2
%18 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 0
br i1 %20, label %21, label %37
21: ; preds = %16
%22 = or i64 %11, 3
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 0
br i1 %25, label %26, label %37
26: ; preds = %21
%27 = add nuw nsw i64 %11, 4
%28 = icmp eq i64 %27, 256
br i1 %28, label %35, label %29
29: ; preds = %26
%30 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 %27
%31 = load i8, i8* %30
%32 = icmp eq i8 %31, 0
br i1 %32, label %10, label %33
33: ; preds = %29
%34 = icmp ult i64 %22, 255
br label %37
35: ; preds = %26
%36 = icmp ult i64 %22, 255
br label %37
37: ; preds = %33, %35, %21, %16, %10, %0
%38 = phi i1 [ true, %0 ], [ %34, %33 ], [ %36, %35 ], [ true, %21 ], [ true, %16 ], [ true, %10 ]
%39 = xor i1 %38, true
%40 = zext i1 %39 to i32
ret i32 %40
}