xunge/DecIR huggingface dataset:
int incIdx(int x, int y) {
  x += 1;
  if (x >= y)
    x = 0;
  return x;
}


x86 assembly (clang, -O0):
<incIdx>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     1126 <incIdx+0x26>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<incIdx>:
lea    0x1(%rdi),%ecx
xor    %eax,%eax
cmp    %esi,%ecx
cmovl  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @incIdx(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = add nsw i32 %5, 1
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = icmp sge i32 %7, %8
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 0, i32* %3
br label %11
11: ; preds = %10, %2
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
define i32 @incIdx(i32 %0, i32 %1) {
%3 = add nsw i32 %0, 1
%4 = icmp slt i32 %3, %1
%5 = select i1 %4, i32 %3, i32 0
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ RamWrite32A(int, int);
unsigned char RdStatus(int);
void OisDis(void) {
  unsigned char UcStRd = 1;
  RamWrite32A(0xF012, 0x00000000);
  while (UcStRd) {
    UcStRd = RdStatus(1);
  }
}


x86 assembly (clang, -O0):
<OisDis>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x1,-0x1(%rbp)
mov    $0xf012,%edi
xor    %esi,%esi
call   1030 <RamWrite32A@plt>
cmpb   $0x0,-0x1(%rbp)
je     1154 <OisDis+0x34>
mov    $0x1,%edi
call   1040 <RdStatus@plt>
mov    %al,-0x1(%rbp)
jmp    1138 <OisDis+0x18>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OisDis>:
push   %rax
mov    $0xf012,%edi
xor    %esi,%esi
call   1030 <RamWrite32A@plt>
nopl   (%rax)
mov    $0x1,%edi
call   1040 <RdStatus@plt>
test   %al,%al
jne    1130 <OisDis+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @OisDis() {
%1 = alloca i8
store i8 1, i8* %1
%2 = call i32 @RamWrite32A(i32 61458, i32 0)
br label %3
3: ; preds = %6, %0
%4 = load i8, i8* %1
%5 = icmp ne i8 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = call zeroext i8 @RdStatus(i32 1)
store i8 %7, i8* %1
br label %3
8: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @OisDis() {
%1 = tail call i32 @RamWrite32A(i32 61458, i32 0)
br label %2
2: ; preds = %0, %2
%3 = tail call zeroext i8 @RdStatus(i32 1)
%4 = icmp eq i8 %3, 0
br i1 %4, label %5, label %2
5: ; preds = %2
ret void
}
unsigned int cpuid_edx(unsigned int fn) {
  unsigned int eax, ebx, ecx, edx;
  asm("cpuid" : "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx) : "0"(fn));
  return edx;
}


x86 assembly (clang, -O0):
<cpuid_edx>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cpuid
mov    %eax,-0x10(%rbp)
mov    %ebx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpuid_edx>:
push   %rbx
mov    %edi,%eax
cpuid
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @cpuid_edx(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %2
%7 = load i32, i32* %2
%8 = call { i32, i32, i32, i32 } asm "cpuid", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %7)
%9 = extractvalue { i32, i32, i32, i32 } %8, 0
%10 = extractvalue { i32, i32, i32, i32 } %8, 1
%11 = extractvalue { i32, i32, i32, i32 } %8, 2
%12 = extractvalue { i32, i32, i32, i32 } %8, 3
store i32 %9, i32* %3
store i32 %10, i32* %4
store i32 %11, i32* %5
store i32 %12, i32* %6
%13 = load i32, i32* %6
ret i32 %13
}

LLVM IR (-O2):
define i32 @cpuid_edx(i32 %0) {
%2 = tail call { i32, i32, i32, i32 } asm "cpuid", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %0)
%3 = extractvalue { i32, i32, i32, i32 } %2, 3
ret i32 %3
}
extern void vscp_app_reg_restoreFactoryDefaultSettings(void) { return; }


x86 assembly (clang, -O0):
<vscp_app_reg_restoreFactoryDefaultSettings>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vscp_app_reg_restoreFactoryDefaultSettings>:
ret

LLVM IR (-O0):
define void @vscp_app_reg_restoreFactoryDefaultSettings() {
ret void
}

LLVM IR (-O2):
define void @vscp_app_reg_restoreFactoryDefaultSettings() {
ret void
}
void EC_GROUP_new_curve_GF2m(void) {}


x86 assembly (clang, -O0):
<EC_GROUP_new_curve_GF2m>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EC_GROUP_new_curve_GF2m>:
ret

LLVM IR (-O0):
define void @EC_GROUP_new_curve_GF2m() {
ret void
}

LLVM IR (-O2):
define void @EC_GROUP_new_curve_GF2m() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ReceiverActivityHandle();
int /*<<< orphan*/ UAVObjRequestUpdate(int /*<<< orphan*/);
void ReceiverActivityRequestUpdate() {
  UAVObjRequestUpdate(ReceiverActivityHandle());
}


x86 assembly (clang, -O0):
<ReceiverActivityRequestUpdate>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <ReceiverActivityHandle@plt>
mov    %eax,%edi
call   1040 <UAVObjRequestUpdate@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReceiverActivityRequestUpdate>:
push   %rax
xor    %eax,%eax
call   1030 <ReceiverActivityHandle@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <UAVObjRequestUpdate@plt>

LLVM IR (-O0):
define void @ReceiverActivityRequestUpdate() {
%1 = call i32 (...) @ReceiverActivityHandle()
%2 = call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}

LLVM IR (-O2):
define void @ReceiverActivityRequestUpdate() {
%1 = tail call i32 (...) @ReceiverActivityHandle()
%2 = tail call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}
/* Type definitions */
typedef double *__m128d;

/* Variables and functions */
double __attribute__((__always___, __nodebug__)) _mm_cvtsd_f64(__m128d a) {
  return a[0];
}


x86 assembly (clang, -O0):
<_mm_cvtsd_f64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<_mm_cvtsd_f64>:
movsd  (%rdi),%xmm0
ret

LLVM IR (-O0):
define double @_mm_cvtsd_f64(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = getelementptr inbounds double, double* %3, i64 0
%5 = load double, double* %4
ret double %5
}

LLVM IR (-O2):
define double @_mm_cvtsd_f64(double* nocapture %0) {
%2 = load double, double* %0
ret double %2
}
void fff_memset(void *ptr, int value, int num) {
  int i;
  char *p = (char *)ptr;
  for (i = 0; i < num; i++, p++)
    *p = value;
}


x86 assembly (clang, -O0):
<fff_memset>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    114e <fff_memset+0x4e>
mov    -0xc(%rbp),%eax
mov    %al,%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    111d <fff_memset+0x1d>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fff_memset>:
test   %edx,%edx
jle    1120 <fff_memset+0x10>
push   %rax
mov    %edx,%edx
call   1030 <memset@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define void @fff_memset(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i8*, i8** %4
store i8* %9, i8** %8
store i32 0, i32* %7
br label %10
10: ; preds = %18, %3
%11 = load i32, i32* %7
%12 = load i32, i32* %6
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %23
14: ; preds = %10
%15 = load i32, i32* %5
%16 = trunc i32 %15 to i8
%17 = load i8*, i8** %8
store i8 %16, i8* %17
br label %18
18: ; preds = %14
%19 = load i32, i32* %7
%20 = add nsw i32 %19, 1
store i32 %20, i32* %7
%21 = load i8*, i8** %8
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %8
br label %10
23: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @fff_memset(i8* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = trunc i32 %1 to i8
%7 = zext i32 %2 to i64
br label %8
8: ; preds = %5, %3
ret void
}
/* Type definitions */
struct _Locale_collate {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ strncpy(char *, char const *, size_t);
size_t _Locale_strxfrm(struct _Locale_collate *lcol __attribute__((__unused__)),
                       char *dest, size_t dest_n, const char *src,
                       size_t src_n) {
  if (dest != 0) {
    strncpy(dest, src, dest_n - 1);
    dest[dest_n - 1] = 0;
  }
  return src_n;
}


x86 assembly (clang, -O0):
<_Locale_strxfrm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     115c <_Locale_strxfrm+0x4c>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
sub    $0x1,%rdx
call   1030 <strncpy@plt>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_Locale_strxfrm>:
push   %r15
push   %r14
push   %rbx
mov    %r8,%r14
test   %rsi,%rsi
je     1138 <_Locale_strxfrm+0x28>
mov    %rdx,%r15
mov    %rsi,%rbx
add    $0xffffffffffffffff,%rdx
mov    %rsi,%rdi
mov    %rcx,%rsi
call   1030 <strncpy@plt>
movb   $0x0,-0x1(%rbx,%r15,1)
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct._Locale_collate = type { i32 }
define i64 @_Locale_strxfrm(%struct._Locale_collate* %0, i8* %1, i64 %2, i8* %3, i64 %4) {
%6 = alloca %struct._Locale_collate*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i64
store %struct._Locale_collate* %0, %struct._Locale_collate** %6
store i8* %1, i8** %7
store i64 %2, i64* %8
store i8* %3, i8** %9
store i64 %4, i64* %10
%11 = load i8*, i8** %7
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %23
13: ; preds = %5
%14 = load i8*, i8** %7
%15 = load i8*, i8** %9
%16 = load i64, i64* %8
%17 = sub i64 %16, 1
%18 = call i32 @strncpy(i8* %14, i8* %15, i64 %17)
%19 = load i8*, i8** %7
%20 = load i64, i64* %8
%21 = sub i64 %20, 1
%22 = getelementptr inbounds i8, i8* %19, i64 %21
store i8 0, i8* %22
br label %23
23: ; preds = %13, %5
%24 = load i64, i64* %10
ret i64 %24
}

LLVM IR (-O2):
%struct._Locale_collate = type { i32 }
define i64 @_Locale_strxfrm(%struct._Locale_collate* nocapture readnone %0, i8* %1, i64 %2, i8* %3, i64 returned %4) {
%6 = icmp eq i8* %1, null
br i1 %6, label %11, label %7
7: ; preds = %5
%8 = add i64 %2, -1
%9 = tail call i32 @strncpy(i8* %1, i8* %3, i64 %8)
%10 = getelementptr inbounds i8, i8* %1, i64 %8
store i8 0, i8* %10
br label %11
11: ; preds = %7, %5
ret i64 %4
}
/* Variables and functions */
char parity(unsigned short, int, int);
char data_parity(unsigned short int data) { return parity(data, 14, 1); }


x86 assembly (clang, -O0):
<data_parity>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    $0xe,%esi
mov    $0x1,%edx
movzwl -0x2(%rbp),%edi
call   1030 <parity@plt>
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<data_parity>:
mov    $0xe,%esi
mov    $0x1,%edx
jmp    1030 <parity@plt>

LLVM IR (-O0):
define signext i8 @data_parity(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = call signext i8 @parity(i16 zeroext %3, i32 14, i32 1)
ret i8 %4
}

LLVM IR (-O2):
define signext i8 @data_parity(i16 zeroext %0) {
%2 = tail call signext i8 @parity(i16 zeroext %0, i32 14, i32 1)
ret i8 %2
}
/* Variables and functions */
char *internal_duplicate_max(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ trio_length(char const *);
__attribute__((visibility("default"))) char *
trio_duplicate(const char *source) {
  return internal_duplicate_max(source, trio_length(source));
}


x86 assembly (clang, -O0):
<trio_duplicate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <trio_length@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%esi
call   1030 <internal_duplicate_max@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trio_duplicate>:
push   %rbx
mov    %rdi,%rbx
call   1040 <trio_length@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1030 <internal_duplicate_max@plt>

LLVM IR (-O0):
define i8* @trio_duplicate(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @trio_length(i8* %4)
%6 = call i8* @internal_duplicate_max(i8* %3, i32 %5)
ret i8* %6
}

LLVM IR (-O2):
define i8* @trio_duplicate(i8* %0) {
%2 = tail call i32 @trio_length(i8* %0)
%3 = tail call i8* @internal_duplicate_max(i8* %0, i32 %2)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ rct_set_usb_ana_on();
int /*<<< orphan*/ rct_set_usb_phy_pll();
int /*<<< orphan*/ udelay(int);
void _init_usb_pll(void) {
  rct_set_usb_phy_pll();
  rct_set_usb_ana_on();
  udelay(150);
}


x86 assembly (clang, -O0):
<_init_usb_pll>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <rct_set_usb_phy_pll@plt>
mov    $0x0,%al
call   1030 <rct_set_usb_ana_on@plt>
mov    $0x96,%edi
call   1050 <udelay@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<_init_usb_pll>:
push   %rax
xor    %eax,%eax
call   1040 <rct_set_usb_phy_pll@plt>
xor    %eax,%eax
call   1030 <rct_set_usb_ana_on@plt>
mov    $0x96,%edi
pop    %rax
jmp    1050 <udelay@plt>

LLVM IR (-O0):
define void @_init_usb_pll() {
%1 = call i32 (...) @rct_set_usb_phy_pll()
%2 = call i32 (...) @rct_set_usb_ana_on()
%3 = call i32 @udelay(i32 150)
ret void
}

LLVM IR (-O2):
define void @_init_usb_pll() {
%1 = tail call i32 (...) @rct_set_usb_phy_pll()
%2 = tail call i32 (...) @rct_set_usb_ana_on()
%3 = tail call i32 @udelay(i32 150)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void fun(void) { printf("hoho\n"); }


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"hoho\0A\00"
define void @fun() {
%1 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [5 x i8] c"hoho\00"
define void @fun() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret void
}
void func1() { printf("\n%s\n", __func__); }


x86 assembly (clang, -O0):
<func1>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<func1>:
lea    0xee9(%rip),%rdi
lea    0xee7(%rip),%rsi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"\0A%s\0A\00"
@__func__.func1 = [6 x i8] c"func1\00"
define void @func1() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @__func__.func1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"\0A%s\0A\00"
@__func__.func1 = [6 x i8] c"func1\00"
define void @func1() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @__func__.func1, i64 0, i64 0))
ret void
}
unsigned char getch(void) { return 0; }


x86 assembly (clang, -O0):
<getch>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getch>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define zeroext i8 @getch() {
ret i8 0
}

LLVM IR (-O2):
define zeroext i8 @getch() {
ret i8 0
}
/* Variables and functions */
int /*<<< orphan*/ esc(char *);
int /*<<< orphan*/ padding(int);
void vt52el(void) {
  esc("K");
  padding(5);
}


x86 assembly (clang, -O0):
<vt52el>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <esc@plt>
mov    $0x5,%edi
call   1030 <padding@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<vt52el>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <esc@plt>
mov    $0x5,%edi
pop    %rax
jmp    1030 <padding@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"K\00"
define void @vt52el() {
%1 = call i32 @esc(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @padding(i32 5)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"K\00"
define void @vt52el() {
%1 = tail call i32 @esc(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @padding(i32 5)
ret void
}
/* Variables and functions */
int StdBar10(int, int, int, int, int, int, int /*<<< orphan*/, int, int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int sum;
  sum = StdBar10(6, 2, 4, 8, 1, 9, 0, 7, 3, 5);
  printf(" main: sum=%d\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x6,%edi
mov    $0x2,%esi
mov    $0x4,%edx
mov    $0x8,%ecx
mov    $0x1,%r8d
mov    $0x9,%r9d
xor    %eax,%eax
movl   $0x0,(%rsp)
movl   $0x7,0x8(%rsp)
movl   $0x3,0x10(%rsp)
movl   $0x5,0x18(%rsp)
call   1040 <StdBar10@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x6,%edi
mov    $0x2,%esi
mov    $0x4,%edx
mov    $0x8,%ecx
mov    $0x1,%r8d
mov    $0x9,%r9d
push   $0x5
push   $0x3
push   $0x7
push   $0x0
call   1040 <StdBar10@plt>
add    $0x20,%rsp
lea    0xea7(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c" main: sum=%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @StdBar10(i32 6, i32 2, i32 4, i32 8, i32 1, i32 9, i32 0, i32 7, i32 3, i32 5)
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c" main: sum=%d\0A\00"
define i32 @main() {
%1 = tail call i32 @StdBar10(i32 6, i32 2, i32 4, i32 8, i32 1, i32 9, i32 0, i32 7, i32 3, i32 5)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
int main(void) { return (10 != 10) + (20 != 20) + (20 != 10); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
ret i32 1
}

LLVM IR (-O2):
define i32 @main() {
ret i32 1
}
void testClosureDSDrV(void (*closure)(double, short, double), double a1,
                      short a2, double a3) {
  (*closure)(a1, a2, a3);
}


x86 assembly (clang, -O0):
<testClosureDSDrV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %ax,-0x12(%rbp)
movsd  %xmm1,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  -0x10(%rbp),%xmm0
mov    -0x12(%rbp),%cx
movsd  -0x20(%rbp),%xmm1
movswl %cx,%edi
call   *%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testClosureDSDrV>:
mov    %rdi,%rax
mov    %esi,%edi
jmp    *%rax

LLVM IR (-O0):
define void @testClosureDSDrV(void (double, i16, double)* %0, double %1, i16 signext %2, double %3) {
%5 = alloca void (double, i16, double)*
%6 = alloca double
%7 = alloca i16
%8 = alloca double
store void (double, i16, double)* %0, void (double, i16, double)** %5
store double %1, double* %6
store i16 %2, i16* %7
store double %3, double* %8
%9 = load void (double, i16, double)*, void (double, i16, double)** %5
%10 = load double, double* %6
%11 = load i16, i16* %7
%12 = load double, double* %8
ret void
}

LLVM IR (-O2):
define void @testClosureDSDrV(void (double, i16, double)* nocapture %0, double %1, i16 signext %2, double %3) {
tail call void %0(double %1, i16 signext %2, double %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int middle(int arr[], int lb, int ub) {
  assert(arr != NULL && lb <= ub);
  return lb < ub ? (lb + ub - 1) / 2 : -1;
}


x86 assembly (clang, -O0):
<middle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x11(%rbp)
je     113e <middle+0x2e>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
setle  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1170 <middle+0x60>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
sub    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
jmp    117d <middle+0x6d>
mov    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    117d <middle+0x6d>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<middle>:
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%ebx
test   %rdi,%rdi
setne  %al
cmp    %edx,%esi
setle  %cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
mov    $0xffffffff,%eax
cmp    %r14d,%ebx
jge    114d <middle+0x3d>
lea    (%rbx,%r14,1),%eax
lea    (%rbx,%r14,1),%ecx
add    $0xffffffff,%ecx
shr    $0x1f,%ecx
add    %ecx,%eax
add    $0xffffffff,%eax
sar    %eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @middle(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = icmp ne i32* %7, null
br i1 %8, label %9, label %13
9: ; preds = %3
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = icmp sle i32 %10, %11
br label %13
13: ; preds = %9, %3
%14 = phi i1 [ false, %3 ], [ %12, %9 ]
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = load i32, i32* %5
%18 = load i32, i32* %6
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %26
20: ; preds = %13
%21 = load i32, i32* %5
%22 = load i32, i32* %6
%23 = add nsw i32 %21, %22
%24 = sub nsw i32 %23, 1
%25 = sdiv i32 %24, 2
br label %27
26: ; preds = %13
br label %27
27: ; preds = %26, %20
%28 = phi i32 [ %25, %20 ], [ -1, %26 ]
ret i32 %28
}

LLVM IR (-O2):
define i32 @middle(i32* readnone %0, i32 %1, i32 %2) {
%4 = icmp ne i32* %0, null
%5 = icmp sle i32 %1, %2
%6 = and i1 %4, %5
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = icmp slt i32 %1, %2
br i1 %9, label %10, label %14
10: ; preds = %3
%11 = add i32 %1, -1
%12 = add i32 %11, %2
%13 = sdiv i32 %12, 2
br label %14
14: ; preds = %3, %10
%15 = phi i32 [ %13, %10 ], [ -1, %3 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ FE_ALL_EXCEPT;
int /*<<< orphan*/ abort();
scalar_t__ errno;
scalar_t__ fetestexcept(int /*<<< orphan*/);
void check_quiet_nan(int flags __attribute__((unused))) {
  if (fetestexcept(FE_ALL_EXCEPT))
    abort();
  if (errno)
    abort();
}


x86 assembly (clang, -O0):
<check_quiet_nan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
call   1030 <fetestexcept@plt>
cmp    $0x0,%rax
je     114a <check_quiet_nan+0x2a>
mov    $0x0,%al
call   1040 <abort@plt>
mov    0x2e8f(%rip),%rax
cmpq   $0x0,(%rax)
je     1162 <check_quiet_nan+0x42>
mov    $0x0,%al
call   1040 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_quiet_nan>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
call   1030 <fetestexcept@plt>
test   %rax,%rax
jne    1143 <check_quiet_nan+0x23>
mov    0x2ea5(%rip),%rax
cmpq   $0x0,(%rax)
jne    1143 <check_quiet_nan+0x23>
pop    %rax
ret
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
@FE_ALL_EXCEPT = global i32 0
@errno = global i64 0
define void @check_quiet_nan(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @FE_ALL_EXCEPT
%4 = call i64 @fetestexcept(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %1
%9 = load i64, i64* @errno
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 (...) @abort()
unreachable
13: ; preds = %8
ret void
}

LLVM IR (-O2):
@FE_ALL_EXCEPT = global i32 0
@errno = global i64 0
define void @check_quiet_nan(i32 %0) {
%2 = load i32, i32* @FE_ALL_EXCEPT
%3 = tail call i64 @fetestexcept(i32 %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 (...) @abort()
unreachable
7: ; preds = %1
%8 = load i64, i64* @errno
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = tail call i32 (...) @abort()
unreachable
12: ; preds = %7
ret void
}
gotoXY(x, y) short x, y;
{ printf("\n"); }


x86 assembly (clang, -O0):
<gotoXY>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%cx
mov    %si,%ax
mov    %cx,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gotoXY>:
mov    $0xa,%edi
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define i32 @gotoXY(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i16
%5 = alloca i16
%6 = trunc i32 %0 to i16
%7 = trunc i32 %1 to i16
store i16 %6, i16* %4
store i16 %7, i16* %5
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @gotoXY(i32 %0, i32 %1) {
%3 = tail call i32 @putchar(i32 10)
ret i32 undef
}
/* Variables and functions */
short strlen(char *);
void clean_text(char text[], short int size) {
  short int i = 0;
  short int len = 0;
  len = strlen(text);
  for (i = 0; i < size; ++i) {
    text[i] = 0;
  };
}


x86 assembly (clang, -O0):
<clean_text>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
movw   $0x0,-0xc(%rbp)
movw   $0x0,-0xe(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %ax,-0xe(%rbp)
movw   $0x0,-0xc(%rbp)
movswl -0xc(%rbp),%eax
movswl -0xa(%rbp),%ecx
cmp    %ecx,%eax
jge    1170 <clean_text+0x60>
mov    -0x8(%rbp),%rax
movswq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0xc(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0xc(%rbp)
jmp    1142 <clean_text+0x32>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clean_text>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <strlen@plt>
test   %bp,%bp
jle    113f <clean_text+0x1f>
movzwl %bp,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @clean_text(i8* %0, i16 signext %1) {
%3 = alloca i8*
%4 = alloca i16
%5 = alloca i16
%6 = alloca i16
store i8* %0, i8** %3
store i16 %1, i16* %4
store i16 0, i16* %5
store i16 0, i16* %6
%7 = load i8*, i8** %3
%8 = call signext i16 @strlen(i8* %7)
store i16 %8, i16* %6
store i16 0, i16* %5
br label %9
9: ; preds = %20, %2
%10 = load i16, i16* %5
%11 = sext i16 %10 to i32
%12 = load i16, i16* %4
%13 = sext i16 %12 to i32
%14 = icmp slt i32 %11, %13
br i1 %14, label %15, label %23
15: ; preds = %9
%16 = load i8*, i8** %3
%17 = load i16, i16* %5
%18 = sext i16 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
store i8 0, i8* %19
br label %20
20: ; preds = %15
%21 = load i16, i16* %5
%22 = add i16 %21, 1
store i16 %22, i16* %5
br label %9
23: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @clean_text(i8* %0, i16 signext %1) {
%3 = tail call signext i16 @strlen(i8* %0)
%4 = icmp sgt i16 %1, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = zext i16 %1 to i64
br label %7
7: ; preds = %5, %2
ret void
}
/* Variables and functions */
float tancotf(float const, int /*<<< orphan*/);
float tanf(const float x) { return tancotf(x, 0); }


x86 assembly (clang, -O0):
<tanf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
xor    %edi,%edi
call   1030 <tancotf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tanf>:
xor    %edi,%edi
jmp    1030 <tancotf@plt>

LLVM IR (-O0):
define float @tanf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @tancotf(float %3, i32 0)
ret float %4
}

LLVM IR (-O2):
define float @tanf(float %0) {
%2 = tail call float @tancotf(float %0, i32 0)
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ op_write1(int);
void op_enc_inc_hlp(void) { op_write1(0x34); }


x86 assembly (clang, -O0):
<op_enc_inc_hlp>:
push   %rbp
mov    %rsp,%rbp
mov    $0x34,%edi
call   1030 <op_write1@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<op_enc_inc_hlp>:
mov    $0x34,%edi
jmp    1030 <op_write1@plt>

LLVM IR (-O0):
define void @op_enc_inc_hlp() {
%1 = call i32 @op_write1(i32 52)
ret void
}

LLVM IR (-O2):
define void @op_enc_inc_hlp() {
%1 = tail call i32 @op_write1(i32 52)
ret void
}
/* Variables and functions */
int sprintf(char *, char *, char const *);
int f3(int *p, char *s) {
  const char *t = "bar";
  return sprintf(s, "%s", t);
}


x86 assembly (clang, -O0):
<f3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed9(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xeca(%rip),%rsi
call   1030 <sprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f3>:
movl   $0x726162,(%rsi)
mov    $0x3,%eax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"bar\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @f3(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %5
%6 = load i8*, i8** %4
%7 = load i8*, i8** %5
%8 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @f3(i32* nocapture readnone %0, i8* nocapture writeonly %1) {
%3 = bitcast i8* %1 to i32*
store i32 7496034, i32* %3
ret i32 3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void traverse(void *data) { printf("%d ", *(int *)data); }


x86 assembly (clang, -O0):
<traverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<traverse>:
mov    (%rdi),%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
define void @traverse(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @traverse(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
uint64_t unwind(uint64_t i) { return i; }


x86 assembly (clang, -O0):
<unwind>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<unwind>:
mov    %edi,%eax
ret

LLVM IR (-O0):
define i32 @unwind(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
ret i32 %3
}

LLVM IR (-O2):
define i32 @unwind(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ GyrCon_lc898122(int);
int /*<<< orphan*/ SrvCon_lc898122(int, int);
void OisEnaLin_lc898122(void) {
  SrvCon_lc898122(0x00, 0x01);
  SrvCon_lc898122(0x01, 0x01);
  GyrCon_lc898122(0x02);
}


x86 assembly (clang, -O0):
<OisEnaLin_lc898122>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
mov    $0x1,%esi
call   1040 <SrvCon_lc898122@plt>
mov    $0x1,%esi
mov    %esi,%edi
call   1040 <SrvCon_lc898122@plt>
mov    $0x2,%edi
call   1030 <GyrCon_lc898122@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<OisEnaLin_lc898122>:
push   %rax
xor    %edi,%edi
mov    $0x1,%esi
call   1040 <SrvCon_lc898122@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1040 <SrvCon_lc898122@plt>
mov    $0x2,%edi
pop    %rax
jmp    1030 <GyrCon_lc898122@plt>

LLVM IR (-O0):
define void @OisEnaLin_lc898122() {
%1 = call i32 @SrvCon_lc898122(i32 0, i32 1)
%2 = call i32 @SrvCon_lc898122(i32 1, i32 1)
%3 = call i32 @GyrCon_lc898122(i32 2)
ret void
}

LLVM IR (-O2):
define void @OisEnaLin_lc898122() {
%1 = tail call i32 @SrvCon_lc898122(i32 0, i32 1)
%2 = tail call i32 @SrvCon_lc898122(i32 1, i32 1)
%3 = tail call i32 @GyrCon_lc898122(i32 2)
ret void
}
int _TF10repl_swift9repl_mainFT_Si() { return 0; }


x86 assembly (clang, -O0):
<_TF10repl_swift9repl_mainFT_Si>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_TF10repl_swift9repl_mainFT_Si>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @_TF10repl_swift9repl_mainFT_Si() {
ret i32 0
}

LLVM IR (-O2):
define i32 @_TF10repl_swift9repl_mainFT_Si() {
ret i32 0
}
void cpu_relax(void) { asm volatile("rep ; nop" : : : "memory"); }


x86 assembly (clang, -O0):
<cpu_relax>:
push   %rbp
mov    %rsp,%rbp
pause
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpu_relax>:
pause
ret

LLVM IR (-O0):
define void @cpu_relax() {
ret void
}

LLVM IR (-O2):
define void @cpu_relax() {
tail call void asm sideeffect "rep ; nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
char *str_copy(char *to, const char *from) {
  while (*from)
    *to++ = *from++;
  return to;
}


x86 assembly (clang, -O0):
<str_copy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1140 <str_copy+0x40>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    110c <str_copy+0xc>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_copy>:
mov    %rdi,%rax
mov    (%rsi),%cl
test   %cl,%cl
je     1121 <str_copy+0x21>
add    $0x1,%rsi
nopl   (%rax)
mov    %cl,(%rax)
add    $0x1,%rax
movzbl (%rsi),%ecx
add    $0x1,%rsi
test   %cl,%cl
jne    1110 <str_copy+0x10>
ret

LLVM IR (-O0):
define i8* @str_copy(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %9, %2
%6 = load i8*, i8** %4
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %5
%10 = load i8*, i8** %4
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %4
%12 = load i8, i8* %10
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %3
store i8 %12, i8* %13
br label %5
15: ; preds = %5
%16 = load i8*, i8** %3
ret i8* %16
}

LLVM IR (-O2):
define i8* @str_copy(i8* writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %5 ], [ %3, %2 ]
%7 = phi i8* [ %9, %5 ], [ %1, %2 ]
%8 = phi i8* [ %10, %5 ], [ %0, %2 ]
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %6, i8* %8
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
%14 = phi i8* [ %0, %2 ], [ %10, %5 ]
ret i8* %14
}
/* Type definitions */
typedef scalar_t__ complex;

/* Variables and functions */
int I;
int cimag(scalar_t__);
scalar_t__ creal(scalar_t__);
complex cmplx_add(complex a, complex b) {
  return (creal(a) + creal(b)) + I * (cimag(a) + cimag(b));
}


x86 assembly (clang, -O0):
<cmplx_add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <creal@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <creal@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    0x2e8d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <cimag@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <cimag@plt>
mov    -0x20(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    %eax,%esi
mov    -0x18(%rbp),%rax
add    %esi,%edx
imul   %edx,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmplx_add>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r12
call   1030 <creal@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1030 <creal@plt>
mov    %rax,%rbx
add    %r15,%rbx
mov    0x2e9d(%rip),%rax
movslq (%rax),%r15
mov    %r12,%rdi
call   1040 <cimag@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1040 <cimag@plt>
add    %ebp,%eax
cltq
imul   %r15,%rax
add    %rbx,%rax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@I = global i32 0
define i64 @cmplx_add(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = call i64 @creal(i64 %5)
%7 = load i64, i64* %4
%8 = call i64 @creal(i64 %7)
%9 = add nsw i64 %6, %8
%10 = load i32, i32* @I
%11 = load i64, i64* %3
%12 = call i32 @cimag(i64 %11)
%13 = load i64, i64* %4
%14 = call i32 @cimag(i64 %13)
%15 = add nsw i32 %12, %14
%16 = mul nsw i32 %10, %15
%17 = sext i32 %16 to i64
%18 = add nsw i64 %9, %17
ret i64 %18
}

LLVM IR (-O2):
@I = global i32 0
define i64 @cmplx_add(i64 %0, i64 %1) {
%3 = tail call i64 @creal(i64 %0)
%4 = tail call i64 @creal(i64 %1)
%5 = add nsw i64 %4, %3
%6 = load i32, i32* @I
%7 = tail call i32 @cimag(i64 %0)
%8 = tail call i32 @cimag(i64 %1)
%9 = add nsw i32 %8, %7
%10 = mul nsw i32 %9, %6
%11 = sext i32 %10 to i64
%12 = add nsw i64 %5, %11
ret i64 %12
}
double ls_costN_nm3_sign(double x) { return x < 0 ? -1 : x > 0 ? 1 : x; }


x86 assembly (clang, -O0):
<ls_costN_nm3_sign>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1129 <ls_costN_nm3_sign+0x29>
movsd  0xee9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1161 <ls_costN_nm3_sign+0x61>
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    114d <ls_costN_nm3_sign+0x4d>
movsd  0xebd(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1157 <ls_costN_nm3_sign+0x57>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ls_costN_nm3_sign>:
xorpd  %xmm1,%xmm1
xorpd  %xmm2,%xmm2
cmpltsd %xmm0,%xmm2
movsd  0xeeb(%rip),%xmm3
andpd  %xmm2,%xmm3
andnpd %xmm0,%xmm2
orpd   %xmm3,%xmm2
cmpltsd %xmm1,%xmm0
movapd %xmm0,%xmm1
andnpd %xmm2,%xmm1
movsd  0xed2(%rip),%xmm2
andpd  %xmm2,%xmm0
orpd   %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @ls_costN_nm3_sign(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp olt double %3, 0.000000e+00
br i1 %4, label %5, label %6
5: ; preds = %1
br label %14
6: ; preds = %1
%7 = load double, double* %2
%8 = fcmp ogt double %7, 0.000000e+00
br i1 %8, label %9, label %10
9: ; preds = %6
br label %12
10: ; preds = %6
%11 = load double, double* %2
br label %12
12: ; preds = %10, %9
%13 = phi double [ 1.000000e+00, %9 ], [ %11, %10 ]
br label %14
14: ; preds = %12, %5
%15 = phi double [ -1.000000e+00, %5 ], [ %13, %12 ]
ret double %15
}

LLVM IR (-O2):
define double @ls_costN_nm3_sign(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = fcmp ogt double %0, 0.000000e+00
%4 = select i1 %3, double 1.000000e+00, double %0
%5 = select i1 %2, double -1.000000e+00, double %4
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ twoSum(int *, int, int);
int main() {
  int n[18] = {1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9};
  twoSum(n, 18, 10);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xec6(%rip),%rsi
mov    $0x48,%edx
call   1030 <memcpy@plt>
lea    -0x50(%rbp),%rdi
mov    $0x12,%esi
mov    $0xa,%edx
call   1040 <twoSum@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x48,%rsp
mov    0xf25(%rip),%rax
mov    %rax,0x40(%rsp)
movaps 0xf09(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xeed(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xed1(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb5(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x12,%esi
mov    $0xa,%edx
call   1030 <twoSum@plt>
xor    %eax,%eax
add    $0x48,%rsp
ret

LLVM IR (-O0):
@__const.main.n = [18 x i32] [i32 1, i32 1, i32 2, i32 2, i32 3, i32 3, i32 4, i32 4, i32 5, i32 5, i32 6, i32 6, i32 7, i32 7, i32 8, i32 8, i32 9, i32 9]
define i32 @main() {
%1 = alloca i32
%2 = alloca [18 x i32]
store i32 0, i32* %1
%3 = bitcast [18 x i32]* %2 to i8*
%4 = getelementptr inbounds [18 x i32], [18 x i32]* %2, i64 0, i64 0
%5 = call i32 @twoSum(i32* %4, i32 18, i32 10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.n = [18 x i32] [i32 1, i32 1, i32 2, i32 2, i32 3, i32 3, i32 4, i32 4, i32 5, i32 5, i32 6, i32 6, i32 7, i32 7, i32 8, i32 8, i32 9, i32 9]
define i32 @main() {
%1 = alloca [18 x i32]
%2 = bitcast [18 x i32]* %1 to i8*
%3 = getelementptr inbounds [18 x i32], [18 x i32]* %1, i64 0, i64 0
%4 = call i32 @twoSum(i32* %3, i32 18, i32 10)
ret i32 0
}
/* Variables and functions */
int TestSomeFuncs();
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("Score: %d\n", TestSomeFuncs());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <TestSomeFuncs@plt>
mov    %eax,%esi
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <TestSomeFuncs@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"Score: %d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @TestSomeFuncs()
%3 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"Score: %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @TestSomeFuncs()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Type definitions */
typedef unsigned long long uint64_t;

/* Variables and functions */
double fabs(double x) {
  union {
    double f;
    uint64_t i;
  } u = {x};
  u.i &= -1ULL / 2;
  return u.f;
}


x86 assembly (clang, -O0):
<fabs>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movabs $0x7fffffffffffffff,%rax
ff ff 7f
and    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fabs>:
andps  0xef9(%rip),%xmm0
ret

LLVM IR (-O0):
%union.anon = type { double }
define double @fabs(double %0) {
%2 = alloca double
%3 = alloca %union.anon
store double %0, double* %2
%4 = bitcast %union.anon* %3 to double*
%5 = load double, double* %2
store double %5, double* %4
%6 = bitcast %union.anon* %3 to i64*
%7 = load i64, i64* %6
%8 = and i64 %7, 9223372036854775807
store i64 %8, i64* %6
%9 = bitcast %union.anon* %3 to double*
%10 = load double, double* %9
ret double %10
}

LLVM IR (-O2):
define double @fabs(double %0) {
%2 = bitcast double %0 to i64
%3 = and i64 %2, 9223372036854775807
%4 = bitcast i64 %3 to double
ret double %4
}
unsigned char inb(int p) {
  unsigned char v;
  __asm__ __volatile__("inb %w1, %b0" : "=a"(v) : "Nd"(p));
  return v;
}


x86 assembly (clang, -O0):
<inb>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
in     (%dx),%al
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inb>:
mov    %edi,%edx
in     (%dx),%al
ret

LLVM IR (-O0):
define zeroext i8 @inb(i32 %0) {
%2 = alloca i32
%3 = alloca i8
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8 asm sideeffect "inb ${1:w}, ${0:b}", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i32 %4)
store i8 %5, i8* %3
%6 = load i8, i8* %3
ret i8 %6
}

LLVM IR (-O2):
define zeroext i8 @inb(i32 %0) {
%2 = tail call i8 asm sideeffect "inb ${1:w}, ${0:b}", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i32 %0)
ret i8 %2
}
double dt2epj(date, time)
double date;
double time;
{
  double dj;
  double epoch;
  dj = dt2jd(date, time);
  if (date == 0.0)
    epoch = dj / 365.25;
  else
    epoch = jd2epj(dj);
  return (epoch);
}


x86 assembly (clang, -O0):
<dt2epj>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mov    $0x2,%al
call   1030 <dt2jd@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    117f <dt2epj+0x5f>
jp     117f <dt2epj+0x5f>
movsd  -0x18(%rbp),%xmm0
movsd  0xe8f(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1194 <dt2epj+0x74>
movsd  -0x18(%rbp),%xmm0
mov    $0x1,%al
call   1040 <jd2epj@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dt2epj>:
push   %rax
movsd  %xmm0,(%rsp)
mov    $0x2,%al
call   1030 <dt2jd@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
xorpd  %xmm1,%xmm1
movsd  (%rsp),%xmm2
ucomisd %xmm1,%xmm2
jne    114f <dt2epj+0x2f>
jp     114f <dt2epj+0x2f>
divsd  0xeb3(%rip),%xmm0
pop    %rax
ret
mov    $0x1,%al
call   1040 <jd2epj@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @dt2epj(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %3
store double %1, double* %4
%7 = load double, double* %3
%8 = load double, double* %4
%9 = call i32 (double, double, ...) bitcast (i32 (...)* @dt2jd to i32 (double, double, ...)*)(double %7, double %8)
%10 = sitofp i32 %9 to double
store double %10, double* %5
%11 = load double, double* %3
%12 = fcmp oeq double %11, 0.000000e+00
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = load double, double* %5
%15 = fdiv double %14, 3.652500e+02
store double %15, double* %6
br label %20
16: ; preds = %2
%17 = load double, double* %5
%18 = call i32 (double, ...) bitcast (i32 (...)* @jd2epj to i32 (double, ...)*)(double %17)
%19 = sitofp i32 %18 to double
store double %19, double* %6
br label %20
20: ; preds = %16, %13
%21 = load double, double* %6
ret double %21
}

LLVM IR (-O2):
define double @dt2epj(double %0, double %1) {
%3 = tail call i32 (double, double, ...) bitcast (i32 (...)* @dt2jd to i32 (double, double, ...)*)(double %0, double %1)
%4 = sitofp i32 %3 to double
%5 = fcmp oeq double %0, 0.000000e+00
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = fdiv double %4, 3.652500e+02
br label %11
8: ; preds = %2
%9 = tail call i32 (double, ...) bitcast (i32 (...)* @jd2epj to i32 (double, ...)*)(double %4)
%10 = sitofp i32 %9 to double
br label %11
11: ; preds = %8, %6
%12 = phi double [ %7, %6 ], [ %10, %8 ]
ret double %12
}
cbuf25(f, n) int f, n;
{ cbuf(f, n, 25); }


x86 assembly (clang, -O0):
<cbuf25>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x19,%edx
mov    $0x0,%al
call   1030 <cbuf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cbuf25>:
mov    $0x19,%edx
xor    %eax,%eax
jmp    1030 <cbuf@plt>

LLVM IR (-O0):
define i32 @cbuf25(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = load i32, i32* %5
%8 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @cbuf to i32 (i32, i32, i32, ...)*)(i32 %6, i32 %7, i32 25)
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @cbuf25(i32 %0, i32 %1) {
%3 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @cbuf to i32 (i32, i32, i32, ...)*)(i32 %0, i32 %1, i32 25)
ret i32 undef
}