#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_faculty();
int fac(int);
int main(void) {
  int i;
  int s;
  int n;
  int tmp;
  {
    __globinit_faculty();
    __CrestCall(21, 2);
    __CrestInt(&i);
    __CrestLoad(22, (unsigned long)0, (long long)0);
    __CrestStore(23, (unsigned long)(&s));
    s = 0;
    __CrestLoad(24, (unsigned long)0, (long long)5);
    __CrestStore(25, (unsigned long)(&n));
    n = 5;
    __CrestLoad(26, (unsigned long)(&i), (long long)i);
    i = fac(i);
    __CrestHandleReturn(28, (long long)i);
    __CrestStore(27, (unsigned long)(&i));
    __CrestLoad(31, (unsigned long)(&i), (long long)i);
    __CrestLoad(30, (unsigned long)(&n), (long long)n);
    __CrestApply2(29, 15, (long long)(i <= n));
    if (i <= n) {
      __CrestBranch(32, 11, 1);
      __CrestLoad(34, (unsigned long)(&i), (long long)i);
      tmp = fac(i);
      __CrestHandleReturn(36, (long long)tmp);
      __CrestStore(35, (unsigned long)(&tmp));
      __CrestLoad(39, (unsigned long)(&s), (long long)s);
      __CrestLoad(38, (unsigned long)(&tmp), (long long)tmp);
      __CrestApply2(37, 0, (long long)(s + tmp));
      __CrestStore(40, (unsigned long)(&s));
      s += tmp;
      __CrestLoad(43, (unsigned long)(&i), (long long)i);
      __CrestLoad(42, (unsigned long)0, (long long)1);
      __CrestApply2(41, 0, (long long)(i + 1));
      __CrestStore(44, (unsigned long)(&i));
      i++;
    } else {
      __CrestBranch(33, 12, 0);
    }
    __CrestLoad(47, (unsigned long)(&i), (long long)i);
    __CrestLoad(46, (unsigned long)(&n), (long long)n);
    __CrestApply2(45, 15, (long long)(i <= n));
    if (i <= n) {
      __CrestBranch(48, 14, 1);
      __CrestLoad(50, (unsigned long)(&i), (long long)i);
      tmp = fac(i);
      __CrestHandleReturn(52, (long long)tmp);
      __CrestStore(51, (unsigned long)(&tmp));
      __CrestLoad(55, (unsigned long)(&s), (long long)s);
      __CrestLoad(54, (unsigned long)(&tmp), (long long)tmp);
      __CrestApply2(53, 0, (long long)(s + tmp));
      __CrestStore(56, (unsigned long)(&s));
      s += tmp;
      __CrestLoad(59, (unsigned long)(&i), (long long)i);
      __CrestLoad(58, (unsigned long)0, (long long)1);
      __CrestApply2(57, 0, (long long)(i + 1));
      __CrestStore(60, (unsigned long)(&i));
      i++;
    } else {
      __CrestBranch(49, 15, 0);
    }
    __CrestLoad(61, (unsigned long)(&s), (long long)s);
    __CrestReturn(62);
    return (s);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <__globinit_faculty@plt>
mov    $0x15,%edi
mov    $0x2,%esi
call   1090 <__CrestCall@plt>
lea    -0x8(%rbp),%rdi
call   10a0 <__CrestInt@plt>
mov    $0x16,%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   10b0 <__CrestLoad@plt>
lea    -0xc(%rbp),%rsi
mov    $0x17,%edi
call   1070 <__CrestStore@plt>
movl   $0x0,-0xc(%rbp)
mov    $0x18,%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x5,%edx
call   10b0 <__CrestLoad@plt>
lea    -0x10(%rbp),%rsi
mov    $0x19,%edi
call   1070 <__CrestStore@plt>
movl   $0x5,-0x10(%rbp)
lea    -0x8(%rbp),%rsi
movslq -0x8(%rbp),%rdx
mov    $0x1a,%edi
call   10b0 <__CrestLoad@plt>
mov    -0x8(%rbp),%edi
call   1050 <fac@plt>
mov    %eax,-0x8(%rbp)
movslq -0x8(%rbp),%rsi
mov    $0x1c,%edi
call   10c0 <__CrestHandleReturn@plt>
lea    -0x8(%rbp),%rsi
mov    $0x1b,%edi
call   1070 <__CrestStore@plt>
lea    -0x8(%rbp),%rsi
movslq -0x8(%rbp),%rdx
mov    $0x1f,%edi
call   10b0 <__CrestLoad@plt>
lea    -0x10(%rbp),%rsi
movslq -0x10(%rbp),%rdx
mov    $0x1e,%edi
call   10b0 <__CrestLoad@plt>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
setle  %al
and    $0x1,%al
movzbl %al,%eax
movslq %eax,%rdx
mov    $0x1d,%edi
mov    $0xf,%esi
call   1030 <__CrestApply2@plt>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1398 <main+0x1f8>
mov    $0x20,%edi
mov    $0xb,%esi
mov    $0x1,%edx
call   1060 <__CrestBranch@plt>
lea    -0x8(%rbp),%rsi
movslq -0x8(%rbp),%rdx
mov    $0x22,%edi
call   10b0 <__CrestLoad@plt>
mov    -0x8(%rbp),%edi
call   1050 <fac@plt>
mov    %eax,-0x14(%rbp)
movslq -0x14(%rbp),%rsi
mov    $0x24,%edi
call   10c0 <__CrestHandleReturn@plt>
lea    -0x14(%rbp),%rsi
mov    $0x23,%edi
call   1070 <__CrestStore@plt>
lea    -0xc(%rbp),%rsi
movslq -0xc(%rbp),%rdx
mov    $0x27,%edi
call   10b0 <__CrestLoad@plt>
lea    -0x14(%rbp),%rsi
movslq -0x14(%rbp),%rdx
mov    $0x26,%edi
call   10b0 <__CrestLoad@plt>
mov    -0xc(%rbp),%eax
add    -0x14(%rbp),%eax
movslq %eax,%rdx
mov    $0x25,%edi
xor    %esi,%esi
call   1030 <__CrestApply2@plt>
lea    -0xc(%rbp),%rsi
mov    $0x28,%edi
call   1070 <__CrestStore@plt>
mov    -0x14(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
lea    -0x8(%rbp),%rsi
movslq -0x8(%rbp),%rdx
mov    $0x2b,%edi
call   10b0 <__CrestLoad@plt>
mov    $0x2a,%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x1,%edx
call   10b0 <__CrestLoad@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdx
mov    $0x29,%edi
xor    %esi,%esi
call   1030 <__CrestApply2@plt>
lea    -0x8(%rbp),%rsi
mov    $0x2c,%edi
call   1070 <__CrestStore@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    13a9 <main+0x209>
mov    $0x21,%edi
mov    $0xc,%esi
xor    %edx,%edx
call   1060 <__CrestBranch@plt>
lea    -0x8(%rbp),%rsi
movslq -0x8(%rbp),%rdx
mov    $0x2f,%edi
call   10b0 <__CrestLoad@plt>
lea    -0x10(%rbp),%rsi
movslq -0x10(%rbp),%rdx
mov    $0x2e,%edi
call   10b0 <__CrestLoad@plt>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
setle  %al
and    $0x1,%al
movzbl %al,%eax
movslq %eax,%rdx
mov    $0x2d,%edi
mov    $0xf,%esi
call   1030 <__CrestApply2@plt>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     14ec <main+0x34c>
mov    $0x30,%edi
mov    $0xe,%esi
mov    $0x1,%edx
call   1060 <__CrestBranch@plt>
lea    -0x8(%rbp),%rsi
movslq -0x8(%rbp),%rdx
mov    $0x32,%edi
call   10b0 <__CrestLoad@plt>
mov    -0x8(%rbp),%edi
call   1050 <fac@plt>
mov    %eax,-0x14(%rbp)
movslq -0x14(%rbp),%rsi
mov    $0x34,%edi
call   10c0 <__CrestHandleReturn@plt>
lea    -0x14(%rbp),%rsi
mov    $0x33,%edi
call   1070 <__CrestStore@plt>
lea    -0xc(%rbp),%rsi
movslq -0xc(%rbp),%rdx
mov    $0x37,%edi
call   10b0 <__CrestLoad@plt>
lea    -0x14(%rbp),%rsi
movslq -0x14(%rbp),%rdx
mov    $0x36,%edi
call   10b0 <__CrestLoad@plt>
mov    -0xc(%rbp),%eax
add    -0x14(%rbp),%eax
movslq %eax,%rdx
mov    $0x35,%edi
xor    %esi,%esi
call   1030 <__CrestApply2@plt>
lea    -0xc(%rbp),%rsi
mov    $0x38,%edi
call   1070 <__CrestStore@plt>
mov    -0x14(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
lea    -0x8(%rbp),%rsi
movslq -0x8(%rbp),%rdx
mov    $0x3b,%edi
call   10b0 <__CrestLoad@plt>
mov    $0x3a,%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x1,%edx
call   10b0 <__CrestLoad@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdx
mov    $0x39,%edi
xor    %esi,%esi
call   1030 <__CrestApply2@plt>
lea    -0x8(%rbp),%rsi
mov    $0x3c,%edi
call   1070 <__CrestStore@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    14fd <main+0x35d>
mov    $0x31,%edi
mov    $0xf,%esi
xor    %edx,%edx
call   1060 <__CrestBranch@plt>
lea    -0xc(%rbp),%rsi
movslq -0xc(%rbp),%rdx
mov    $0x3d,%edi
call   10b0 <__CrestLoad@plt>
mov    $0x3e,%edi
call   1080 <__CrestReturn@plt>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1040 <__globinit_faculty@plt>
mov    $0x15,%edi
mov    $0x2,%esi
call   1090 <__CrestCall@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   10a0 <__CrestInt@plt>
mov    $0x16,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10b0 <__CrestLoad@plt>
lea    0x4(%rsp),%rsi
mov    $0x17,%edi
call   1070 <__CrestStore@plt>
movl   $0x0,0x4(%rsp)
mov    $0x5,%edx
mov    $0x18,%edi
xor    %esi,%esi
call   10b0 <__CrestLoad@plt>
lea    0xc(%rsp),%r14
mov    $0x19,%edi
mov    %r14,%rsi
call   1070 <__CrestStore@plt>
movl   $0x5,0xc(%rsp)
movslq (%rsp),%rdx
mov    $0x1a,%edi
mov    %rbx,%rsi
call   10b0 <__CrestLoad@plt>
mov    (%rsp),%edi
call   1050 <fac@plt>
mov    %eax,(%rsp)
movslq %eax,%rsi
mov    $0x1c,%edi
call   10c0 <__CrestHandleReturn@plt>
mov    $0x1b,%edi
mov    %rbx,%rsi
call   1070 <__CrestStore@plt>
movslq (%rsp),%rdx
mov    $0x1f,%edi
mov    %rbx,%rsi
call   10b0 <__CrestLoad@plt>
movslq 0xc(%rsp),%rdx
mov    $0x1e,%edi
mov    %r14,%rsi
call   10b0 <__CrestLoad@plt>
mov    (%rsp),%eax
xor    %edx,%edx
cmp    0xc(%rsp),%eax
setle  %dl
mov    $0x1d,%edi
mov    $0xf,%esi
call   1030 <__CrestApply2@plt>
mov    (%rsp),%eax
cmp    0xc(%rsp),%eax
jle    12b0 <main+0x110>
mov    $0x21,%edi
mov    $0xc,%esi
xor    %edx,%edx
call   1060 <__CrestBranch@plt>
mov    (%rsp),%eax
jmp    13a6 <main+0x206>
mov    $0x20,%edi
mov    $0xb,%esi
mov    $0x1,%edx
call   1060 <__CrestBranch@plt>
movslq (%rsp),%rdx
mov    %rsp,%r14
mov    $0x22,%edi
mov    %r14,%rsi
call   10b0 <__CrestLoad@plt>
mov    (%rsp),%edi
call   1050 <fac@plt>
mov    %eax,0x8(%rsp)
movslq %eax,%rsi
mov    $0x24,%edi
call   10c0 <__CrestHandleReturn@plt>
lea    0x8(%rsp),%rbx
mov    $0x23,%edi
mov    %rbx,%rsi
call   1070 <__CrestStore@plt>
movslq 0x4(%rsp),%rdx
lea    0x4(%rsp),%r15
mov    $0x27,%edi
mov    %r15,%rsi
call   10b0 <__CrestLoad@plt>
movslq 0x8(%rsp),%rdx
mov    $0x26,%edi
mov    %rbx,%rsi
call   10b0 <__CrestLoad@plt>
movslq 0x4(%rsp),%rax
movslq 0x8(%rsp),%rdx
add    %rax,%rdx
mov    $0x25,%edi
xor    %esi,%esi
call   1030 <__CrestApply2@plt>
mov    $0x28,%edi
mov    %r15,%rsi
call   1070 <__CrestStore@plt>
mov    0x8(%rsp),%eax
add    %eax,0x4(%rsp)
movslq (%rsp),%rdx
mov    $0x2b,%edi
mov    %r14,%rsi
call   10b0 <__CrestLoad@plt>
mov    $0x1,%edx
mov    $0x2a,%edi
xor    %esi,%esi
call   10b0 <__CrestLoad@plt>
movslq (%rsp),%rdx
add    $0x1,%rdx
mov    $0x29,%edi
xor    %esi,%esi
call   1030 <__CrestApply2@plt>
mov    $0x2c,%edi
mov    %r14,%rsi
call   1070 <__CrestStore@plt>
mov    (%rsp),%eax
add    $0x1,%eax
mov    %eax,(%rsp)
movslq %eax,%rdx
mov    %rsp,%rsi
mov    $0x2f,%edi
call   10b0 <__CrestLoad@plt>
movslq 0xc(%rsp),%rdx
lea    0xc(%rsp),%rsi
mov    $0x2e,%edi
call   10b0 <__CrestLoad@plt>
mov    (%rsp),%eax
xor    %edx,%edx
cmp    0xc(%rsp),%eax
setle  %dl
mov    $0x2d,%edi
mov    $0xf,%esi
call   1030 <__CrestApply2@plt>
mov    (%rsp),%eax
cmp    0xc(%rsp),%eax
jle    1404 <main+0x264>
mov    $0x31,%edi
mov    $0xf,%esi
xor    %edx,%edx
call   1060 <__CrestBranch@plt>
jmp    14f5 <main+0x355>
mov    $0x30,%edi
mov    $0xe,%esi
mov    $0x1,%edx
call   1060 <__CrestBranch@plt>
movslq (%rsp),%rdx
mov    %rsp,%r14
mov    $0x32,%edi
mov    %r14,%rsi
call   10b0 <__CrestLoad@plt>
mov    (%rsp),%edi
call   1050 <fac@plt>
mov    %eax,0x8(%rsp)
movslq %eax,%rsi
mov    $0x34,%edi
call   10c0 <__CrestHandleReturn@plt>
lea    0x8(%rsp),%rbx
mov    $0x33,%edi
mov    %rbx,%rsi
call   1070 <__CrestStore@plt>
movslq 0x4(%rsp),%rdx
lea    0x4(%rsp),%r15
mov    $0x37,%edi
mov    %r15,%rsi
call   10b0 <__CrestLoad@plt>
movslq 0x8(%rsp),%rdx
mov    $0x36,%edi
mov    %rbx,%rsi
call   10b0 <__CrestLoad@plt>
movslq 0x4(%rsp),%rax
movslq 0x8(%rsp),%rdx
add    %rax,%rdx
mov    $0x35,%edi
xor    %esi,%esi
call   1030 <__CrestApply2@plt>
mov    $0x38,%edi
mov    %r15,%rsi
call   1070 <__CrestStore@plt>
mov    0x8(%rsp),%eax
add    %eax,0x4(%rsp)
movslq (%rsp),%rdx
mov    $0x3b,%edi
mov    %r14,%rsi
call   10b0 <__CrestLoad@plt>
mov    $0x1,%edx
mov    $0x3a,%edi
xor    %esi,%esi
call   10b0 <__CrestLoad@plt>
movslq (%rsp),%rdx
add    $0x1,%rdx
mov    $0x39,%edi
xor    %esi,%esi
call   1030 <__CrestApply2@plt>
mov    $0x3c,%edi
mov    %r14,%rsi
call   1070 <__CrestStore@plt>
addl   $0x1,(%rsp)
movslq 0x4(%rsp),%rdx
lea    0x4(%rsp),%rsi
mov    $0x3d,%edi
call   10b0 <__CrestLoad@plt>
mov    $0x3e,%edi
call   1080 <__CrestReturn@plt>
mov    0x4(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (...) @__globinit_faculty()
%7 = call i32 @__CrestCall(i32 21, i32 2)
%8 = call i32 @__CrestInt(i32* %2)
%9 = call i32 @__CrestLoad(i32 22, i64 0, i64 0)
%10 = ptrtoint i32* %3 to i64
%11 = call i32 @__CrestStore(i32 23, i64 %10)
store i32 0, i32* %3
%12 = call i32 @__CrestLoad(i32 24, i64 0, i64 5)
%13 = ptrtoint i32* %4 to i64
%14 = call i32 @__CrestStore(i32 25, i64 %13)
store i32 5, i32* %4
%15 = ptrtoint i32* %2 to i64
%16 = load i32, i32* %2
%17 = sext i32 %16 to i64
%18 = call i32 @__CrestLoad(i32 26, i64 %15, i64 %17)
%19 = load i32, i32* %2
%20 = call i32 @fac(i32 %19)
store i32 %20, i32* %2
%21 = load i32, i32* %2
%22 = sext i32 %21 to i64
%23 = call i32 @__CrestHandleReturn(i32 28, i64 %22)
%24 = ptrtoint i32* %2 to i64
%25 = call i32 @__CrestStore(i32 27, i64 %24)
%26 = ptrtoint i32* %2 to i64
%27 = load i32, i32* %2
%28 = sext i32 %27 to i64
%29 = call i32 @__CrestLoad(i32 31, i64 %26, i64 %28)
%30 = ptrtoint i32* %4 to i64
%31 = load i32, i32* %4
%32 = sext i32 %31 to i64
%33 = call i32 @__CrestLoad(i32 30, i64 %30, i64 %32)
%34 = load i32, i32* %2
%35 = load i32, i32* %4
%36 = icmp sle i32 %34, %35
%37 = zext i1 %36 to i32
%38 = sext i32 %37 to i64
%39 = call i32 @__CrestApply2(i32 29, i32 15, i64 %38)
%40 = load i32, i32* %2
%41 = load i32, i32* %4
%42 = icmp sle i32 %40, %41
br i1 %42, label %43, label %87
43: ; preds = %0
%44 = call i32 @__CrestBranch(i32 32, i32 11, i32 1)
%45 = ptrtoint i32* %2 to i64
%46 = load i32, i32* %2
%47 = sext i32 %46 to i64
%48 = call i32 @__CrestLoad(i32 34, i64 %45, i64 %47)
%49 = load i32, i32* %2
%50 = call i32 @fac(i32 %49)
store i32 %50, i32* %5
%51 = load i32, i32* %5
%52 = sext i32 %51 to i64
%53 = call i32 @__CrestHandleReturn(i32 36, i64 %52)
%54 = ptrtoint i32* %5 to i64
%55 = call i32 @__CrestStore(i32 35, i64 %54)
%56 = ptrtoint i32* %3 to i64
%57 = load i32, i32* %3
%58 = sext i32 %57 to i64
%59 = call i32 @__CrestLoad(i32 39, i64 %56, i64 %58)
%60 = ptrtoint i32* %5 to i64
%61 = load i32, i32* %5
%62 = sext i32 %61 to i64
%63 = call i32 @__CrestLoad(i32 38, i64 %60, i64 %62)
%64 = load i32, i32* %3
%65 = load i32, i32* %5
%66 = add nsw i32 %64, %65
%67 = sext i32 %66 to i64
%68 = call i32 @__CrestApply2(i32 37, i32 0, i64 %67)
%69 = ptrtoint i32* %3 to i64
%70 = call i32 @__CrestStore(i32 40, i64 %69)
%71 = load i32, i32* %5
%72 = load i32, i32* %3
%73 = add nsw i32 %72, %71
store i32 %73, i32* %3
%74 = ptrtoint i32* %2 to i64
%75 = load i32, i32* %2
%76 = sext i32 %75 to i64
%77 = call i32 @__CrestLoad(i32 43, i64 %74, i64 %76)
%78 = call i32 @__CrestLoad(i32 42, i64 0, i64 1)
%79 = load i32, i32* %2
%80 = add nsw i32 %79, 1
%81 = sext i32 %80 to i64
%82 = call i32 @__CrestApply2(i32 41, i32 0, i64 %81)
%83 = ptrtoint i32* %2 to i64
%84 = call i32 @__CrestStore(i32 44, i64 %83)
%85 = load i32, i32* %2
%86 = add nsw i32 %85, 1
store i32 %86, i32* %2
br label %89
87: ; preds = %0
%88 = call i32 @__CrestBranch(i32 33, i32 12, i32 0)
br label %89
89: ; preds = %87, %43
%90 = ptrtoint i32* %2 to i64
%91 = load i32, i32* %2
%92 = sext i32 %91 to i64
%93 = call i32 @__CrestLoad(i32 47, i64 %90, i64 %92)
%94 = ptrtoint i32* %4 to i64
%95 = load i32, i32* %4
%96 = sext i32 %95 to i64
%97 = call i32 @__CrestLoad(i32 46, i64 %94, i64 %96)
%98 = load i32, i32* %2
%99 = load i32, i32* %4
%100 = icmp sle i32 %98, %99
%101 = zext i1 %100 to i32
%102 = sext i32 %101 to i64
%103 = call i32 @__CrestApply2(i32 45, i32 15, i64 %102)
%104 = load i32, i32* %2
%105 = load i32, i32* %4
%106 = icmp sle i32 %104, %105
br i1 %106, label %107, label %151
107: ; preds = %89
%108 = call i32 @__CrestBranch(i32 48, i32 14, i32 1)
%109 = ptrtoint i32* %2 to i64
%110 = load i32, i32* %2
%111 = sext i32 %110 to i64
%112 = call i32 @__CrestLoad(i32 50, i64 %109, i64 %111)
%113 = load i32, i32* %2
%114 = call i32 @fac(i32 %113)
store i32 %114, i32* %5
%115 = load i32, i32* %5
%116 = sext i32 %115 to i64
%117 = call i32 @__CrestHandleReturn(i32 52, i64 %116)
%118 = ptrtoint i32* %5 to i64
%119 = call i32 @__CrestStore(i32 51, i64 %118)
%120 = ptrtoint i32* %3 to i64
%121 = load i32, i32* %3
%122 = sext i32 %121 to i64
%123 = call i32 @__CrestLoad(i32 55, i64 %120, i64 %122)
%124 = ptrtoint i32* %5 to i64
%125 = load i32, i32* %5
%126 = sext i32 %125 to i64
%127 = call i32 @__CrestLoad(i32 54, i64 %124, i64 %126)
%128 = load i32, i32* %3
%129 = load i32, i32* %5
%130 = add nsw i32 %128, %129
%131 = sext i32 %130 to i64
%132 = call i32 @__CrestApply2(i32 53, i32 0, i64 %131)
%133 = ptrtoint i32* %3 to i64
%134 = call i32 @__CrestStore(i32 56, i64 %133)
%135 = load i32, i32* %5
%136 = load i32, i32* %3
%137 = add nsw i32 %136, %135
store i32 %137, i32* %3
%138 = ptrtoint i32* %2 to i64
%139 = load i32, i32* %2
%140 = sext i32 %139 to i64
%141 = call i32 @__CrestLoad(i32 59, i64 %138, i64 %140)
%142 = call i32 @__CrestLoad(i32 58, i64 0, i64 1)
%143 = load i32, i32* %2
%144 = add nsw i32 %143, 1
%145 = sext i32 %144 to i64
%146 = call i32 @__CrestApply2(i32 57, i32 0, i64 %145)
%147 = ptrtoint i32* %2 to i64
%148 = call i32 @__CrestStore(i32 60, i64 %147)
%149 = load i32, i32* %2
%150 = add nsw i32 %149, 1
store i32 %150, i32* %2
br label %153
151: ; preds = %89
%152 = call i32 @__CrestBranch(i32 49, i32 15, i32 0)
br label %153
153: ; preds = %151, %107
%154 = ptrtoint i32* %3 to i64
%155 = load i32, i32* %3
%156 = sext i32 %155 to i64
%157 = call i32 @__CrestLoad(i32 61, i64 %154, i64 %156)
%158 = call i32 @__CrestReturn(i32 62)
%159 = load i32, i32* %3
ret i32 %159
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = tail call i32 (...) @__globinit_faculty()
%10 = tail call i32 @__CrestCall(i32 21, i32 2)
%11 = call i32 @__CrestInt(i32* %1)
%12 = call i32 @__CrestLoad(i32 22, i64 0, i64 0)
%13 = ptrtoint i32* %2 to i64
%14 = call i32 @__CrestStore(i32 23, i64 %13)
store i32 0, i32* %2
%15 = call i32 @__CrestLoad(i32 24, i64 0, i64 5)
%16 = ptrtoint i32* %3 to i64
%17 = call i32 @__CrestStore(i32 25, i64 %16)
store i32 5, i32* %3
%18 = ptrtoint i32* %1 to i64
%19 = load i32, i32* %1
%20 = sext i32 %19 to i64
%21 = call i32 @__CrestLoad(i32 26, i64 %18, i64 %20)
%22 = load i32, i32* %1
%23 = call i32 @fac(i32 %22)
store i32 %23, i32* %1
%24 = sext i32 %23 to i64
%25 = call i32 @__CrestHandleReturn(i32 28, i64 %24)
%26 = call i32 @__CrestStore(i32 27, i64 %18)
%27 = load i32, i32* %1
%28 = sext i32 %27 to i64
%29 = call i32 @__CrestLoad(i32 31, i64 %18, i64 %28)
%30 = load i32, i32* %3
%31 = sext i32 %30 to i64
%32 = call i32 @__CrestLoad(i32 30, i64 %16, i64 %31)
%33 = load i32, i32* %1
%34 = load i32, i32* %3
%35 = icmp sle i32 %33, %34
%36 = zext i1 %35 to i64
%37 = call i32 @__CrestApply2(i32 29, i32 15, i64 %36)
%38 = load i32, i32* %1
%39 = load i32, i32* %3
%40 = icmp sgt i32 %38, %39
br i1 %40, label %78, label %41
41: ; preds = %0
%42 = call i32 @__CrestBranch(i32 32, i32 11, i32 1)
%43 = load i32, i32* %1
%44 = sext i32 %43 to i64
%45 = call i32 @__CrestLoad(i32 34, i64 %18, i64 %44)
%46 = load i32, i32* %1
%47 = call i32 @fac(i32 %46)
store i32 %47, i32* %4
%48 = sext i32 %47 to i64
%49 = call i32 @__CrestHandleReturn(i32 36, i64 %48)
%50 = ptrtoint i32* %4 to i64
%51 = call i32 @__CrestStore(i32 35, i64 %50)
%52 = load i32, i32* %2
%53 = sext i32 %52 to i64
%54 = call i32 @__CrestLoad(i32 39, i64 %13, i64 %53)
%55 = load i32, i32* %4
%56 = sext i32 %55 to i64
%57 = call i32 @__CrestLoad(i32 38, i64 %50, i64 %56)
%58 = load i32, i32* %2
%59 = load i32, i32* %4
%60 = add nsw i32 %59, %58
%61 = sext i32 %60 to i64
%62 = call i32 @__CrestApply2(i32 37, i32 0, i64 %61)
%63 = call i32 @__CrestStore(i32 40, i64 %13)
%64 = load i32, i32* %4
%65 = load i32, i32* %2
%66 = add nsw i32 %65, %64
store i32 %66, i32* %2
%67 = load i32, i32* %1
%68 = sext i32 %67 to i64
%69 = call i32 @__CrestLoad(i32 43, i64 %18, i64 %68)
%70 = call i32 @__CrestLoad(i32 42, i64 0, i64 1)
%71 = load i32, i32* %1
%72 = add nsw i32 %71, 1
%73 = sext i32 %72 to i64
%74 = call i32 @__CrestApply2(i32 41, i32 0, i64 %73)
%75 = call i32 @__CrestStore(i32 44, i64 %18)
%76 = load i32, i32* %1
%77 = add nsw i32 %76, 1
store i32 %77, i32* %1
br label %81
78: ; preds = %0
%79 = call i32 @__CrestBranch(i32 33, i32 12, i32 0)
%80 = load i32, i32* %1
br label %81
81: ; preds = %78, %41
%82 = phi i32 [ %80, %78 ], [ %77, %41 ]
%83 = sext i32 %82 to i64
%84 = call i32 @__CrestLoad(i32 47, i64 %18, i64 %83)
%85 = load i32, i32* %3
%86 = sext i32 %85 to i64
%87 = call i32 @__CrestLoad(i32 46, i64 %16, i64 %86)
%88 = load i32, i32* %1
%89 = load i32, i32* %3
%90 = icmp sle i32 %88, %89
%91 = zext i1 %90 to i64
%92 = call i32 @__CrestApply2(i32 45, i32 15, i64 %91)
%93 = load i32, i32* %1
%94 = load i32, i32* %3
%95 = icmp sgt i32 %93, %94
br i1 %95, label %133, label %96
96: ; preds = %81
%97 = call i32 @__CrestBranch(i32 48, i32 14, i32 1)
%98 = load i32, i32* %1
%99 = sext i32 %98 to i64
%100 = call i32 @__CrestLoad(i32 50, i64 %18, i64 %99)
%101 = load i32, i32* %1
%102 = call i32 @fac(i32 %101)
store i32 %102, i32* %4
%103 = sext i32 %102 to i64
%104 = call i32 @__CrestHandleReturn(i32 52, i64 %103)
%105 = ptrtoint i32* %4 to i64
%106 = call i32 @__CrestStore(i32 51, i64 %105)
%107 = load i32, i32* %2
%108 = sext i32 %107 to i64
%109 = call i32 @__CrestLoad(i32 55, i64 %13, i64 %108)
%110 = load i32, i32* %4
%111 = sext i32 %110 to i64
%112 = call i32 @__CrestLoad(i32 54, i64 %105, i64 %111)
%113 = load i32, i32* %2
%114 = load i32, i32* %4
%115 = add nsw i32 %114, %113
%116 = sext i32 %115 to i64
%117 = call i32 @__CrestApply2(i32 53, i32 0, i64 %116)
%118 = call i32 @__CrestStore(i32 56, i64 %13)
%119 = load i32, i32* %4
%120 = load i32, i32* %2
%121 = add nsw i32 %120, %119
store i32 %121, i32* %2
%122 = load i32, i32* %1
%123 = sext i32 %122 to i64
%124 = call i32 @__CrestLoad(i32 59, i64 %18, i64 %123)
%125 = call i32 @__CrestLoad(i32 58, i64 0, i64 1)
%126 = load i32, i32* %1
%127 = add nsw i32 %126, 1
%128 = sext i32 %127 to i64
%129 = call i32 @__CrestApply2(i32 57, i32 0, i64 %128)
%130 = call i32 @__CrestStore(i32 60, i64 %18)
%131 = load i32, i32* %1
%132 = add nsw i32 %131, 1
store i32 %132, i32* %1
br label %135
133: ; preds = %81
%134 = call i32 @__CrestBranch(i32 49, i32 15, i32 0)
br label %135
135: ; preds = %133, %96
%136 = load i32, i32* %2
%137 = sext i32 %136 to i64
%138 = call i32 @__CrestLoad(i32 61, i64 %13, i64 %137)
%139 = call i32 @__CrestReturn(i32 62)
%140 = load i32, i32* %2
ret i32 %140
}