#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*/ __CrestCall(int, 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 _divides(int, int);
int even(int n) {
  int tmp;
  {
    __CrestCall(13, 2);
    __CrestStore(12, (unsigned long)(&n));
    __CrestLoad(14, (unsigned long)0, (long long)2);
    __CrestLoad(15, (unsigned long)(&n), (long long)n);
    tmp = _divides(2, n);
    __CrestHandleReturn(17, (long long)tmp);
    __CrestStore(16, (unsigned long)(&tmp));
    {
      __CrestLoad(18, (unsigned long)(&tmp), (long long)tmp);
      __CrestReturn(19);
      return (tmp);
    }
  }
}


x86 assembly (clang, -O0):
<even>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0xd,%edi
mov    $0x2,%esi
call   1060 <__CrestCall@plt>
lea    -0x4(%rbp),%rsi
mov    $0xc,%edi
call   1040 <__CrestStore@plt>
mov    $0xe,%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x2,%edx
call   1070 <__CrestLoad@plt>
lea    -0x4(%rbp),%rsi
movslq -0x4(%rbp),%rdx
mov    $0xf,%edi
call   1070 <__CrestLoad@plt>
mov    -0x4(%rbp),%esi
mov    $0x2,%edi
call   1030 <_divides@plt>
mov    %eax,-0x8(%rbp)
movslq -0x8(%rbp),%rsi
mov    $0x11,%edi
call   1080 <__CrestHandleReturn@plt>
lea    -0x8(%rbp),%rsi
mov    $0x10,%edi
call   1040 <__CrestStore@plt>
lea    -0x8(%rbp),%rsi
movslq -0x8(%rbp),%rdx
mov    $0x12,%edi
call   1070 <__CrestLoad@plt>
mov    $0x13,%edi
call   1050 <__CrestReturn@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<even>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,0xc(%rsp)
mov    $0xd,%edi
mov    $0x2,%esi
call   1060 <__CrestCall@plt>
lea    0xc(%rsp),%rbx
mov    $0xc,%edi
mov    %rbx,%rsi
call   1040 <__CrestStore@plt>
mov    $0x2,%edx
mov    $0xe,%edi
xor    %esi,%esi
call   1070 <__CrestLoad@plt>
movslq 0xc(%rsp),%rdx
mov    $0xf,%edi
mov    %rbx,%rsi
call   1070 <__CrestLoad@plt>
mov    0xc(%rsp),%esi
mov    $0x2,%edi
call   1030 <_divides@plt>
mov    %eax,0x8(%rsp)
movslq %eax,%rsi
mov    $0x11,%edi
call   1080 <__CrestHandleReturn@plt>
lea    0x8(%rsp),%rbx
mov    $0x10,%edi
mov    %rbx,%rsi
call   1040 <__CrestStore@plt>
movslq 0x8(%rsp),%rdx
mov    $0x12,%edi
mov    %rbx,%rsi
call   1070 <__CrestLoad@plt>
mov    $0x13,%edi
call   1050 <__CrestReturn@plt>
mov    0x8(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @even(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 @__CrestCall(i32 13, i32 2)
%5 = ptrtoint i32* %2 to i64
%6 = call i32 @__CrestStore(i32 12, i64 %5)
%7 = call i32 @__CrestLoad(i32 14, i64 0, i64 2)
%8 = ptrtoint i32* %2 to i64
%9 = load i32, i32* %2
%10 = sext i32 %9 to i64
%11 = call i32 @__CrestLoad(i32 15, i64 %8, i64 %10)
%12 = load i32, i32* %2
%13 = call i32 @_divides(i32 2, i32 %12)
store i32 %13, i32* %3
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = call i32 @__CrestHandleReturn(i32 17, i64 %15)
%17 = ptrtoint i32* %3 to i64
%18 = call i32 @__CrestStore(i32 16, i64 %17)
%19 = ptrtoint i32* %3 to i64
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = call i32 @__CrestLoad(i32 18, i64 %19, i64 %21)
%23 = call i32 @__CrestReturn(i32 19)
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @even(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @__CrestCall(i32 13, i32 2)
%6 = ptrtoint i32* %2 to i64
%7 = call i32 @__CrestStore(i32 12, i64 %6)
%8 = call i32 @__CrestLoad(i32 14, i64 0, i64 2)
%9 = load i32, i32* %2
%10 = sext i32 %9 to i64
%11 = call i32 @__CrestLoad(i32 15, i64 %6, i64 %10)
%12 = load i32, i32* %2
%13 = call i32 @_divides(i32 2, i32 %12)
store i32 %13, i32* %3
%14 = sext i32 %13 to i64
%15 = call i32 @__CrestHandleReturn(i32 17, i64 %14)
%16 = ptrtoint i32* %3 to i64
%17 = call i32 @__CrestStore(i32 16, i64 %16)
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = call i32 @__CrestLoad(i32 18, i64 %16, i64 %19)
%21 = call i32 @__CrestReturn(i32 19)
%22 = load i32, i32* %3
ret i32 %22
}