#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 */
typedef int /*<<< orphan*/ sigjmp_buf;
typedef int /*<<< orphan*/ jmp_buf;

/* Variables and functions */
int /*<<< orphan*/ _catch_signals(int *, int /*<<< orphan*/ *,
                                  int /*<<< orphan*/ *);
int /*<<< orphan*/ _do_main(int, char **);
int /*<<< orphan*/ _release_signals();
int /*<<< orphan*/ init_trace_stack();
int setjmp(int /*<<< orphan*/);
int sigsetjmp(int /*<<< orphan*/, int);
int main(int argc, char **argv) {
  init_trace_stack();
  ;
  int rc = 0;
  static sigjmp_buf sigjmpbuf;
  static jmp_buf jmpbuf;
  int code = sigsetjmp(sigjmpbuf, 1);
  if (code == 0) {
    code = setjmp(jmpbuf);
    if (code == 0) {
      _catch_signals(&rc, &sigjmpbuf, &jmpbuf);
      _do_main(argc, argv);
      _release_signals();
    } else {
      ;
      rc = code;
      _release_signals();
    }
  } else {
    ;
    rc = code;
    _release_signals();
  }
  { return (rc); };
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <init_trace_stack@plt>
movl   $0x0,-0x14(%rbp)
mov    0x2eca(%rip),%edi
mov    $0x1,%esi
call   1080 <sigsetjmp@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    11fa <main+0x9a>
mov    0x2eb1(%rip),%edi
call   1060 <setjmp@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    11e8 <main+0x88>
lea    -0x14(%rbp),%rdi
lea    0x2e90(%rip),%rsi
lea    0x2e8d(%rip),%rdx
call   1030 <_catch_signals@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <_do_main@plt>
mov    $0x0,%al
call   1050 <_release_signals@plt>
jmp    11f5 <main+0x95>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1050 <_release_signals@plt>
jmp    1207 <main+0xa7>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1050 <_release_signals@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <init_trace_stack@plt>
movl   $0x0,0x4(%rsp)
mov    0x2ed7(%rip),%edi
mov    $0x1,%esi
call   1080 <sigsetjmp@plt>
test   %eax,%eax
jne    119a <main+0x3a>
mov    0x2ec7(%rip),%edi
call   1060 <setjmp@plt>
test   %eax,%eax
je     11ac <main+0x4c>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <_release_signals@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0x2ea1(%rip),%rsi
lea    0x2e9e(%rip),%rdx
lea    0x4(%rsp),%rdi
call   1030 <_catch_signals@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1070 <_do_main@plt>
xor    %eax,%eax
call   1050 <_release_signals@plt>
mov    0x4(%rsp),%eax
jmp    11a5 <main+0x45>

LLVM IR (-O0):
@main.sigjmpbuf = internal global i32 0
@main.jmpbuf = internal global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 (...) @init_trace_stack()
store i32 0, i32* %6
%9 = load i32, i32* @main.sigjmpbuf
%10 = call i32 @sigsetjmp(i32 %9, i32 1)
store i32 %10, i32* %7
%11 = load i32, i32* %7
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %28
13: ; preds = %2
%14 = load i32, i32* @main.jmpbuf
%15 = call i32 @setjmp(i32 %14)
store i32 %15, i32* %7
%16 = load i32, i32* %7
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %13
%19 = call i32 @_catch_signals(i32* %6, i32* @main.sigjmpbuf, i32* @main.jmpbuf)
%20 = load i32, i32* %4
%21 = load i8**, i8*** %5
%22 = call i32 @_do_main(i32 %20, i8** %21)
%23 = call i32 (...) @_release_signals()
br label %27
24: ; preds = %13
%25 = load i32, i32* %7
store i32 %25, i32* %6
%26 = call i32 (...) @_release_signals()
br label %27
27: ; preds = %24, %18
br label %31
28: ; preds = %2
%29 = load i32, i32* %7
store i32 %29, i32* %6
%30 = call i32 (...) @_release_signals()
br label %31
31: ; preds = %28, %27
%32 = load i32, i32* %6
ret i32 %32
}

LLVM IR (-O2):
@main.sigjmpbuf = internal global i32 0
@main.jmpbuf = internal global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = call i32 (...) @init_trace_stack()
%5 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%6 = load i32, i32* @main.sigjmpbuf
%7 = call i32 @sigsetjmp(i32 %6, i32 1)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %20
9: ; preds = %2
%10 = load i32, i32* @main.jmpbuf
%11 = call i32 @setjmp(i32 %10)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %9
%14 = call i32 @_catch_signals(i32* %3, i32* @main.sigjmpbuf, i32* @main.jmpbuf)
%15 = call i32 @_do_main(i32 %0, i8** %1)
%16 = call i32 (...) @_release_signals()
%17 = load i32, i32* %3
br label %22
18: ; preds = %9
%19 = call i32 (...) @_release_signals()
br label %22
20: ; preds = %2
%21 = call i32 (...) @_release_signals()
br label %22
22: ; preds = %13, %18, %20
%23 = phi i32 [ %17, %13 ], [ %11, %18 ], [ %7, %20 ]
ret i32 %23
}