#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 */
scalar_t__ fclose(int /*<<< orphan*/);
scalar_t__ ferror(int /*<<< orphan*/);
int /*<<< orphan*/ main1();
int /*<<< orphan*/ main10();
int /*<<< orphan*/ main2();
int /*<<< orphan*/ main3();
int /*<<< orphan*/ main4();
int /*<<< orphan*/ main5();
int /*<<< orphan*/ main6();
int /*<<< orphan*/ main7();
int /*<<< orphan*/ main8();
int /*<<< orphan*/ main9();
int /*<<< orphan*/ stdout;
int main() {
  main1();
  main2();
  main3();
  main4();
  main5();
  main6();
  main7();
  main8();
  main9();
  main10();
  if (ferror(stdout) || fclose(stdout))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1080 <main1@plt>
mov    $0x0,%al
call   10d0 <main2@plt>
mov    $0x0,%al
call   1070 <main3@plt>
mov    $0x0,%al
call   10c0 <main4@plt>
mov    $0x0,%al
call   1060 <main5@plt>
mov    $0x0,%al
call   10b0 <main6@plt>
mov    $0x0,%al
call   1090 <main7@plt>
mov    $0x0,%al
call   10e0 <main8@plt>
mov    $0x0,%al
call   10a0 <main9@plt>
mov    $0x0,%al
call   1050 <main10@plt>
mov    0x2dc4(%rip),%rax
mov    (%rax),%edi
call   1030 <ferror@plt>
cmp    $0x0,%rax
jne    1245 <main+0x85>
mov    0x2dac(%rip),%rax
mov    (%rax),%edi
call   1040 <fclose@plt>
cmp    $0x0,%rax
je     1251 <main+0x91>
movl   $0x1,-0x4(%rbp)
jmp    1258 <main+0x98>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1080 <main1@plt>
xor    %eax,%eax
call   10d0 <main2@plt>
xor    %eax,%eax
call   1070 <main3@plt>
xor    %eax,%eax
call   10c0 <main4@plt>
xor    %eax,%eax
call   1060 <main5@plt>
xor    %eax,%eax
call   10b0 <main6@plt>
xor    %eax,%eax
call   1090 <main7@plt>
xor    %eax,%eax
call   10e0 <main8@plt>
xor    %eax,%eax
call   10a0 <main9@plt>
xor    %eax,%eax
call   1050 <main10@plt>
mov    0x2dd2(%rip),%rbx
mov    (%rbx),%edi
call   1030 <ferror@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1224 <main+0x64>
pop    %rbx
ret
mov    (%rbx),%edi
call   1040 <fclose@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
@stdout = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @main1()
%3 = call i32 (...) @main2()
%4 = call i32 (...) @main3()
%5 = call i32 (...) @main4()
%6 = call i32 (...) @main5()
%7 = call i32 (...) @main6()
%8 = call i32 (...) @main7()
%9 = call i32 (...) @main8()
%10 = call i32 (...) @main9()
%11 = call i32 (...) @main10()
%12 = load i32, i32* @stdout
%13 = call i64 @ferror(i32 %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %0
%16 = load i32, i32* @stdout
%17 = call i64 @fclose(i32 %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %15, %0
store i32 1, i32* %1
br label %21
20: ; preds = %15
store i32 0, i32* %1
br label %21
21: ; preds = %20, %19
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
@stdout = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @main1()
%2 = tail call i32 (...) @main2()
%3 = tail call i32 (...) @main3()
%4 = tail call i32 (...) @main4()
%5 = tail call i32 (...) @main5()
%6 = tail call i32 (...) @main6()
%7 = tail call i32 (...) @main7()
%8 = tail call i32 (...) @main8()
%9 = tail call i32 (...) @main9()
%10 = tail call i32 (...) @main10()
%11 = load i32, i32* @stdout
%12 = tail call i64 @ferror(i32 %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %0
%15 = load i32, i32* @stdout
%16 = tail call i64 @fclose(i32 %15)
%17 = icmp ne i64 %16, 0
%18 = zext i1 %17 to i32
br label %19
19: ; preds = %14, %0
%20 = phi i32 [ 1, %0 ], [ %18, %14 ]
ret i32 %20
}