#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*/ __CrestClearStack(int);
int /*<<< orphan*/ __CrestHandleReturn(int, long long);
int /*<<< orphan*/ __CrestLoad(int, unsigned long, long long);
int /*<<< orphan*/ __CrestReturn(int);
int /*<<< orphan*/ __CrestStore(int, unsigned long);
int /*<<< orphan*/ __globinit_primemod();
int prime(int);
int /*<<< orphan*/ swap(int *, int *);
int main(void) {
  int x;
  int y;
  int tmp;
  int tmp___0;
  int tmp___1;
  {
    __globinit_primemod();
    __CrestCall(96, 5);
    __CrestLoad(97, (unsigned long)0, (long long)21649);
    __CrestStore(98, (unsigned long)(&x));
    x = 21649;
    __CrestLoad(99, (unsigned long)0, (long long)513239);
    __CrestStore(100, (unsigned long)(&y));
    y = 513239;
    swap(&x, &y);
    __CrestClearStack(101);
    __CrestLoad(102, (unsigned long)(&x), (long long)x);
    tmp = prime(x);
    __CrestHandleReturn(104, (long long)tmp);
    __CrestStore(103, (unsigned long)(&tmp));
    __CrestLoad(107, (unsigned long)(&tmp), (long long)tmp);
    __CrestLoad(106, (unsigned long)0, (long long)0);
    __CrestApply2(105, 13, (long long)(tmp != 0));
    if (tmp != 0) {
      __CrestBranch(108, 35, 1);
      __CrestLoad(110, (unsigned long)(&y), (long long)y);
      tmp___0 = prime(y);
      __CrestHandleReturn(112, (long long)tmp___0);
      __CrestStore(111, (unsigned long)(&tmp___0));
      {
        __CrestLoad(115, (unsigned long)(&tmp___0), (long long)tmp___0);
        __CrestLoad(114, (unsigned long)0, (long long)0);
        __CrestApply2(113, 13, (long long)(tmp___0 != 0));
        if (tmp___0 != 0) {
          __CrestBranch(116, 37, 1);
          __CrestLoad(118, (unsigned long)0, (long long)0);
          __CrestStore(119, (unsigned long)(&tmp___1));
          tmp___1 = 0;
        } else {
          __CrestBranch(117, 38, 0);
          __CrestLoad(120, (unsigned long)0, (long long)1);
          __CrestStore(121, (unsigned long)(&tmp___1));
          tmp___1 = 1;
        }
      }
    } else {
      __CrestBranch(109, 39, 0);
      __CrestLoad(122, (unsigned long)0, (long long)1);
      __CrestStore(123, (unsigned long)(&tmp___1));
      tmp___1 = 1;
    }
    __CrestLoad(124, (unsigned long)(&tmp___1), (long long)tmp___1);
    __CrestReturn(125);
    return (tmp___1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1070 <__globinit_primemod@plt>
mov    $0x60,%edi
mov    $0x5,%esi
call   1080 <__CrestCall@plt>
mov    $0x61,%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x5491,%edx
call   1090 <__CrestLoad@plt>
lea    -0x8(%rbp),%rsi
mov    $0x62,%edi
call   1050 <__CrestStore@plt>
movl   $0x5491,-0x8(%rbp)
mov    $0x63,%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x7d4d7,%edx
call   1090 <__CrestLoad@plt>
lea    -0xc(%rbp),%rsi
mov    $0x64,%edi
call   1050 <__CrestStore@plt>
movl   $0x7d4d7,-0xc(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   10c0 <swap@plt>
mov    $0x65,%edi
call   10d0 <__CrestClearStack@plt>
lea    -0x8(%rbp),%rsi
movslq -0x8(%rbp),%rdx
mov    $0x66,%edi
call   1090 <__CrestLoad@plt>
mov    -0x8(%rbp),%edi
call   10b0 <prime@plt>
mov    %eax,-0x10(%rbp)
movslq -0x10(%rbp),%rsi
mov    $0x68,%edi
call   10a0 <__CrestHandleReturn@plt>
lea    -0x10(%rbp),%rsi
mov    $0x67,%edi
call   1050 <__CrestStore@plt>
lea    -0x10(%rbp),%rsi
movslq -0x10(%rbp),%rdx
mov    $0x6b,%edi
call   1090 <__CrestLoad@plt>
mov    $0x6a,%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   1090 <__CrestLoad@plt>
cmpl   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
movslq %eax,%rdx
mov    $0x69,%edi
mov    $0xd,%esi
call   1030 <__CrestApply2@plt>
cmpl   $0x0,-0x10(%rbp)
je     13d5 <main+0x225>
mov    $0x6c,%edi
mov    $0x23,%esi
mov    $0x1,%edx
call   1040 <__CrestBranch@plt>
lea    -0xc(%rbp),%rsi
movslq -0xc(%rbp),%rdx
mov    $0x6e,%edi
call   1090 <__CrestLoad@plt>
mov    -0xc(%rbp),%edi
call   10b0 <prime@plt>
mov    %eax,-0x14(%rbp)
movslq -0x14(%rbp),%rsi
mov    $0x70,%edi
call   10a0 <__CrestHandleReturn@plt>
lea    -0x14(%rbp),%rsi
mov    $0x6f,%edi
call   1050 <__CrestStore@plt>
lea    -0x14(%rbp),%rsi
movslq -0x14(%rbp),%rdx
mov    $0x73,%edi
call   1090 <__CrestLoad@plt>
mov    $0x72,%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   1090 <__CrestLoad@plt>
cmpl   $0x0,-0x14(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
movslq %eax,%rdx
mov    $0x71,%edi
mov    $0xd,%esi
call   1030 <__CrestApply2@plt>
cmpl   $0x0,-0x14(%rbp)
je     1397 <main+0x1e7>
mov    $0x74,%edi
mov    $0x25,%esi
mov    $0x1,%edx
call   1040 <__CrestBranch@plt>
mov    $0x76,%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   1090 <__CrestLoad@plt>
lea    -0x18(%rbp),%rsi
mov    $0x77,%edi
call   1050 <__CrestStore@plt>
movl   $0x0,-0x18(%rbp)
jmp    13d0 <main+0x220>
mov    $0x75,%edi
mov    $0x26,%esi
xor    %edx,%edx
call   1040 <__CrestBranch@plt>
mov    $0x78,%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x1,%edx
call   1090 <__CrestLoad@plt>
lea    -0x18(%rbp),%rsi
mov    $0x79,%edi
call   1050 <__CrestStore@plt>
movl   $0x1,-0x18(%rbp)
jmp    140e <main+0x25e>
mov    $0x6d,%edi
mov    $0x27,%esi
xor    %edx,%edx
call   1040 <__CrestBranch@plt>
mov    $0x7a,%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x1,%edx
call   1090 <__CrestLoad@plt>
lea    -0x18(%rbp),%rsi
mov    $0x7b,%edi
call   1050 <__CrestStore@plt>
movl   $0x1,-0x18(%rbp)
lea    -0x18(%rbp),%rsi
movslq -0x18(%rbp),%rdx
mov    $0x7c,%edi
call   1090 <__CrestLoad@plt>
mov    $0x7d,%edi
call   1060 <__CrestReturn@plt>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
xor    %eax,%eax
call   1070 <__globinit_primemod@plt>
mov    $0x60,%edi
mov    $0x5,%esi
call   1080 <__CrestCall@plt>
mov    $0x5491,%edx
mov    $0x61,%edi
xor    %esi,%esi
call   1090 <__CrestLoad@plt>
lea    0x14(%rsp),%r14
mov    $0x62,%edi
mov    %r14,%rsi
call   1050 <__CrestStore@plt>
movl   $0x5491,0x14(%rsp)
mov    $0x7d4d7,%edx
mov    $0x63,%edi
xor    %esi,%esi
call   1090 <__CrestLoad@plt>
lea    0x10(%rsp),%rbx
mov    $0x64,%edi
mov    %rbx,%rsi
call   1050 <__CrestStore@plt>
movl   $0x7d4d7,0x10(%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
call   10c0 <swap@plt>
mov    $0x65,%edi
call   10d0 <__CrestClearStack@plt>
movslq 0x14(%rsp),%rdx
mov    $0x66,%edi
mov    %r14,%rsi
call   1090 <__CrestLoad@plt>
mov    0x14(%rsp),%edi
call   10b0 <prime@plt>
mov    %eax,0xc(%rsp)
movslq %eax,%rsi
mov    $0x68,%edi
call   10a0 <__CrestHandleReturn@plt>
lea    0xc(%rsp),%rbx
mov    $0x67,%edi
mov    %rbx,%rsi
call   1050 <__CrestStore@plt>
movslq 0xc(%rsp),%rdx
mov    $0x6b,%edi
mov    %rbx,%rsi
call   1090 <__CrestLoad@plt>
mov    $0x6a,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1090 <__CrestLoad@plt>
xor    %edx,%edx
cmpl   $0x0,0xc(%rsp)
setne  %dl
mov    $0x69,%edi
mov    $0xd,%esi
call   1030 <__CrestApply2@plt>
cmpl   $0x0,0xc(%rsp)
je     138f <main+0x1df>
mov    $0x6c,%edi
mov    $0x23,%esi
mov    $0x1,%edx
call   1040 <__CrestBranch@plt>
movslq 0x10(%rsp),%rdx
lea    0x10(%rsp),%rsi
mov    $0x6e,%edi
call   1090 <__CrestLoad@plt>
mov    0x10(%rsp),%edi
call   10b0 <prime@plt>
mov    %eax,0x8(%rsp)
movslq %eax,%rsi
mov    $0x70,%edi
call   10a0 <__CrestHandleReturn@plt>
lea    0x8(%rsp),%rbx
mov    $0x6f,%edi
mov    %rbx,%rsi
call   1050 <__CrestStore@plt>
movslq 0x8(%rsp),%rdx
mov    $0x73,%edi
mov    %rbx,%rsi
call   1090 <__CrestLoad@plt>
mov    $0x72,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1090 <__CrestLoad@plt>
xor    %edx,%edx
cmpl   $0x0,0x8(%rsp)
setne  %dl
mov    $0x71,%edi
mov    $0xd,%esi
call   1030 <__CrestApply2@plt>
cmpl   $0x0,0x8(%rsp)
je     13c3 <main+0x213>
mov    $0x74,%edi
mov    $0x25,%esi
mov    $0x1,%edx
call   1040 <__CrestBranch@plt>
xor    %r14d,%r14d
mov    $0x76,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1090 <__CrestLoad@plt>
lea    0x4(%rsp),%rbx
mov    $0x77,%edi
mov    %rbx,%rsi
call   1050 <__CrestStore@plt>
movl   $0x0,0x4(%rsp)
jmp    1405 <main+0x255>
mov    $0x6d,%edi
mov    $0x27,%esi
xor    %edx,%edx
call   1040 <__CrestBranch@plt>
mov    $0x1,%r14d
mov    $0x1,%edx
mov    $0x7a,%edi
xor    %esi,%esi
call   1090 <__CrestLoad@plt>
lea    0x4(%rsp),%rbx
mov    $0x7b,%edi
jmp    13f5 <main+0x245>
mov    $0x75,%edi
mov    $0x26,%esi
xor    %edx,%edx
call   1040 <__CrestBranch@plt>
mov    $0x1,%r14d
mov    $0x1,%edx
mov    $0x78,%edi
xor    %esi,%esi
call   1090 <__CrestLoad@plt>
lea    0x4(%rsp),%rbx
mov    $0x79,%edi
mov    %rbx,%rsi
call   1050 <__CrestStore@plt>
movl   $0x1,0x4(%rsp)
mov    $0x7c,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1090 <__CrestLoad@plt>
mov    $0x7d,%edi
call   1060 <__CrestReturn@plt>
mov    0x4(%rsp),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (...) @__globinit_primemod()
%8 = call i32 @__CrestCall(i32 96, i32 5)
%9 = call i32 @__CrestLoad(i32 97, i64 0, i64 21649)
%10 = ptrtoint i32* %2 to i64
%11 = call i32 @__CrestStore(i32 98, i64 %10)
store i32 21649, i32* %2
%12 = call i32 @__CrestLoad(i32 99, i64 0, i64 513239)
%13 = ptrtoint i32* %3 to i64
%14 = call i32 @__CrestStore(i32 100, i64 %13)
store i32 513239, i32* %3
%15 = call i32 @swap(i32* %2, i32* %3)
%16 = call i32 @__CrestClearStack(i32 101)
%17 = ptrtoint i32* %2 to i64
%18 = load i32, i32* %2
%19 = sext i32 %18 to i64
%20 = call i32 @__CrestLoad(i32 102, i64 %17, i64 %19)
%21 = load i32, i32* %2
%22 = call i32 @prime(i32 %21)
store i32 %22, i32* %4
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = call i32 @__CrestHandleReturn(i32 104, i64 %24)
%26 = ptrtoint i32* %4 to i64
%27 = call i32 @__CrestStore(i32 103, i64 %26)
%28 = ptrtoint i32* %4 to i64
%29 = load i32, i32* %4
%30 = sext i32 %29 to i64
%31 = call i32 @__CrestLoad(i32 107, i64 %28, i64 %30)
%32 = call i32 @__CrestLoad(i32 106, i64 0, i64 0)
%33 = load i32, i32* %4
%34 = icmp ne i32 %33, 0
%35 = zext i1 %34 to i32
%36 = sext i32 %35 to i64
%37 = call i32 @__CrestApply2(i32 105, i32 13, i64 %36)
%38 = load i32, i32* %4
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %76
40: ; preds = %0
%41 = call i32 @__CrestBranch(i32 108, i32 35, i32 1)
%42 = ptrtoint i32* %3 to i64
%43 = load i32, i32* %3
%44 = sext i32 %43 to i64
%45 = call i32 @__CrestLoad(i32 110, i64 %42, i64 %44)
%46 = load i32, i32* %3
%47 = call i32 @prime(i32 %46)
store i32 %47, i32* %5
%48 = load i32, i32* %5
%49 = sext i32 %48 to i64
%50 = call i32 @__CrestHandleReturn(i32 112, i64 %49)
%51 = ptrtoint i32* %5 to i64
%52 = call i32 @__CrestStore(i32 111, i64 %51)
%53 = ptrtoint i32* %5 to i64
%54 = load i32, i32* %5
%55 = sext i32 %54 to i64
%56 = call i32 @__CrestLoad(i32 115, i64 %53, i64 %55)
%57 = call i32 @__CrestLoad(i32 114, i64 0, i64 0)
%58 = load i32, i32* %5
%59 = icmp ne i32 %58, 0
%60 = zext i1 %59 to i32
%61 = sext i32 %60 to i64
%62 = call i32 @__CrestApply2(i32 113, i32 13, i64 %61)
%63 = load i32, i32* %5
%64 = icmp ne i32 %63, 0
br i1 %64, label %65, label %70
65: ; preds = %40
%66 = call i32 @__CrestBranch(i32 116, i32 37, i32 1)
%67 = call i32 @__CrestLoad(i32 118, i64 0, i64 0)
%68 = ptrtoint i32* %6 to i64
%69 = call i32 @__CrestStore(i32 119, i64 %68)
store i32 0, i32* %6
br label %75
70: ; preds = %40
%71 = call i32 @__CrestBranch(i32 117, i32 38, i32 0)
%72 = call i32 @__CrestLoad(i32 120, i64 0, i64 1)
%73 = ptrtoint i32* %6 to i64
%74 = call i32 @__CrestStore(i32 121, i64 %73)
store i32 1, i32* %6
br label %75
75: ; preds = %70, %65
br label %81
76: ; preds = %0
%77 = call i32 @__CrestBranch(i32 109, i32 39, i32 0)
%78 = call i32 @__CrestLoad(i32 122, i64 0, i64 1)
%79 = ptrtoint i32* %6 to i64
%80 = call i32 @__CrestStore(i32 123, i64 %79)
store i32 1, i32* %6
br label %81
81: ; preds = %76, %75
%82 = ptrtoint i32* %6 to i64
%83 = load i32, i32* %6
%84 = sext i32 %83 to i64
%85 = call i32 @__CrestLoad(i32 124, i64 %82, i64 %84)
%86 = call i32 @__CrestReturn(i32 125)
%87 = load i32, i32* %6
ret i32 %87
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = tail call i32 (...) @__globinit_primemod()
%12 = tail call i32 @__CrestCall(i32 96, i32 5)
%13 = tail call i32 @__CrestLoad(i32 97, i64 0, i64 21649)
%14 = ptrtoint i32* %1 to i64
%15 = call i32 @__CrestStore(i32 98, i64 %14)
store i32 21649, i32* %1
%16 = call i32 @__CrestLoad(i32 99, i64 0, i64 513239)
%17 = ptrtoint i32* %2 to i64
%18 = call i32 @__CrestStore(i32 100, i64 %17)
store i32 513239, i32* %2
%19 = call i32 @swap(i32* %1, i32* %2)
%20 = call i32 @__CrestClearStack(i32 101)
%21 = load i32, i32* %1
%22 = sext i32 %21 to i64
%23 = call i32 @__CrestLoad(i32 102, i64 %14, i64 %22)
%24 = load i32, i32* %1
%25 = call i32 @prime(i32 %24)
store i32 %25, i32* %3
%26 = sext i32 %25 to i64
%27 = call i32 @__CrestHandleReturn(i32 104, i64 %26)
%28 = ptrtoint i32* %3 to i64
%29 = call i32 @__CrestStore(i32 103, i64 %28)
%30 = load i32, i32* %3
%31 = sext i32 %30 to i64
%32 = call i32 @__CrestLoad(i32 107, i64 %28, i64 %31)
%33 = call i32 @__CrestLoad(i32 106, i64 0, i64 0)
%34 = load i32, i32* %3
%35 = icmp ne i32 %34, 0
%36 = zext i1 %35 to i64
%37 = call i32 @__CrestApply2(i32 105, i32 13, i64 %36)
%38 = load i32, i32* %3
%39 = icmp eq i32 %38, 0
br i1 %39, label %71, label %40
40: ; preds = %0
%41 = call i32 @__CrestBranch(i32 108, i32 35, i32 1)
%42 = load i32, i32* %2
%43 = sext i32 %42 to i64
%44 = call i32 @__CrestLoad(i32 110, i64 %17, i64 %43)
%45 = load i32, i32* %2
%46 = call i32 @prime(i32 %45)
store i32 %46, i32* %4
%47 = sext i32 %46 to i64
%48 = call i32 @__CrestHandleReturn(i32 112, i64 %47)
%49 = ptrtoint i32* %4 to i64
%50 = call i32 @__CrestStore(i32 111, i64 %49)
%51 = load i32, i32* %4
%52 = sext i32 %51 to i64
%53 = call i32 @__CrestLoad(i32 115, i64 %49, i64 %52)
%54 = call i32 @__CrestLoad(i32 114, i64 0, i64 0)
%55 = load i32, i32* %4
%56 = icmp ne i32 %55, 0
%57 = zext i1 %56 to i64
%58 = call i32 @__CrestApply2(i32 113, i32 13, i64 %57)
%59 = load i32, i32* %4
%60 = icmp eq i32 %59, 0
br i1 %60, label %66, label %61
61: ; preds = %40
%62 = call i32 @__CrestBranch(i32 116, i32 37, i32 1)
%63 = call i32 @__CrestLoad(i32 118, i64 0, i64 0)
%64 = ptrtoint i32* %5 to i64
%65 = call i32 @__CrestStore(i32 119, i64 %64)
store i32 0, i32* %5
br label %76
66: ; preds = %40
%67 = call i32 @__CrestBranch(i32 117, i32 38, i32 0)
%68 = call i32 @__CrestLoad(i32 120, i64 0, i64 1)
%69 = ptrtoint i32* %5 to i64
%70 = call i32 @__CrestStore(i32 121, i64 %69)
store i32 1, i32* %5
br label %76
71: ; preds = %0
%72 = call i32 @__CrestBranch(i32 109, i32 39, i32 0)
%73 = call i32 @__CrestLoad(i32 122, i64 0, i64 1)
%74 = ptrtoint i32* %5 to i64
%75 = call i32 @__CrestStore(i32 123, i64 %74)
store i32 1, i32* %5
br label %76
76: ; preds = %61, %66, %71
%77 = phi i64 [ %64, %61 ], [ %69, %66 ], [ %74, %71 ]
%78 = phi i64 [ 0, %61 ], [ 1, %66 ], [ 1, %71 ]
%79 = call i32 @__CrestLoad(i32 124, i64 %77, i64 %78)
%80 = call i32 @__CrestReturn(i32 125)
%81 = load i32, i32* %5
ret i32 %81
}