#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*/ __CrestApply2(int, int, long long);
int /*<<< orphan*/ __CrestBranch(int, int, int);
int /*<<< orphan*/ __CrestCall(int, int);
int /*<<< orphan*/ __CrestHandleReturn(int, long long);
int /*<<< orphan*/ __CrestInt(int *);
int /*<<< orphan*/ __CrestLoad(int, unsigned long, long long);
int /*<<< orphan*/ __CrestReturn(int);
int /*<<< orphan*/ __CrestStore(int, unsigned long);
int /*<<< orphan*/ __globinit_sixtimes();
int mult(int);
int main(void) {
  int a;
  int b;
  int __retres3;
  {
    __globinit_sixtimes();
    __CrestCall(20, 3);
    __CrestInt(&a);
    __CrestLoad(21, (unsigned long)(&a), (long long)a);
    a = mult(a);
    __CrestHandleReturn(23, (long long)a);
    __CrestStore(22, (unsigned long)(&a));
    __CrestLoad(26, (unsigned long)(&a), (long long)a);
    __CrestLoad(25, (unsigned long)0, (long long)31);
    __CrestApply2(24, 12, (long long)(a == 31));
    if (a == 31) {
      __CrestBranch(27, 7, 1);
      __CrestLoad(29, (unsigned long)0, (long long)1);
      __CrestStore(30, (unsigned long)(&b));
      b = 1;
    } else {
      __CrestBranch(28, 8, 0);
      __CrestLoad(31, (unsigned long)0, (long long)2);
      __CrestStore(32, (unsigned long)(&b));
      b = 2;
    }
    __CrestLoad(33, (unsigned long)0, (long long)0);
    __CrestStore(34, (unsigned long)(&__retres3));
    __retres3 = 0;
    __CrestLoad(35, (unsigned long)(&__retres3), (long long)__retres3);
    __CrestReturn(36);
    return (__retres3);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1070 <__globinit_sixtimes@plt>
mov    $0x14,%edi
mov    $0x3,%esi
call   1080 <__CrestCall@plt>
lea    -0x8(%rbp),%rdi
call   10a0 <__CrestInt@plt>
lea    -0x8(%rbp),%rsi
movslq -0x8(%rbp),%rdx
mov    $0x15,%edi
call   10b0 <__CrestLoad@plt>
mov    -0x8(%rbp),%edi
call   1090 <mult@plt>
mov    %eax,-0x8(%rbp)
movslq -0x8(%rbp),%rsi
mov    $0x17,%edi
call   10c0 <__CrestHandleReturn@plt>
lea    -0x8(%rbp),%rsi
mov    $0x16,%edi
call   1050 <__CrestStore@plt>
lea    -0x8(%rbp),%rsi
movslq -0x8(%rbp),%rdx
mov    $0x1a,%edi
call   10b0 <__CrestLoad@plt>
mov    $0x19,%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x1f,%edx
call   10b0 <__CrestLoad@plt>
cmpl   $0x1f,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
movslq %eax,%rdx
mov    $0x18,%edi
mov    $0xc,%esi
call   1030 <__CrestApply2@plt>
cmpl   $0x1f,-0x8(%rbp)
jne    1295 <main+0xf5>
mov    $0x1b,%edi
mov    $0x7,%esi
mov    $0x1,%edx
call   1040 <__CrestBranch@plt>
mov    $0x1d,%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x1,%edx
call   10b0 <__CrestLoad@plt>
lea    -0xc(%rbp),%rsi
mov    $0x1e,%edi
call   1050 <__CrestStore@plt>
movl   $0x1,-0xc(%rbp)
jmp    12ce <main+0x12e>
mov    $0x1c,%edi
mov    $0x8,%esi
xor    %edx,%edx
call   1040 <__CrestBranch@plt>
mov    $0x1f,%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x2,%edx
call   10b0 <__CrestLoad@plt>
lea    -0xc(%rbp),%rsi
mov    $0x20,%edi
call   1050 <__CrestStore@plt>
movl   $0x2,-0xc(%rbp)
mov    $0x21,%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   10b0 <__CrestLoad@plt>
lea    -0x10(%rbp),%rsi
mov    $0x22,%edi
call   1050 <__CrestStore@plt>
movl   $0x0,-0x10(%rbp)
lea    -0x10(%rbp),%rsi
movslq -0x10(%rbp),%rdx
mov    $0x23,%edi
call   10b0 <__CrestLoad@plt>
mov    $0x24,%edi
call   1060 <__CrestReturn@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1070 <__globinit_sixtimes@plt>
mov    $0x14,%edi
mov    $0x3,%esi
call   1080 <__CrestCall@plt>
lea    0x4(%rsp),%rbx
mov    %rbx,%rdi
call   10a0 <__CrestInt@plt>
movslq 0x4(%rsp),%rdx
mov    $0x15,%edi
mov    %rbx,%rsi
call   10b0 <__CrestLoad@plt>
mov    0x4(%rsp),%edi
call   1090 <mult@plt>
mov    %eax,0x4(%rsp)
movslq %eax,%rsi
mov    $0x17,%edi
call   10c0 <__CrestHandleReturn@plt>
mov    $0x16,%edi
mov    %rbx,%rsi
call   1050 <__CrestStore@plt>
movslq 0x4(%rsp),%rdx
mov    $0x1a,%edi
mov    %rbx,%rsi
call   10b0 <__CrestLoad@plt>
mov    $0x1f,%edx
mov    $0x19,%edi
xor    %esi,%esi
call   10b0 <__CrestLoad@plt>
xor    %edx,%edx
cmpl   $0x1f,0x4(%rsp)
sete   %dl
mov    $0x18,%edi
mov    $0xc,%esi
call   1030 <__CrestApply2@plt>
cmpl   $0x1f,0x4(%rsp)
jne    1275 <main+0xd5>
mov    $0x1,%ebx
mov    $0x1b,%edi
mov    $0x7,%esi
mov    $0x1,%edx
call   1040 <__CrestBranch@plt>
mov    $0x1,%edx
mov    $0x1d,%edi
xor    %esi,%esi
call   10b0 <__CrestLoad@plt>
mov    $0x1e,%edi
jmp    12a1 <main+0x101>
mov    $0x1c,%edi
mov    $0x8,%esi
xor    %edx,%edx
call   1040 <__CrestBranch@plt>
mov    $0x2,%edx
mov    $0x1f,%edi
xor    %esi,%esi
call   10b0 <__CrestLoad@plt>
mov    $0x2,%ebx
mov    $0x20,%edi
lea    0xc(%rsp),%rsi
call   1050 <__CrestStore@plt>
mov    %ebx,0xc(%rsp)
mov    $0x21,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10b0 <__CrestLoad@plt>
lea    0x8(%rsp),%rbx
mov    $0x22,%edi
mov    %rbx,%rsi
call   1050 <__CrestStore@plt>
movl   $0x0,0x8(%rsp)
mov    $0x23,%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   10b0 <__CrestLoad@plt>
mov    $0x24,%edi
call   1060 <__CrestReturn@plt>
mov    0x8(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (...) @__globinit_sixtimes()
%6 = call i32 @__CrestCall(i32 20, i32 3)
%7 = call i32 @__CrestInt(i32* %2)
%8 = ptrtoint i32* %2 to i64
%9 = load i32, i32* %2
%10 = sext i32 %9 to i64
%11 = call i32 @__CrestLoad(i32 21, i64 %8, i64 %10)
%12 = load i32, i32* %2
%13 = call i32 @mult(i32 %12)
store i32 %13, i32* %2
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = call i32 @__CrestHandleReturn(i32 23, i64 %15)
%17 = ptrtoint i32* %2 to i64
%18 = call i32 @__CrestStore(i32 22, i64 %17)
%19 = ptrtoint i32* %2 to i64
%20 = load i32, i32* %2
%21 = sext i32 %20 to i64
%22 = call i32 @__CrestLoad(i32 26, i64 %19, i64 %21)
%23 = call i32 @__CrestLoad(i32 25, i64 0, i64 31)
%24 = load i32, i32* %2
%25 = icmp eq i32 %24, 31
%26 = zext i1 %25 to i32
%27 = sext i32 %26 to i64
%28 = call i32 @__CrestApply2(i32 24, i32 12, i64 %27)
%29 = load i32, i32* %2
%30 = icmp eq i32 %29, 31
br i1 %30, label %31, label %36
31: ; preds = %0
%32 = call i32 @__CrestBranch(i32 27, i32 7, i32 1)
%33 = call i32 @__CrestLoad(i32 29, i64 0, i64 1)
%34 = ptrtoint i32* %3 to i64
%35 = call i32 @__CrestStore(i32 30, i64 %34)
store i32 1, i32* %3
br label %41
36: ; preds = %0
%37 = call i32 @__CrestBranch(i32 28, i32 8, i32 0)
%38 = call i32 @__CrestLoad(i32 31, i64 0, i64 2)
%39 = ptrtoint i32* %3 to i64
%40 = call i32 @__CrestStore(i32 32, i64 %39)
store i32 2, i32* %3
br label %41
41: ; preds = %36, %31
%42 = call i32 @__CrestLoad(i32 33, i64 0, i64 0)
%43 = ptrtoint i32* %4 to i64
%44 = call i32 @__CrestStore(i32 34, i64 %43)
store i32 0, i32* %4
%45 = ptrtoint i32* %4 to i64
%46 = load i32, i32* %4
%47 = sext i32 %46 to i64
%48 = call i32 @__CrestLoad(i32 35, i64 %45, i64 %47)
%49 = call i32 @__CrestReturn(i32 36)
%50 = load i32, i32* %4
ret i32 %50
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 (...) @__globinit_sixtimes()
%8 = tail call i32 @__CrestCall(i32 20, i32 3)
%9 = call i32 @__CrestInt(i32* %1)
%10 = ptrtoint i32* %1 to i64
%11 = load i32, i32* %1
%12 = sext i32 %11 to i64
%13 = call i32 @__CrestLoad(i32 21, i64 %10, i64 %12)
%14 = load i32, i32* %1
%15 = call i32 @mult(i32 %14)
store i32 %15, i32* %1
%16 = sext i32 %15 to i64
%17 = call i32 @__CrestHandleReturn(i32 23, i64 %16)
%18 = call i32 @__CrestStore(i32 22, i64 %10)
%19 = load i32, i32* %1
%20 = sext i32 %19 to i64
%21 = call i32 @__CrestLoad(i32 26, i64 %10, i64 %20)
%22 = call i32 @__CrestLoad(i32 25, i64 0, i64 31)
%23 = load i32, i32* %1
%24 = icmp eq i32 %23, 31
%25 = zext i1 %24 to i64
%26 = call i32 @__CrestApply2(i32 24, i32 12, i64 %25)
%27 = load i32, i32* %1
%28 = icmp eq i32 %27, 31
br i1 %28, label %29, label %32
29: ; preds = %0
%30 = call i32 @__CrestBranch(i32 27, i32 7, i32 1)
%31 = call i32 @__CrestLoad(i32 29, i64 0, i64 1)
br label %35
32: ; preds = %0
%33 = call i32 @__CrestBranch(i32 28, i32 8, i32 0)
%34 = call i32 @__CrestLoad(i32 31, i64 0, i64 2)
br label %35
35: ; preds = %32, %29
%36 = phi i32 [ 32, %32 ], [ 30, %29 ]
%37 = phi i32 [ 2, %32 ], [ 1, %29 ]
%38 = ptrtoint i32* %2 to i64
%39 = call i32 @__CrestStore(i32 %36, i64 %38)
store i32 %37, i32* %2
%40 = call i32 @__CrestLoad(i32 33, i64 0, i64 0)
%41 = ptrtoint i32* %3 to i64
%42 = call i32 @__CrestStore(i32 34, i64 %41)
store i32 0, i32* %3
%43 = call i32 @__CrestLoad(i32 35, i64 %41, i64 0)
%44 = call i32 @__CrestReturn(i32 36)
%45 = load i32, i32* %3
ret i32 %45
}