xunge/DecIR huggingface dataset:
double MOD360(double a) {
  return (((a + 360.) / 360.) - ((int)((a + 360.) / 360.))) * 360.;
}


x86 assembly (clang, -O0):
<MOD360>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  0xee2(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xed6(%rip),%xmm1
addsd  -0x8(%rbp),%xmm1
movsd  0xec9(%rip),%xmm2
divsd  %xmm2,%xmm1
cvttsd2si %xmm1,%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  0xeb1(%rip),%xmm1
mulsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<MOD360>:
movsd  0xef8(%rip),%xmm1
addsd  %xmm1,%xmm0
divsd  %xmm1,%xmm0
cvttpd2dq %xmm0,%xmm2
cvtdq2pd %xmm2,%xmm2
subsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @MOD360(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fadd double %3, 3.600000e+02
%5 = fdiv double %4, 3.600000e+02
%6 = load double, double* %2
%7 = fadd double %6, 3.600000e+02
%8 = fdiv double %7, 3.600000e+02
%9 = fptosi double %8 to i32
%10 = sitofp i32 %9 to double
%11 = fsub double %5, %10
%12 = fmul double %11, 3.600000e+02
ret double %12
}

LLVM IR (-O2):
define double @MOD360(double %0) {
%2 = fadd double %0, 3.600000e+02
%3 = fdiv double %2, 3.600000e+02
%4 = fptosi double %3 to i32
%5 = sitofp i32 %4 to double
%6 = fsub double %3, %5
%7 = fmul double %6, 3.600000e+02
ret double %7
}
/* Variables and functions */
int PDCRead(int);
int /*<<< orphan*/ PDCWrite(int, int);
void PDCLCDClear(void) {
  while ((PDCRead(0x6) & 0x80)) {
  }
  PDCWrite(0x6, 0x01);
}


x86 assembly (clang, -O0):
<PDCLCDClear>:
push   %rbp
mov    %rsp,%rbp
jmp    1129 <PDCLCDClear+0x9>
mov    $0x6,%edi
call   1030 <PDCRead@plt>
and    $0x80,%eax
cmp    $0x0,%eax
je     1146 <PDCLCDClear+0x26>
jmp    1129 <PDCLCDClear+0x9>
mov    $0x6,%edi
mov    $0x1,%esi
call   1040 <PDCWrite@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<PDCLCDClear>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x6,%edi
call   1030 <PDCRead@plt>
test   $0x80,%al
jne    1130 <PDCLCDClear+0x10>
mov    $0x6,%edi
mov    $0x1,%esi
pop    %rax
jmp    1040 <PDCWrite@plt>

LLVM IR (-O0):
define void @PDCLCDClear() {
br label %1
1: ; preds = %5, %0
%2 = call i32 @PDCRead(i32 6)
%3 = and i32 %2, 128
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %1
br label %1
6: ; preds = %1
%7 = call i32 @PDCWrite(i32 6, i32 1)
ret void
}

LLVM IR (-O2):
define void @PDCLCDClear() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @PDCRead(i32 6)
%3 = and i32 %2, 128
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %1
5: ; preds = %1
%6 = tail call i32 @PDCWrite(i32 6, i32 1)
ret void
}
/* Variables and functions */
long long __ocml_rint_f64(double);
long long int llrint(double x) { return __ocml_rint_f64(x); }


x86 assembly (clang, -O0):
<llrint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <__ocml_rint_f64@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<llrint>:
jmp    1030 <__ocml_rint_f64@plt>

LLVM IR (-O0):
define i64 @llrint(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i64 @__ocml_rint_f64(double %3)
ret i64 %4
}

LLVM IR (-O2):
define i64 @llrint(double %0) {
%2 = tail call i64 @__ocml_rint_f64(double %0)
ret i64 %2
}
/* Variables and functions */
unsigned long mtrandom_uint64(unsigned long);
unsigned long mtrandom_ulong(unsigned long range) {
  return mtrandom_uint64(range);
}


x86 assembly (clang, -O0):
<mtrandom_ulong>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <mtrandom_uint64@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mtrandom_ulong>:
jmp    1030 <mtrandom_uint64@plt>

LLVM IR (-O0):
define i64 @mtrandom_ulong(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i64 @mtrandom_uint64(i64 %3)
ret i64 %4
}

LLVM IR (-O2):
define i64 @mtrandom_ulong(i64 %0) {
%2 = tail call i64 @mtrandom_uint64(i64 %0)
ret i64 %2
}
float fastInvSqrt(float x) {
  float xhalf = 0.5f * x;
  union {
    float x;
    int i;
  } u;
  u.x = x;
  u.i = 0x5f3759df - (u.i >> 1);
  x = u.x * (1.5f - xhalf * u.x * u.x);
  return x;
}


