#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*/ SIGPIPE;
scalar_t__ SIG_ERR;
int /*<<< orphan*/ SIG_IGN;
int /*<<< orphan*/ print_usage();
int /*<<< orphan*/ run();
scalar_t__ signal(int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char **argv) {
  if (signal(SIGPIPE, SIG_IGN) == SIG_ERR)
    return (1);
  if (argc < 1) {
    print_usage();
    return 1;
  }
  run();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
mov    0x2e92(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
mov    0x2e74(%rip),%rcx
cmp    (%rcx),%rax
jne    1179 <main+0x49>
movl   $0x1,-0x4(%rbp)
jmp    11a4 <main+0x74>
cmpl   $0x1,-0x8(%rbp)
jge    1196 <main+0x66>
mov    $0x0,%al
call   1050 <print_usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    11a4 <main+0x74>
mov    $0x0,%al
call   1030 <run@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
mov    0x2ea3(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
mov    0x2e85(%rip),%rcx
mov    $0x1,%ebx
cmp    (%rcx),%rax
je     1173 <main+0x43>
test   %ebp,%ebp
jle    116c <main+0x3c>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <run@plt>
jmp    1173 <main+0x43>
xor    %eax,%eax
call   1050 <print_usage@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@SIGPIPE = global i32 0
@SIG_IGN = global i32 0
@SIG_ERR = global i64 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* @SIGPIPE
%7 = load i32, i32* @SIG_IGN
%8 = call i64 @signal(i32 %6, i32 %7)
%9 = load i64, i64* @SIG_ERR
%10 = icmp eq i64 %8, %9
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 1, i32* %3
br label %19
12: ; preds = %2
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 1
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 (...) @print_usage()
store i32 1, i32* %3
br label %19
17: ; preds = %12
%18 = call i32 (...) @run()
store i32 0, i32* %3
br label %19
19: ; preds = %17, %15, %11
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
@SIGPIPE = global i32 0
@SIG_IGN = global i32 0
@SIG_ERR = global i64 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @SIGPIPE
%4 = load i32, i32* @SIG_IGN
%5 = tail call i64 @signal(i32 %3, i32 %4)
%6 = load i64, i64* @SIG_ERR
%7 = icmp eq i64 %5, %6
br i1 %7, label %14, label %8
8: ; preds = %2
%9 = icmp slt i32 %0, 1
br i1 %9, label %10, label %12
10: ; preds = %8
%11 = tail call i32 (...) @print_usage()
br label %14
12: ; preds = %8
%13 = tail call i32 (...) @run()
br label %14
14: ; preds = %2, %12, %10
%15 = phi i32 [ 1, %10 ], [ 0, %12 ], [ 1, %2 ]
ret i32 %15
}