#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 */
struct Cyc_AP_T {
  int dummy;
};

/* Variables and functions */
int Cyc_AP_cmp(struct Cyc_AP_T *, struct Cyc_AP_T *);
struct Cyc_AP_T *Cyc_mk(int);
struct Cyc_AP_T *Cyc_set(struct Cyc_AP_T *, long);
int Cyc_AP_cmpi(struct Cyc_AP_T *x, long y) {
  unsigned _T0;
  int _T1;
  struct Cyc_AP_T *_T2;
  struct Cyc_AP_T *_T3;
  int _T4;
  _T0 = sizeof(unsigned long) / sizeof(unsigned char);
  _T1 = (int)_T0;
  {
    struct Cyc_AP_T *t = Cyc_mk(_T1);
    _T2 = x;
    _T3 = Cyc_set(t, y);
    _T4 = Cyc_AP_cmp(_T2, _T3);
    return _T4;
  }
}


x86 assembly (clang, -O0):
<Cyc_AP_cmpi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x8,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1050 <Cyc_mk@plt>
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <Cyc_set@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <Cyc_AP_cmp@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cyc_AP_cmpi>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    $0x8,%edi
call   1050 <Cyc_mk@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
call   1030 <Cyc_set@plt>
mov    %r14,%rdi
mov    %rax,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <Cyc_AP_cmp@plt>

LLVM IR (-O0):
%struct.Cyc_AP_T = type { i32 }
define i32 @Cyc_AP_cmpi(%struct.Cyc_AP_T* %0, i64 %1) {
%3 = alloca %struct.Cyc_AP_T*
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
%7 = alloca %struct.Cyc_AP_T*
%8 = alloca %struct.Cyc_AP_T*
%9 = alloca i32
%10 = alloca %struct.Cyc_AP_T*
store %struct.Cyc_AP_T* %0, %struct.Cyc_AP_T** %3
store i64 %1, i64* %4
store i32 8, i32* %5
%11 = load i32, i32* %5
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = call %struct.Cyc_AP_T* @Cyc_mk(i32 %12)
store %struct.Cyc_AP_T* %13, %struct.Cyc_AP_T** %10
%14 = load %struct.Cyc_AP_T*, %struct.Cyc_AP_T** %3
store %struct.Cyc_AP_T* %14, %struct.Cyc_AP_T** %7
%15 = load %struct.Cyc_AP_T*, %struct.Cyc_AP_T** %10
%16 = load i64, i64* %4
%17 = call %struct.Cyc_AP_T* @Cyc_set(%struct.Cyc_AP_T* %15, i64 %16)
store %struct.Cyc_AP_T* %17, %struct.Cyc_AP_T** %8
%18 = load %struct.Cyc_AP_T*, %struct.Cyc_AP_T** %7
%19 = load %struct.Cyc_AP_T*, %struct.Cyc_AP_T** %8
%20 = call i32 @Cyc_AP_cmp(%struct.Cyc_AP_T* %18, %struct.Cyc_AP_T* %19)
store i32 %20, i32* %9
%21 = load i32, i32* %9
ret i32 %21
}

LLVM IR (-O2):
%struct.Cyc_AP_T = type { i32 }
define i32 @Cyc_AP_cmpi(%struct.Cyc_AP_T* %0, i64 %1) {
%3 = tail call %struct.Cyc_AP_T* @Cyc_mk(i32 8)
%4 = tail call %struct.Cyc_AP_T* @Cyc_set(%struct.Cyc_AP_T* %3, i64 %1)
%5 = tail call i32 @Cyc_AP_cmp(%struct.Cyc_AP_T* %0, %struct.Cyc_AP_T* %4)
ret i32 %5
}