#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*/ __CrestLoad(int, unsigned long, long long);
int /*<<< orphan*/ __CrestReturn(int);
int /*<<< orphan*/ __CrestShort(short *);
int /*<<< orphan*/ __CrestStore(int, unsigned long);
int /*<<< orphan*/ __globinit_function();
short dbl(short);
int main(void) {
  short a;
  short tmp;
  int __retres3;
  {
    __globinit_function();
    __CrestCall(9, 2);
    __CrestShort(&a);
    __CrestLoad(10, (unsigned long)(&a), (long long)a);
    tmp = dbl(a);
    __CrestHandleReturn(12, (long long)tmp);
    __CrestStore(11, (unsigned long)(&tmp));
    __CrestLoad(17, (unsigned long)(&tmp), (long long)tmp);
    __CrestLoad(16, (unsigned long)0, (long long)3);
    __CrestApply2(15, 0, (long long)((int)tmp + 3));
    __CrestLoad(14, (unsigned long)0, (long long)9);
    __CrestApply2(13, 12, (long long)((int)tmp + 3 == 9));
    if ((int)tmp + 3 == 9) {
      __CrestBranch(18, 5, 1);
      __CrestLoad(20, (unsigned long)0, (long long)0);
      __CrestStore(21, (unsigned long)(&__retres3));
      __retres3 = 0;
      goto return_label;
    } else {
      __CrestBranch(19, 7, 0);
      __CrestLoad(22, (unsigned long)0, (long long)1);
      __CrestStore(23, (unsigned long)(&__retres3));
      __retres3 = 1;
      goto return_label;
    }
  return_label : {
    __CrestLoad(24, (unsigned long)(&__retres3), (long long)__retres3);
    __CrestReturn(25);
    return (__retres3);
  }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   10c0 <__globinit_function@plt>
mov    $0x9,%edi
mov    $0x2,%esi
call   1080 <__CrestCall@plt>
lea    -0x6(%rbp),%rdi
call   1040 <__CrestShort@plt>
lea    -0x6(%rbp),%rsi
movswq -0x6(%rbp),%rdx
mov    $0xa,%edi
call   1090 <__CrestLoad@plt>
movswl -0x6(%rbp),%edi
call   10b0 <dbl@plt>
mov    %ax,-0x8(%rbp)
movswq -0x8(%rbp),%rsi
mov    $0xc,%edi
call   10a0 <__CrestHandleReturn@plt>
lea    -0x8(%rbp),%rsi
mov    $0xb,%edi
call   1060 <__CrestStore@plt>
lea    -0x8(%rbp),%rsi
movswq -0x8(%rbp),%rdx
mov    $0x11,%edi
call   1090 <__CrestLoad@plt>
mov    $0x10,%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x3,%edx
call   1090 <__CrestLoad@plt>
movswl -0x8(%rbp),%eax
add    $0x3,%eax
movslq %eax,%rdx
mov    $0xf,%edi
xor    %esi,%esi
call   1030 <__CrestApply2@plt>
mov    $0xe,%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x9,%edx
call   1090 <__CrestLoad@plt>
movswl -0x8(%rbp),%eax
add    $0x3,%eax
cmp    $0x9,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
movslq %eax,%rdx
mov    $0xd,%edi
mov    $0xc,%esi
call   1030 <__CrestApply2@plt>
movswl -0x8(%rbp),%eax
add    $0x3,%eax
cmp    $0x9,%eax
jne    12cd <main+0x12d>
mov    $0x12,%edi
mov    $0x5,%esi
mov    $0x1,%edx
call   1050 <__CrestBranch@plt>
mov    $0x14,%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   1090 <__CrestLoad@plt>
lea    -0xc(%rbp),%rsi
mov    $0x15,%edi
call   1060 <__CrestStore@plt>
movl   $0x0,-0xc(%rbp)
jmp    1306 <main+0x166>
mov    $0x13,%edi
mov    $0x7,%esi
xor    %edx,%edx
call   1050 <__CrestBranch@plt>
mov    $0x16,%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x1,%edx
call   1090 <__CrestLoad@plt>
lea    -0xc(%rbp),%rsi
mov    $0x17,%edi
call   1060 <__CrestStore@plt>
movl   $0x1,-0xc(%rbp)
lea    -0xc(%rbp),%rsi
movslq -0xc(%rbp),%rdx
mov    $0x18,%edi
call   1090 <__CrestLoad@plt>
mov    $0x19,%edi
call   1070 <__CrestReturn@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %r14d,%r14d
xor    %eax,%eax
call   10c0 <__globinit_function@plt>
mov    $0x9,%edi
mov    $0x2,%esi
call   1080 <__CrestCall@plt>
lea    0x2(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <__CrestShort@plt>
movswq 0x2(%rsp),%rdx
mov    $0xa,%edi
mov    %rbx,%rsi
call   1090 <__CrestLoad@plt>
movswl 0x2(%rsp),%edi
call   10b0 <dbl@plt>
mov    %ax,(%rsp)
movswq %ax,%rsi
mov    $0xc,%edi
call   10a0 <__CrestHandleReturn@plt>
mov    %rsp,%rbx
mov    $0xb,%edi
mov    %rbx,%rsi
call   1060 <__CrestStore@plt>
movswq (%rsp),%rdx
mov    $0x11,%edi
mov    %rbx,%rsi
call   1090 <__CrestLoad@plt>
mov    $0x3,%edx
mov    $0x10,%edi
xor    %esi,%esi
call   1090 <__CrestLoad@plt>
movswq (%rsp),%rdx
add    $0x3,%rdx
mov    $0xf,%edi
xor    %esi,%esi
call   1030 <__CrestApply2@plt>
mov    $0x9,%edx
mov    $0xe,%edi
xor    %esi,%esi
call   1090 <__CrestLoad@plt>
xor    %edx,%edx
cmpw   $0x6,(%rsp)
sete   %dl
mov    $0xd,%edi
mov    $0xc,%esi
call   1030 <__CrestApply2@plt>
cmpw   $0x6,(%rsp)
jne    12a8 <main+0x108>
mov    $0x12,%edi
mov    $0x5,%esi
mov    $0x1,%edx
call   1050 <__CrestBranch@plt>
mov    $0x14,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1090 <__CrestLoad@plt>
lea    0x4(%rsp),%rbx
mov    $0x15,%edi
mov    %rbx,%rsi
call   1060 <__CrestStore@plt>
jmp    12e2 <main+0x142>
mov    $0x13,%edi
mov    $0x7,%esi
xor    %edx,%edx
call   1050 <__CrestBranch@plt>
mov    $0x1,%edx
mov    $0x16,%edi
xor    %esi,%esi
call   1090 <__CrestLoad@plt>
lea    0x4(%rsp),%rbx
mov    $0x17,%edi
mov    %rbx,%rsi
call   1060 <__CrestStore@plt>
mov    $0x1,%r14d
mov    %r14d,0x4(%rsp)
mov    %r14d,%edx
mov    $0x18,%edi
mov    %rbx,%rsi
call   1090 <__CrestLoad@plt>
mov    $0x19,%edi
call   1070 <__CrestReturn@plt>
mov    0x4(%rsp),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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