#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);
int getentropy(char *, int);
int main() {
  char buf[256] = {0};
  int r = getentropy(buf, 256);
  assert(r == 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>
mov    %eax,-0x114(%rbp)
cmpl   $0x0,-0x114(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
movl   $0x0,-0x118(%rbp)
cmpl   $0x100,-0x118(%rbp)
jge    11d7 <main+0xa7>
movslq -0x118(%rbp),%rax
movsbl -0x110(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     11be <main+0x8e>
movl   $0x0,-0x4(%rbp)
jmp    11de <main+0xae>
jmp    11c3 <main+0x93>
mov    -0x118(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x118(%rbp)
jmp    118a <main+0x5a>
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   %eax,%eax
sete   %dil
call   1040 <assert@plt>
mov    $0x1,%al
cmpb   $0x0,(%rsp)
je     11c0 <main+0xa0>
xor    $0x1,%al
movzbl %al,%eax
add    $0x108,%rsp
ret
mov    $0xffffffffffffffff,%rcx
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x2(%rsp,%rcx,1)
jne    11b3 <main+0x93>
cmpb   $0x0,0x3(%rsp,%rcx,1)
jne    11b3 <main+0x93>
cmpb   $0x0,0x4(%rsp,%rcx,1)
jne    11b3 <main+0x93>
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    11b3 <main+0x93>

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

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 i32 @getentropy(i8* %2, i32 256)
%4 = icmp eq i32 %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
}