#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*/ jmp_buf;

/* Variables and functions */
int /*<<< orphan*/ call_longjmp(int /*<<< orphan*/ *);
int /*<<< orphan*/ do_nothing();
int /*<<< orphan*/ increase(int *);
scalar_t__ setjmp(int /*<<< orphan*/);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ test_exec_exit(char *);
int main(int argc, char *argv[]) {
  jmp_buf env;
  int foo = 5;
  int bar = 42;
  int i, j;
  if (argc == 2 && strcmp(argv[1], "exit") == 0)
    return 0;
  do_nothing();
  i = 0;
  increase(&i);
  increase(&i);
  increase(&i);
  for (i = 0; i < 10; i++) {
    j += 1;
  }
  if (setjmp(env) == 0) {
    call_longjmp(&env);
  } else
    j += 1;
  test_exec_exit(argv[0]);
  return j;
}


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)
movl   $0x5,-0x18(%rbp)
movl   $0x2a,-0x1c(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    11b8 <main+0x58>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe63(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11b8 <main+0x58>
movl   $0x0,-0x4(%rbp)
jmp    1244 <main+0xe4>
mov    $0x0,%al
call   1030 <do_nothing@plt>
movl   $0x0,-0x20(%rbp)
lea    -0x20(%rbp),%rdi
call   1080 <increase@plt>
lea    -0x20(%rbp),%rdi
call   1080 <increase@plt>
lea    -0x20(%rbp),%rdi
call   1080 <increase@plt>
movl   $0x0,-0x20(%rbp)
cmpl   $0xa,-0x20(%rbp)
jge    1209 <main+0xa9>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11e8 <main+0x88>
mov    -0x14(%rbp),%edi
call   1060 <setjmp@plt>
cmp    $0x0,%rax
jne    1229 <main+0xc9>
lea    -0x14(%rbp),%rdi
call   1070 <call_longjmp@plt>
jmp    1232 <main+0xd2>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <test_exec_exit@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
cmp    $0x2,%edi
jne    1181 <main+0x21>
mov    0x8(%r14),%rdi
lea    0xe89(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11cd <main+0x6d>
xor    %eax,%eax
call   1030 <do_nothing@plt>
movl   $0x0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1080 <increase@plt>
mov    %rbx,%rdi
call   1080 <increase@plt>
mov    %rbx,%rdi
call   1080 <increase@plt>
movl   $0xa,(%rsp)
call   1060 <setjmp@plt>
test   %rax,%rax
jne    11c5 <main+0x65>
lea    0x4(%rsp),%rdi
call   1070 <call_longjmp@plt>
mov    (%r14),%rdi
call   1040 <test_exec_exit@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"exit\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
store i32 5, i32* %7
store i32 42, i32* %8
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 2
br i1 %12, label %13, label %20
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %13
store i32 0, i32* %3
br label %49
20: ; preds = %13, %2
%21 = call i32 (...) @do_nothing()
store i32 0, i32* %9
%22 = call i32 @increase(i32* %9)
%23 = call i32 @increase(i32* %9)
%24 = call i32 @increase(i32* %9)
store i32 0, i32* %9
br label %25
25: ; preds = %31, %20
%26 = load i32, i32* %9
%27 = icmp slt i32 %26, 10
br i1 %27, label %28, label %34
28: ; preds = %25
%29 = load i32, i32* %10
%30 = add nsw i32 %29, 1
store i32 %30, i32* %10
br label %31
31: ; preds = %28
%32 = load i32, i32* %9
%33 = add nsw i32 %32, 1
store i32 %33, i32* %9
br label %25
34: ; preds = %25
%35 = load i32, i32* %6
%36 = call i64 @setjmp(i32 %35)
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %34
%39 = call i32 @call_longjmp(i32* %6)
br label %43
40: ; preds = %34
%41 = load i32, i32* %10
%42 = add nsw i32 %41, 1
store i32 %42, i32* %10
br label %43
43: ; preds = %40, %38
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 0
%46 = load i8*, i8** %45
%47 = call i32 @test_exec_exit(i8* %46)
%48 = load i32, i32* %10
store i32 %48, i32* %3
br label %49
49: ; preds = %43, %19
%50 = load i32, i32* %3
ret i32 %50
}

LLVM IR (-O2):
@.str = [5 x i8] c"exit\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = icmp eq i32 %0, 2
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %25, label %13
13: ; preds = %8, %2
%14 = tail call i32 (...) @do_nothing()
store i32 0, i32* %4
%15 = call i32 @increase(i32* %4)
%16 = call i32 @increase(i32* %4)
%17 = call i32 @increase(i32* %4)
store i32 10, i32* %4
%18 = call i64 @setjmp(i32 undef)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %13
%21 = call i32 @call_longjmp(i32* %3)
br label %22
22: ; preds = %13, %20
%23 = load i8*, i8** %1
%24 = call i32 @test_exec_exit(i8* %23)
br label %25
25: ; preds = %8, %22
ret i32 0
}