#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*/ _exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
void test_pass() {
  do {
    printf("test_pass"
           "\n");
    fflush(stdout);
  } while (0);
  {
    int i = 1;
    printf("this test will pass\n");
    do {
      if (!(i == 1)) {
        printf("Assertion failed: "
               "i == 1"
               "\n");
        do {
          fclose(stdout);
          fclose(stderr);
          _exit(1);
        } while (0);
      }
    } while (0);
  }
}


x86 assembly (clang, -O0):
<test_pass>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
movl   $0x1,-0x4(%rbp)
lea    0xe9b(%rip),%rdi
call   1050 <printf@plt>
cmpl   $0x1,-0x4(%rbp)
je     11b1 <test_pass+0x71>
lea    0xe9a(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
call   1040 <fclose@plt>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
call   1040 <fclose@plt>
mov    $0x1,%edi
call   1030 <_exit@plt>
jmp    11b6 <test_pass+0x76>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_pass>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
lea    0xec8(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"test_pass\0A\00"
@stdout = global i32 0
@.str.1 = [21 x i8] c"this test will pass\0A\00"
@.str.2 = [26 x i8] c"Assertion failed: i == 1\0A\00"
@stderr = global i32 0
define void @test_pass() {
%1 = alloca i32
br label %2
2: ; preds = %0
%3 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stdout
%5 = call i32 @fflush(i32 %4)
br label %6
6: ; preds = %2
store i32 1, i32* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %6
%9 = load i32, i32* %1
%10 = icmp eq i32 %9, 1
br i1 %10, label %20, label %11
11: ; preds = %8
%12 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %13
13: ; preds = %11
%14 = load i32, i32* @stdout
%15 = call i32 @fclose(i32 %14)
%16 = load i32, i32* @stderr
%17 = call i32 @fclose(i32 %16)
%18 = call i32 @_exit(i32 1)
unreachable
19: ; No predecessors!
br label %20
20: ; preds = %19, %8
br label %21
21: ; preds = %20
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@stderr = global i32 0
@str = [10 x i8] c"test_pass\00"
@str.3 = [20 x i8] c"this test will pass\00"
define void @test_pass() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%2 = load i32, i32* @stdout
%3 = tail call i32 @fflush(i32 %2)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.3, i64 0, i64 0))
ret void
}