x86 assembly (clang, -O0):
<fastInvSqrt>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xef3(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
sar    $0x1,%ecx
mov    $0x5f3759df,%eax
sub    %ecx,%eax
mov    %eax,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
mulss  -0x10(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm1
movss  0xe9e(%rip),%xmm2
addss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fastInvSqrt>:
movd   %xmm0,%eax
sar    %eax
mov    $0x5f3759df,%ecx
sub    %eax,%ecx
movd   %ecx,%xmm1
mulss  0xee7(%rip),%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
addss  0xedb(%rip),%xmm0
mulss  %xmm1,%xmm0
ret

LLVM IR (-O0):
%union.anon = type { float }
define float @fastInvSqrt(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca %union.anon
store float %0, float* %2
%5 = load float, float* %2
%6 = fmul float 5.000000e-01, %5
store float %6, float* %3
%7 = load float, float* %2
%8 = bitcast %union.anon* %4 to float*
store float %7, float* %8
%9 = bitcast %union.anon* %4 to i32*
%10 = load i32, i32* %9
%11 = ashr i32 %10, 1
%12 = sub nsw i32 1597463007, %11
%13 = bitcast %union.anon* %4 to i32*
store i32 %12, i32* %13
%14 = bitcast %union.anon* %4 to float*
%15 = load float, float* %14
%16 = load float, float* %3
%17 = bitcast %union.anon* %4 to float*
%18 = load float, float* %17
%19 = fmul float %16, %18
%20 = bitcast %union.anon* %4 to float*
%21 = load float, float* %20
%22 = fneg float %19
%23 = call float @llvm.fmuladd.f32(float %22, float %21, float 1.500000e+00)
%24 = fmul float %15, %23
store float %24, float* %2
%25 = load float, float* %2
ret float %25
}

LLVM IR (-O2):
define float @fastInvSqrt(float %0) {
%2 = bitcast float %0 to i32
%3 = ashr i32 %2, 1
%4 = sub nsw i32 1597463007, %3
%5 = bitcast i32 %4 to float
%6 = fmul float %0, -5.000000e-01
%7 = fmul float %6, %5
%8 = tail call float @llvm.fmuladd.f32(float %7, float %5, float 1.500000e+00)
%9 = fmul float %8, %5
ret float %9
}
/* Variables and functions */
int /*<<< orphan*/ Toggle();
int ui_loop(int, char **, char *);
int main(int argc, char **argv) {
  Toggle();
  return ui_loop(argc, argv, "mech");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <Toggle@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xeb5(%rip),%rdx
call   1030 <ui_loop@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <Toggle@plt>
lea    0xeca(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <ui_loop@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"mech\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 (...) @Toggle()
%4 = tail call i32 @ui_loop(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ PKCS12_SAFEBAG;
typedef int /*<<< orphan*/ ASN1_VALUE;

/* Variables and functions */
scalar_t__ ASN1_item_d2i(int /*<<< orphan*/ **, unsigned char const **, long,
                         int /*<<< orphan*/ *);
int /*<<< orphan*/ PKCS12_SAFEBAG_it;
PKCS12_SAFEBAG *d2i_PKCS12_SAFEBAG(PKCS12_SAFEBAG **a, const unsigned char **in,
                                   long len) {
  return (PKCS12_SAFEBAG *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
                                         &PKCS12_SAFEBAG_it);
}


x86 assembly (clang, -O0):
<d2i_PKCS12_SAFEBAG>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    0x2ec1(%rip),%rcx
call   1030 <ASN1_item_d2i@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<d2i_PKCS12_SAFEBAG>:
mov    0x2ee1(%rip),%rcx
jmp    1030 <ASN1_item_d2i@plt>

LLVM IR (-O0):
@PKCS12_SAFEBAG_it = global i32 0
define i32* @d2i_PKCS12_SAFEBAG(i32** %0, i8** %1, i64 %2) {
%4 = alloca i32**
%5 = alloca i8**
%6 = alloca i64
store i32** %0, i32*** %4
store i8** %1, i8*** %5
store i64 %2, i64* %6
%7 = load i32**, i32*** %4
%8 = load i8**, i8*** %5
%9 = load i64, i64* %6
%10 = call i64 @ASN1_item_d2i(i32** %7, i8** %8, i64 %9, i32* @PKCS12_SAFEBAG_it)
%11 = inttoptr i64 %10 to i32*
ret i32* %11
}

LLVM IR (-O2):
@PKCS12_SAFEBAG_it = global i32 0
define i32* @d2i_PKCS12_SAFEBAG(i32** %0, i8** %1, i64 %2) {
%4 = tail call i64 @ASN1_item_d2i(i32** %0, i8** %1, i64 %2, i32* @PKCS12_SAFEBAG_it)
%5 = inttoptr i64 %4 to i32*
ret i32* %5
}
/* Type definitions */
struct sockaddr_un {
  int /*<<< orphan*/ sun_path;
};
struct sockaddr {
  int dummy;
};

/* Variables and functions */
size_t scnprintf(char *, size_t, char *, int /*<<< orphan*/);
size_t af_local__scnprintf(struct sockaddr *sa, char *bf, size_t size) {
  struct sockaddr_un *sun = (struct sockaddr_un *)sa;
  return scnprintf(bf, size, ", path: %s", sun->sun_path);
}


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

x86 assembly (clang, -O2):
<af_local__scnprintf>:
mov    (%rdi),%ecx
lea    0xee7(%rip),%rax
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %rax,%rdx
jmp    1030 <scnprintf@plt>

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
%struct.sockaddr_un = type { i32 }
@.str = [11 x i8] c", path: %s\00"
define i64 @af_local__scnprintf(%struct.sockaddr* %0, i8* %1, i64 %2) {
%4 = alloca %struct.sockaddr*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca %struct.sockaddr_un*
store %struct.sockaddr* %0, %struct.sockaddr** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load %struct.sockaddr*, %struct.sockaddr** %4
%9 = bitcast %struct.sockaddr* %8 to %struct.sockaddr_un*
store %struct.sockaddr_un* %9, %struct.sockaddr_un** %7
%10 = load i8*, i8** %5
%11 = load i64, i64* %6
%12 = load %struct.sockaddr_un*, %struct.sockaddr_un** %7
%13 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %12, i32 0, i32 0
%14 = load i32, i32* %13
%15 = call i64 @scnprintf(i8* %10, i64 %11, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %14)
ret i64 %15
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
@.str = [11 x i8] c", path: %s\00"
define i64 @af_local__scnprintf(%struct.sockaddr* nocapture %0, i8* %1, i64 %2) {
%4 = getelementptr %struct.sockaddr, %struct.sockaddr* %0, i64 0, i32 0
%5 = load i32, i32* %4
%6 = tail call i64 @scnprintf(i8* %1, i64 %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i64 %6
}
int f(float x) {
  int m = __alignof__ x;
  int n = __alignof__(x);
  return n + m;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movl   $0x4,-0x8(%rbp)
movl   $0x4,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @f(float %0) {
%2 = alloca float
%3 = alloca i32
%4 = alloca i32
store float %0, float* %2
store i32 4, i32* %3
store i32 4, i32* %4
%5 = load i32, i32* %4
%6 = load i32, i32* %3
%7 = add nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @f(float %0) {
ret i32 8
}
/* Variables and functions */
int /*<<< orphan*/ outb(unsigned short, unsigned short);
void serial_configure_baud_rate(unsigned short com, unsigned short divisor) {
  outb((com + 3), 0x80);
  outb((com), (divisor >> 8) & 0x00ff);
  outb((com), divisor & 0x00ff);
}


x86 assembly (clang, -O0):
<serial_configure_baud_rate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
movzwl -0x2(%rbp),%eax
add    $0x3,%eax
mov    $0x80,%esi
movzwl %ax,%edi
call   1030 <outb@plt>
mov    -0x2(%rbp),%cx
movzwl -0x4(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
movzwl %cx,%edi
movzwl %ax,%esi
call   1030 <outb@plt>
mov    -0x2(%rbp),%cx
movzwl -0x4(%rbp),%eax
and    $0xff,%eax
movzwl %cx,%edi
movzwl %ax,%esi
call   1030 <outb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serial_configure_baud_rate>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
lea    0x3(%rbx),%eax
movzwl %ax,%edi
mov    $0x80,%esi
call   1030 <outb@plt>
mov    %ebp,%esi
shr    $0x8,%esi
mov    %ebx,%edi
call   1030 <outb@plt>
movzbl %bpl,%esi
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @serial_configure_baud_rate(i16 zeroext %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = load i16, i16* %3
%6 = zext i16 %5 to i32
%7 = add nsw i32 %6, 3
%8 = trunc i32 %7 to i16
%9 = call i32 @outb(i16 zeroext %8, i16 zeroext 128)
%10 = load i16, i16* %3
%11 = load i16, i16* %4
%12 = zext i16 %11 to i32
%13 = ashr i32 %12, 8
%14 = and i32 %13, 255
%15 = trunc i32 %14 to i16
%16 = call i32 @outb(i16 zeroext %10, i16 zeroext %15)
%17 = load i16, i16* %3
%18 = load i16, i16* %4
%19 = zext i16 %18 to i32
%20 = and i32 %19, 255
%21 = trunc i32 %20 to i16
%22 = call i32 @outb(i16 zeroext %17, i16 zeroext %21)
ret void
}

LLVM IR (-O2):
define void @serial_configure_baud_rate(i16 zeroext %0, i16 zeroext %1) {
%3 = add i16 %0, 3
%4 = tail call i32 @outb(i16 zeroext %3, i16 zeroext 128)
%5 = lshr i16 %1, 8
%6 = tail call i32 @outb(i16 zeroext %0, i16 zeroext %5)
%7 = and i16 %1, 255
%8 = tail call i32 @outb(i16 zeroext %0, i16 zeroext %7)
ret void
}
int uds_transfer_data(int address, unsigned char *data) {
  int blockSequenceCounter = 1;
  return blockSequenceCounter;
}


x86 assembly (clang, -O0):
<uds_transfer_data>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @uds_transfer_data(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
store i32 1, i32* %5
%6 = load i32, i32* %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @uds_transfer_data(i32 %0, i8* nocapture readnone %1) {
ret i32 1
}
double *NMD_row_rmajor(double *restrict mat, unsigned ncols, unsigned rindx) {
  return &mat[rindx * ncols];
}


x86 assembly (clang, -O0):
<NMD_row_rmajor>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
imul   -0xc(%rbp),%ecx
mov    %ecx,%ecx
shl    $0x3,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<NMD_row_rmajor>:
imul   %edx,%esi
lea    (%rdi,%rsi,8),%rax
ret

LLVM IR (-O0):
define double* @NMD_row_rmajor(double* noalias %0, i32 %1, i32 %2) {
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
store double* %0, double** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load double*, double** %4
%8 = load i32, i32* %6
%9 = load i32, i32* %5
%10 = mul i32 %8, %9
%11 = zext i32 %10 to i64
%12 = getelementptr inbounds double, double* %7, i64 %11
ret double* %12
}

LLVM IR (-O2):
define double* @NMD_row_rmajor(double* noalias readnone %0, i32 %1, i32 %2) {
%4 = mul i32 %2, %1
%5 = zext i32 %4 to i64
%6 = getelementptr inbounds double, double* %0, i64 %5
ret double* %6
}
void ssl_cleanup(int fd) {}


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

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

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

LLVM IR (-O2):
define void @ssl_cleanup(i32 %0) {
ret void
}
void SSMR3GetUInt(void) {}


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

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

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

LLVM IR (-O2):
define void @SSMR3GetUInt() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int LOG_ERR;
int LOG_USER;
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ syslog(int, char *);
int main(void) {
  FILE *fp;
  fp = fopen("abcdefg", "r");
  if (!fp) {
    syslog(LOG_USER | LOG_ERR, "Scl test - %m\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    0xecb(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116f <main+0x4f>
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
mov    0x2e6f(%rip),%rax
or     (%rax),%edi
lea    0xea0(%rip),%rsi
call   1030 <syslog@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xed9(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
jne    1157 <main+0x37>
mov    0x2ea8(%rip),%rax
mov    0x2e89(%rip),%rcx
mov    (%rcx),%edi
or     (%rax),%edi
lea    0xeb8(%rip),%rsi
call   1030 <syslog@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"abcdefg\00"
@.str.1 = [2 x i8] c"r\00"
@LOG_USER = global i32 0
@LOG_ERR = global i32 0
@.str.2 = [15 x i8] c"Scl test - %m\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %2
%4 = load i32*, i32** %2
%5 = icmp ne i32* %4, null
br i1 %5, label %11, label %6
6: ; preds = %0
%7 = load i32, i32* @LOG_USER
%8 = load i32, i32* @LOG_ERR
%9 = or i32 %7, %8
%10 = call i32 @syslog(i32 %9, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %11
11: ; preds = %6, %0
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"abcdefg\00"
@.str.1 = [2 x i8] c"r\00"
@LOG_USER = global i32 0
@LOG_ERR = global i32 0
@.str.2 = [15 x i8] c"Scl test - %m\0A\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32* %1, null
br i1 %2, label %3, label %8
3: ; preds = %0
%4 = load i32, i32* @LOG_USER
%5 = load i32, i32* @LOG_ERR
%6 = or i32 %5, %4
%7 = tail call i32 @syslog(i32 %6, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %8
8: ; preds = %3, %0
ret i32 0
}
/* Variables and functions */
void *pseudotalloc_malloc(size_t);
void *talloc_named_const(const void *context, size_t size, const char *name) {
  return pseudotalloc_malloc(size);
}


x86 assembly (clang, -O0):
<talloc_named_const>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <pseudotalloc_malloc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<talloc_named_const>:
mov    %rsi,%rdi
jmp    1030 <pseudotalloc_malloc@plt>

LLVM IR (-O0):
define i8* @talloc_named_const(i8* %0, i64 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %4
store i64 %1, i64* %5
store i8* %2, i8** %6
%7 = load i64, i64* %5
%8 = call i8* @pseudotalloc_malloc(i64 %7)
ret i8* %8
}

LLVM IR (-O2):
define i8* @talloc_named_const(i8* nocapture readnone %0, i64 %1, i8* nocapture readnone %2) {
%4 = tail call i8* @pseudotalloc_malloc(i64 %1)
ret i8* %4
}
int array_test(int x[2]) { return x[0]; }


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

x86 assembly (clang, -O2):
<array_test>:
mov    (%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @array_test(i32* nocapture %0) {
%2 = load i32, i32* %0
ret i32 %2
}
float area(width, height)
int width;
float height;
{ return (width * height); }


x86 assembly (clang, -O0):
<area>:
push   %rbp
mov    %rsp,%rbp
cvtsd2ss %xmm0,%xmm0
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<area>:
cvtsd2ss %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2ss %edi,%xmm0
mulss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @area(i32 %0, double %1) {
%3 = alloca i32
%4 = alloca float
%5 = fptrunc double %1 to float
store i32 %0, i32* %3
store float %5, float* %4
%6 = load i32, i32* %3
%7 = sitofp i32 %6 to float
%8 = load float, float* %4
%9 = fmul float %7, %8
ret float %9
}

LLVM IR (-O2):
define float @area(i32 %0, double %1) {
%3 = fptrunc double %1 to float
%4 = sitofp i32 %0 to float
%5 = fmul float %4, %3
ret float %5
}
int zone_movable_is_highmem(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @zone_movable_is_highmem() {
ret i32 0
}
void _delay_ms(int i) {}


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

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

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

LLVM IR (-O2):
define void @_delay_ms(i32 %0) {
ret void
}
int fun603() { return 603; }


x86 assembly (clang, -O0):
<fun603>:
push   %rbp
mov    %rsp,%rbp
mov    $0x25b,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @fun603() {
ret i32 603
}

LLVM IR (-O2):
define i32 @fun603() {
ret i32 603
}
/* Type definitions */
struct tempered_device_list {
  int dummy;
};

/* Variables and functions */
struct tempered_device_list *tempered_type_hid_enumerate(char **);
struct tempered_device_list *temper_type_enumerate(char **error) {
  return tempered_type_hid_enumerate(error);
}


x86 assembly (clang, -O0):
<temper_type_enumerate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <tempered_type_hid_enumerate@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<temper_type_enumerate>:
jmp    1030 <tempered_type_hid_enumerate@plt>

LLVM IR (-O0):
%struct.tempered_device_list = type { i32 }
define %struct.tempered_device_list* @temper_type_enumerate(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = call %struct.tempered_device_list* @tempered_type_hid_enumerate(i8** %3)
ret %struct.tempered_device_list* %4
}

LLVM IR (-O2):
%struct.tempered_device_list = type { i32 }
define %struct.tempered_device_list* @temper_type_enumerate(i8** %0) {
%2 = tail call %struct.tempered_device_list* @tempered_type_hid_enumerate(i8** %0)
ret %struct.tempered_device_list* %2
}
/* Variables and functions */
int atoi(char *);
int main(int argc, char **argv) {
  if (argc == 1)
    return -1;
  else
    return atoi(argv[1]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    113c <main+0x2c>
movl   $0xffffffff,-0x4(%rbp)
jmp    114c <main+0x3c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <atoi@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
cmp    $0x1,%edi
jne    111b <main+0xb>
mov    $0xffffffff,%eax
ret
mov    0x8(%rsi),%rdi
jmp    1030 <atoi@plt>

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
br label %8
8: ; preds = %2, %4
%9 = phi i32 [ %7, %4 ], [ -1, %2 ]
ret i32 %9
}
/* Type definitions */
typedef char uint8_t;

/* Variables and functions */
uint8_t wspr_ascii_to_num(uint8_t c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}


x86 assembly (clang, -O0):
<wspr_ascii_to_num>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x30,%eax
jl     1133 <wspr_ascii_to_num+0x33>
movsbl -0x2(%rbp),%eax
cmp    $0x39,%eax
jg     1133 <wspr_ascii_to_num+0x33>
movsbl -0x2(%rbp),%eax
sub    $0x30,%eax
mov    %al,-0x1(%rbp)
jmp    1137 <wspr_ascii_to_num+0x37>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wspr_ascii_to_num>:
add    $0xd0,%dil
xor    %ecx,%ecx
cmp    $0xa,%dil
movzbl %dil,%eax
cmovae %ecx,%eax
ret

LLVM IR (-O0):
define signext i8 @wspr_ascii_to_num(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 48
br i1 %6, label %7, label %16
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 57
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = sub nsw i32 %13, 48
%15 = trunc i32 %14 to i8
store i8 %15, i8* %2
br label %17
16: ; preds = %7, %1
store i8 0, i8* %2
br label %17
17: ; preds = %16, %11
%18 = load i8, i8* %2
ret i8 %18
}

LLVM IR (-O2):
define signext i8 @wspr_ascii_to_num(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = select i1 %3, i8 %2, i8 0
ret i8 %4
}
/* Variables and functions */
int /*<<< orphan*/ insert_end(int);
int /*<<< orphan*/ print_list();
int main(int argc, char **argv) {
  insert_end(9);
  insert_end(4);
  insert_end(9);
  insert_end(7);
  insert_end(2);
  insert_end(9);
  insert_end(3);
  insert_end(5);
  insert_end(7);
  insert_end(0);
  print_list();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x9,%edi
call   1030 <insert_end@plt>
mov    $0x4,%edi
call   1030 <insert_end@plt>
mov    $0x9,%edi
call   1030 <insert_end@plt>
mov    $0x7,%edi
call   1030 <insert_end@plt>
mov    $0x2,%edi
call   1030 <insert_end@plt>
mov    $0x9,%edi
call   1030 <insert_end@plt>
mov    $0x3,%edi
call   1030 <insert_end@plt>
mov    $0x5,%edi
call   1030 <insert_end@plt>
mov    $0x7,%edi
call   1030 <insert_end@plt>
xor    %edi,%edi
call   1030 <insert_end@plt>
mov    $0x0,%al
call   1040 <print_list@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x9,%edi
call   1030 <insert_end@plt>
mov    $0x4,%edi
call   1030 <insert_end@plt>
mov    $0x9,%edi
call   1030 <insert_end@plt>
mov    $0x7,%edi
call   1030 <insert_end@plt>
mov    $0x2,%edi
call   1030 <insert_end@plt>
mov    $0x9,%edi
call   1030 <insert_end@plt>
mov    $0x3,%edi
call   1030 <insert_end@plt>
mov    $0x5,%edi
call   1030 <insert_end@plt>
mov    $0x7,%edi
call   1030 <insert_end@plt>
xor    %edi,%edi
call   1030 <insert_end@plt>
xor    %eax,%eax
call   1040 <print_list@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @insert_end(i32 9)
%7 = call i32 @insert_end(i32 4)
%8 = call i32 @insert_end(i32 9)
%9 = call i32 @insert_end(i32 7)
%10 = call i32 @insert_end(i32 2)
%11 = call i32 @insert_end(i32 9)
%12 = call i32 @insert_end(i32 3)
%13 = call i32 @insert_end(i32 5)
%14 = call i32 @insert_end(i32 7)
%15 = call i32 @insert_end(i32 0)
%16 = call i32 (...) @print_list()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @insert_end(i32 9)
%4 = tail call i32 @insert_end(i32 4)
%5 = tail call i32 @insert_end(i32 9)
%6 = tail call i32 @insert_end(i32 7)
%7 = tail call i32 @insert_end(i32 2)
%8 = tail call i32 @insert_end(i32 9)
%9 = tail call i32 @insert_end(i32 3)
%10 = tail call i32 @insert_end(i32 5)
%11 = tail call i32 @insert_end(i32 7)
%12 = tail call i32 @insert_end(i32 0)
%13 = tail call i32 (...) @print_list()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ __assert(char const *, char const *, int);
int assfail(const char *buf, const char *file, int line) {
  __assert(buf, file, line);
  return (0);
}


x86 assembly (clang, -O0):
<assfail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <__assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assfail>:
push   %rax
call   1030 <__assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @assfail(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @__assert(i8* %7, i8* %8, i32 %9)
ret i32 0
}

LLVM IR (-O2):
define i32 @assfail(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @__assert(i8* %0, i8* %1, i32 %2)
ret i32 0
}
/* Type definitions */
union bpf_attr {
  int map_fd;
  int /*<<< orphan*/ value;
  int /*<<< orphan*/ key;
};
typedef int /*<<< orphan*/ attr;

/* Variables and functions */
int /*<<< orphan*/ BPF_MAP_LOOKUP_ELEM;
int /*<<< orphan*/ __NR_bpf;
int /*<<< orphan*/ ptr_to_u64(void *);
int syscall(int /*<<< orphan*/, int /*<<< orphan*/, union bpf_attr *, int);
int bpf_lookup_elem(int fd, void *key, void *value) {
  union bpf_attr attr = {
      .map_fd = fd,
      .key = ptr_to_u64(key),
      .value = ptr_to_u64(value),
  };
  return syscall(__NR_bpf, BPF_MAP_LOOKUP_ELEM, &attr, sizeof(attr));
}


x86 assembly (clang, -O0):
<bpf_lookup_elem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <ptr_to_u64@plt>
mov    %eax,-0x20(%rbp)
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
mov    0x2e99(%rip),%rax
mov    (%rax),%esi
lea    -0x20(%rbp),%rdx
mov    $0x4,%ecx
call   1040 <syscall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bpf_lookup_elem>:
push   %rax
mov    %rdx,%rdi
call   1030 <ptr_to_u64@plt>
mov    %eax,(%rsp)
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
mov    0x2eac(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
mov    $0x4,%ecx
call   1040 <syscall@plt>
pop    %rcx
ret

LLVM IR (-O0):
%union.bpf_attr = type { i32 }
@__NR_bpf = global i32 0
@BPF_MAP_LOOKUP_ELEM = global i32 0
define i32 @bpf_lookup_elem(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca %union.bpf_attr
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = bitcast %union.bpf_attr* %7 to i32*
%9 = load i8*, i8** %6
%10 = call i32 @ptr_to_u64(i8* %9)
store i32 %10, i32* %8
%11 = load i32, i32* @__NR_bpf
%12 = load i32, i32* @BPF_MAP_LOOKUP_ELEM
%13 = call i32 @syscall(i32 %11, i32 %12, %union.bpf_attr* %7, i32 4)
ret i32 %13
}

LLVM IR (-O2):
%union.bpf_attr = type { i32 }
@__NR_bpf = global i32 0
@BPF_MAP_LOOKUP_ELEM = global i32 0
define i32 @bpf_lookup_elem(i32 %0, i8* nocapture readnone %1, i8* %2) {
%4 = alloca %union.bpf_attr
%5 = bitcast %union.bpf_attr* %4 to i8*
%6 = getelementptr inbounds %union.bpf_attr, %union.bpf_attr* %4, i64 0, i32 0
%7 = tail call i32 @ptr_to_u64(i8* %2)
store i32 %7, i32* %6
%8 = load i32, i32* @__NR_bpf
%9 = load i32, i32* @BPF_MAP_LOOKUP_ELEM
%10 = call i32 @syscall(i32 %8, i32 %9, %union.bpf_attr* %4, i32 4)
ret i32 %10
}
void sourceCallBack(void *info) {}


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

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

LLVM IR (-O0):
define void @sourceCallBack(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret void
}

LLVM IR (-O2):
define void @sourceCallBack(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puthex16(unsigned int);
puthex32(unsigned x) {
  puthex16(x >> 16);
  puthex16(x & 0xFFFF);
}


x86 assembly (clang, -O0):
<puthex32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
shr    $0x10,%edi
call   1030 <puthex16@plt>
mov    -0x8(%rbp),%edi
and    $0xffff,%edi
call   1030 <puthex16@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<puthex32>:
push   %rbx
mov    %edi,%ebx
shr    $0x10,%edi
call   1030 <puthex16@plt>
movzwl %bx,%edi
pop    %rbx
jmp    1030 <puthex16@plt>

LLVM IR (-O0):
define i32 @puthex32(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = lshr i32 %4, 16
%6 = call i32 @puthex16(i32 %5)
%7 = load i32, i32* %3
%8 = and i32 %7, 65535
%9 = call i32 @puthex16(i32 %8)
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
define i32 @puthex32(i32 %0) {
%2 = lshr i32 %0, 16
%3 = tail call i32 @puthex16(i32 %2)
%4 = and i32 %0, 65535
%5 = tail call i32 @puthex16(i32 %4)
ret i32 undef
}
/* Variables and functions */
double ceil(double);
double ILLutil_our_ceil(double x) { return ceil(x); }


x86 assembly (clang, -O0):
<ILLutil_our_ceil>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <ceil@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ILLutil_our_ceil>:
jmp    1030 <ceil@plt>

LLVM IR (-O0):
define double @ILLutil_our_ceil(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @llvm.ceil.f64(double %3)
ret double %4
}

LLVM IR (-O2):
define double @ILLutil_our_ceil(double %0) {
%2 = tail call double @llvm.ceil.f64(double %0)
ret double %2
}
/* Type definitions */
struct yamc_sub_args_info {
  int dummy;
};

/* Variables and functions */
int yamc_sub_cmd_parser2(int, char **, struct yamc_sub_args_info *,
                         int /*<<< orphan*/, int, int);
int yamc_sub_cmd_parser(int argc, char **argv,
                        struct yamc_sub_args_info *args_info) {
  return yamc_sub_cmd_parser2(argc, argv, args_info, 0, 1, 1);
}


x86 assembly (clang, -O0):
<yamc_sub_cmd_parser>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
xor    %ecx,%ecx
mov    $0x1,%r9d
mov    %r9d,%r8d
call   1030 <yamc_sub_cmd_parser2@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yamc_sub_cmd_parser>:
xor    %ecx,%ecx
mov    $0x1,%r8d
mov    $0x1,%r9d
jmp    1030 <yamc_sub_cmd_parser2@plt>

LLVM IR (-O0):
%struct.yamc_sub_args_info = type { i32 }
define i32 @yamc_sub_cmd_parser(i32 %0, i8** %1, %struct.yamc_sub_args_info* %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.yamc_sub_args_info*
store i32 %0, i32* %4
store i8** %1, i8*** %5
store %struct.yamc_sub_args_info* %2, %struct.yamc_sub_args_info** %6
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = load %struct.yamc_sub_args_info*, %struct.yamc_sub_args_info** %6
%10 = call i32 @yamc_sub_cmd_parser2(i32 %7, i8** %8, %struct.yamc_sub_args_info* %9, i32 0, i32 1, i32 1)
ret i32 %10
}

LLVM IR (-O2):
%struct.yamc_sub_args_info = type { i32 }
define i32 @yamc_sub_cmd_parser(i32 %0, i8** %1, %struct.yamc_sub_args_info* %2) {
%4 = tail call i32 @yamc_sub_cmd_parser2(i32 %0, i8** %1, %struct.yamc_sub_args_info* %2, i32 0, i32 1, i32 1)
ret i32 %4
}
/* Variables and functions */
scalar_t__ error();
int /*<<< orphan*/ init_object(int, unsigned long);
unsigned long region_size();
void define_region_type() {
  unsigned long size;
  size = region_size();
  init_object(42, size);
  if (error())
    return;
}


x86 assembly (clang, -O0):
<define_region_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <region_size@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0x2a,%edi
call   1030 <init_object@plt>
mov    $0x0,%al
call   1040 <error@plt>
cmp    $0x0,%rax
je     1167 <define_region_type+0x37>
jmp    1167 <define_region_type+0x37>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<define_region_type>:
push   %rax
xor    %eax,%eax
call   1050 <region_size@plt>
mov    $0x2a,%edi
mov    %rax,%rsi
call   1030 <init_object@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <error@plt>

LLVM IR (-O0):
define void @define_region_type() {
%1 = alloca i64
%2 = call i64 (...) @region_size()
store i64 %2, i64* %1
%3 = load i64, i64* %1
%4 = call i32 @init_object(i32 42, i64 %3)
%5 = call i64 (...) @error()
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %0
br label %8
8: ; preds = %7, %0
ret void
}

LLVM IR (-O2):
define void @define_region_type() {
%1 = tail call i64 (...) @region_size()
%2 = tail call i32 @init_object(i32 42, i64 %1)
%3 = tail call i64 (...) @error()
ret void
}
int zero(int x) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @zero(i32 %0) {
ret i32 0
}
void troca(int *a, int *b) {
  int temp;
  temp = *a;
  *a = *b;
  *b = temp;
}


x86 assembly (clang, -O0):
<troca>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<troca>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
mov    %ecx,(%rdi)
mov    %eax,(%rsi)
ret

LLVM IR (-O0):
define void @troca(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %3
%7 = load i32, i32* %6
store i32 %7, i32* %5
%8 = load i32*, i32** %4
%9 = load i32, i32* %8
%10 = load i32*, i32** %3
store i32 %9, i32* %10
%11 = load i32, i32* %5
%12 = load i32*, i32** %4
store i32 %11, i32* %12
ret void
}

LLVM IR (-O2):
define void @troca(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
store i32 %4, i32* %0
store i32 %3, i32* %1
ret void
}
void func1(char *x) {
  char *s = x;
  int i1;
  float f;
  s += 5;
  s += 'c';
  i1 += f;
}


x86 assembly (clang, -O0):
<func1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x5,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x63,%rax
mov    %rax,-0x10(%rbp)
movss  -0x18(%rbp),%xmm1
cvtsi2ssl -0x14(%rbp),%xmm0
addss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x14(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @func1(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca float
store i8* %0, i8** %2
%6 = load i8*, i8** %2
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i64 5
store i8* %8, i8** %3
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 99
store i8* %10, i8** %3
%11 = load float, float* %5
%12 = load i32, i32* %4
%13 = sitofp i32 %12 to float
%14 = fadd float %13, %11
%15 = fptosi float %14 to i32
store i32 %15, i32* %4
ret void
}

LLVM IR (-O2):
define void @func1(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strncpy(char *, char *, size_t);
void get_kernel(char *buffer, size_t size) {
  strncpy(buffer, "unknown UTS", size);
}


x86 assembly (clang, -O0):
<get_kernel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xed1(%rip),%rsi
call   1030 <strncpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_kernel>:
mov    %rsi,%rdx
lea    0xee6(%rip),%rsi
jmp    1030 <strncpy@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"unknown UTS\00"
define void @get_kernel(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i32 @strncpy(i8* %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i64 %6)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"unknown UTS\00"
define void @get_kernel(i8* %0, i64 %1) {
%3 = tail call i32 @strncpy(i8* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i64 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void Default(void) { printf("In Default\n"); }


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

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

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

LLVM IR (-O2):
@str = [11 x i8] c"In Default\00"
define void @Default() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gpio_direction(int, int);
int /*<<< orphan*/ gpio_export(int);
int /*<<< orphan*/ gpio_set(int, char);
int /*<<< orphan*/ sleep(int);
int main(void) {
  gpio_export(17);
  gpio_direction(17, 51);
  while (1) {
    gpio_set(17, '1');
    sleep(1);
    gpio_set(17, '0');
    sleep(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x11,%edi
call   1030 <gpio_export@plt>
mov    $0x11,%edi
mov    $0x33,%esi
call   1040 <gpio_direction@plt>
mov    $0x11,%edi
mov    $0x31,%esi
call   1050 <gpio_set@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
mov    $0x11,%edi
mov    $0x30,%esi
call   1050 <gpio_set@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
jmp    1168 <main+0x28>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x11,%edi
call   1030 <gpio_export@plt>
mov    $0x11,%edi
mov    $0x33,%esi
call   1040 <gpio_direction@plt>
nopw   0x0(%rax,%rax,1)
mov    $0x11,%edi
mov    $0x31,%esi
call   1050 <gpio_set@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
mov    $0x11,%edi
mov    $0x30,%esi
call   1050 <gpio_set@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
jmp    1160 <main+0x20>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @gpio_export(i32 17)
%3 = call i32 @gpio_direction(i32 17, i32 51)
br label %4
4: ; preds = %0, %4
%5 = call i32 @gpio_set(i32 17, i8 signext 49)
%6 = call i32 @sleep(i32 1)
%7 = call i32 @gpio_set(i32 17, i8 signext 48)
%8 = call i32 @sleep(i32 1)
br label %4
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @gpio_export(i32 17)
%2 = tail call i32 @gpio_direction(i32 17, i32 51)
br label %3
3: ; preds = %0, %3
%4 = tail call i32 @gpio_set(i32 17, i8 signext 49)
%5 = tail call i32 @sleep(i32 1)
%6 = tail call i32 @gpio_set(i32 17, i8 signext 48)
%7 = tail call i32 @sleep(i32 1)
br label %3
}
/* Variables and functions */
int /*<<< orphan*/ db_output(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ iprintf(char *);
int siprintf(char *, char *, int);
int db_printf1(char *format, int i1) {
  char buf[200];
  int res = siprintf(buf, format, i1);
  if (res == -1) {
    iprintf("ERROR - Debug call to asprintf failed\n");
    exit(-1);
  }
  db_output(buf);
  return res;
}


x86 assembly (clang, -O0):
<db_printf1>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0xe0(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <siprintf@plt>
mov    %eax,-0xe4(%rbp)
cmpl   $0xffffffff,-0xe4(%rbp)
jne    118e <db_printf1+0x4e>
lea    0xe81(%rip),%rdi
call   1060 <iprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
lea    -0xe0(%rbp),%rdi
call   1040 <db_output@plt>
mov    -0xe4(%rbp),%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<db_printf1>:
push   %rbx
sub    $0xd0,%rsp
mov    %esi,%edx
mov    %rdi,%rsi
mov    %rsp,%rdi
call   1030 <siprintf@plt>
cmp    $0xffffffff,%eax
je     116f <db_printf1+0x2f>
mov    %eax,%ebx
mov    %rsp,%rdi
call   1040 <db_output@plt>
mov    %ebx,%eax
add    $0xd0,%rsp
pop    %rbx
ret
lea    0xe8a(%rip),%rdi
call   1060 <iprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [39 x i8] c"ERROR - Debug call to asprintf failed\0A\00"
define i32 @db_printf1(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [200 x i8]
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%8 = load i8*, i8** %3
%9 = load i32, i32* %4
%10 = call i32 @siprintf(i8* %7, i8* %8, i32 %9)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = call i32 @iprintf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @exit(i32 -1)
unreachable
16: ; preds = %2
%17 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%18 = call i32 @db_output(i8* %17)
%19 = load i32, i32* %6
ret i32 %19
}

LLVM IR (-O2):
@.str = [39 x i8] c"ERROR - Debug call to asprintf failed\0A\00"
define i32 @db_printf1(i8* %0, i32 %1) {
%3 = alloca [200 x i8]
%4 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%5 = call i32 @siprintf(i8* %4, i8* %0, i32 %1)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = call i32 @iprintf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @exit(i32 -1)
unreachable
10: ; preds = %2
%11 = call i32 @db_output(i8* %4)
ret i32 %5
}
/* Variables and functions */
int abs(int);
int getDistance__oneComponent(int x1, int x2, int y1, int y2) {
  return abs(x1 - x2);
}


x86 assembly (clang, -O0):
<getDistance__oneComponent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
sub    -0x8(%rbp),%edi
call   1030 <abs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getDistance__oneComponent>:
sub    %esi,%edi
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
ret

LLVM IR (-O0):
define i32 @getDistance__oneComponent(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = sub nsw i32 %9, %10
%12 = call i32 @abs(i32 %11)
ret i32 %12
}

LLVM IR (-O2):
define i32 @getDistance__oneComponent(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = sub nsw i32 %0, %1
%6 = tail call i32 @llvm.abs.i32(i32 %5, i1 true)
ret i32 %6
}