#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 /*<<< orphan*/ srand(int);
int test_array();
int test_stream_nonzero();
int test_stream_random();
int test_stream_zero();
int main(int argc, char **args) {
  (void)argc;
  (void)args;
  srand(0x12345678);
  int res_test_stream_random = test_stream_random();
  int res_test_stream_nz = test_stream_nonzero();
  int res_test_stream_z = test_stream_zero();
  int res_test_array = test_array();
  int res = res_test_stream_random | res_test_stream_nz | res_test_stream_z |
            res_test_array | 0;
  if (res) {
    printf("test failed\n");
  } else {
    printf("TEST OK\n");
  }
  return res;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x12345678,%edi
call   1050 <srand@plt>
mov    $0x0,%al
call   1040 <test_stream_random@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1060 <test_stream_nonzero@plt>
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1080 <test_stream_zero@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1070 <test_array@plt>
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
or     -0x1c(%rbp),%eax
or     -0x20(%rbp),%eax
or     $0x0,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     11d5 <main+0x75>
lea    0xe35(%rip),%rdi
call   1030 <printf@plt>
jmp    11e1 <main+0x81>
lea    0xe31(%rip),%rdi
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x12345678,%edi
call   1050 <srand@plt>
xor    %eax,%eax
call   1040 <test_stream_random@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1060 <test_stream_nonzero@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1080 <test_stream_zero@plt>
mov    %eax,%r15d
xor    %eax,%eax
call   1070 <test_array@plt>
mov    %eax,%ebx
or     %r14d,%ebp
or     %r15d,%ebp
or     %ebp,%ebx
lea    0xe5a(%rip),%rax
lea    0xe5b(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"test failed\0A\00"
@.str.1 = [9 x i8] c"TEST OK\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = load i8**, i8*** %5
%13 = call i32 @srand(i32 305419896)
%14 = call i32 (...) @test_stream_random()
store i32 %14, i32* %6
%15 = call i32 (...) @test_stream_nonzero()
store i32 %15, i32* %7
%16 = call i32 (...) @test_stream_zero()
store i32 %16, i32* %8
%17 = call i32 (...) @test_array()
store i32 %17, i32* %9
%18 = load i32, i32* %6
%19 = load i32, i32* %7
%20 = or i32 %18, %19
%21 = load i32, i32* %8
%22 = or i32 %20, %21
%23 = load i32, i32* %9
%24 = or i32 %22, %23
%25 = or i32 %24, 0
store i32 %25, i32* %10
%26 = load i32, i32* %10
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %2
%29 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %32
30: ; preds = %2
%31 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %32
32: ; preds = %30, %28
%33 = load i32, i32* %10
ret i32 %33
}

LLVM IR (-O2):
@str = [8 x i8] c"TEST OK\00"
@str.2 = [12 x i8] c"test failed\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @srand(i32 305419896)
%4 = tail call i32 (...) @test_stream_random()
%5 = tail call i32 (...) @test_stream_nonzero()
%6 = tail call i32 (...) @test_stream_zero()
%7 = tail call i32 (...) @test_array()
%8 = or i32 %5, %4
%9 = or i32 %8, %6
%10 = or i32 %9, %7
%11 = icmp eq i32 %10, 0
%12 = select i1 %11, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str.2, i64 0, i64 0)
%13 = tail call i32 @puts(i8* dereferenceable(1) %12)
ret i32 %10
}