#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*/ bar(int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, int);
int setjmp(int /*<<< orphan*/);
int main() {
  jmp_buf buf;
  int ret;
  if ((ret = setjmp(buf)) != 0) {
    printf("returning from bar == %d\n", ret);
    if ((ret = setjmp(buf)) != 0) {
      printf("returning from bar == %d\n", ret);
    } else {
      bar(buf, 927);
    }
  } else {
    bar(buf, 37);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <setjmp@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
je     119c <main+0x6c>
mov    -0xc(%rbp),%esi
lea    0xea3(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
call   1050 <setjmp@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
je     118a <main+0x5a>
mov    -0xc(%rbp),%esi
lea    0xe80(%rip),%rdi
call   1040 <printf@plt>
jmp    1197 <main+0x67>
mov    -0x8(%rbp),%edi
mov    $0x39f,%esi
call   1030 <bar@plt>
jmp    11a9 <main+0x79>
mov    -0x8(%rbp),%edi
mov    $0x25,%esi
call   1030 <bar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1050 <setjmp@plt>
test   %eax,%eax
je     1161 <main+0x31>
mov    %eax,%esi
lea    0xebd(%rip),%rdi
call   1040 <printf@plt>
call   1050 <setjmp@plt>
test   %eax,%eax
je     1168 <main+0x38>
mov    %eax,%esi
lea    0xea6(%rip),%rdi
call   1040 <printf@plt>
jmp    1172 <main+0x42>
mov    $0x25,%esi
jmp    116d <main+0x3d>
mov    $0x39f,%esi
call   1030 <bar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"returning from bar == %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = load i32, i32* %2
%5 = call i32 @setjmp(i32 %4)
store i32 %5, i32* %3
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %20
7: ; preds = %0
%8 = load i32, i32* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32, i32* %2
%11 = call i32 @setjmp(i32 %10)
store i32 %11, i32* %3
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %7
%14 = load i32, i32* %3
%15 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %14)
br label %19
16: ; preds = %7
%17 = load i32, i32* %2
%18 = call i32 @bar(i32 %17, i32 927)
br label %19
19: ; preds = %16, %13
br label %23
20: ; preds = %0
%21 = load i32, i32* %2
%22 = call i32 @bar(i32 %21, i32 37)
br label %23
23: ; preds = %20, %19
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"returning from bar == %d\0A\00"
define i32 @main() {
%1 = call i32 @setjmp(i32 undef)
%2 = icmp eq i32 %1, 0
br i1 %2, label %11, label %3
3: ; preds = %0
%4 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %1)
%5 = call i32 @setjmp(i32 undef)
%6 = icmp eq i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %13
9: ; preds = %3
%10 = call i32 @bar(i32 undef, i32 927)
br label %13
11: ; preds = %0
%12 = call i32 @bar(i32 undef, i32 37)
br label %13
13: ; preds = %7, %9, %11
ret i32 0
}