xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ Round200(void *, int);
int /*<<< orphan*/ add_Byte(void *, int, int);
void Ketje_step(void *state, unsigned int size, unsigned char padding) {
  add_Byte(state, padding, size);
  add_Byte(state, 0x08, 2);
  int i = 0;
  for (i = (18 - 1); i < 18; i++) {
    Round200(state, i);
  }
}


x86 assembly (clang, -O0):
<Ketje_step>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rdi
movzbl -0xd(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <add_Byte@plt>
mov    -0x8(%rbp),%rdi
mov    $0x8,%esi
mov    $0x2,%edx
call   1030 <add_Byte@plt>
movl   $0x0,-0x14(%rbp)
movl   $0x11,-0x14(%rbp)
cmpl   $0x12,-0x14(%rbp)
jge    1189 <Ketje_step+0x69>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <Round200@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1165 <Ketje_step+0x45>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Ketje_step>:
push   %rbx
mov    %esi,%eax
mov    %rdi,%rbx
mov    %edx,%esi
mov    %eax,%edx
call   1030 <add_Byte@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
mov    $0x2,%edx
call   1030 <add_Byte@plt>
mov    %rbx,%rdi
mov    $0x11,%esi
pop    %rbx
jmp    1040 <Round200@plt>

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

LLVM IR (-O2):
define void @Ketje_step(i8* %0, i32 %1, i8 zeroext %2) {
%4 = zext i8 %2 to i32
%5 = tail call i32 @add_Byte(i8* %0, i32 %4, i32 %1)
%6 = tail call i32 @add_Byte(i8* %0, i32 8, i32 2)
%7 = tail call i32 @Round200(i8* %0, i32 17)
ret void
}
unsigned long get_cr2(void) {
  unsigned long cr2;
  __asm__ volatile("mov %%cr2, %0" : "=r"(cr2));
  return (cr2);
}


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

x86 assembly (clang, -O2):
<get_cr2>:
mov    %cr2,%rax
ret

LLVM IR (-O0):
define i64 @get_cr2() {
%1 = alloca i64
%2 = call i64 asm sideeffect "mov %cr2, $0", "=r,~{dirflag},~{fpsr},~{flags}"()
store i64 %2, i64* %1
%3 = load i64, i64* %1
ret i64 %3
}

LLVM IR (-O2):
define i64 @get_cr2() {
%1 = tail call i64 asm sideeffect "mov %cr2, $0", "=r,~{dirflag},~{fpsr},~{flags}"()
ret i64 %1
}
void rop3_63_1_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  stk1 = T & S;
  stk1 = ~stk1;
  *D = (stk1 & (~S) & (~T)) | (*D & S) | (*D & T);
}


x86 assembly (clang, -O0):
<rop3_63_1_1>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0x9(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
movzbl -0xa(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0xa(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_63_1_1>:
mov    %edx,%eax
or     %sil,%al
not    %al
mov    (%rdi),%cl
and    %cl,%sil
or     %al,%sil
and    %dl,%cl
or     %sil,%cl
mov    %cl,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_63_1_1(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%8 = load i8, i8* %6
%9 = zext i8 %8 to i32
%10 = load i8, i8* %5
%11 = zext i8 %10 to i32
%12 = and i32 %9, %11
%13 = trunc i32 %12 to i8
store i8 %13, i8* %7
%14 = load i8, i8* %7
%15 = zext i8 %14 to i32
%16 = xor i32 %15, -1
%17 = trunc i32 %16 to i8
store i8 %17, i8* %7
%18 = load i8, i8* %7
%19 = zext i8 %18 to i32
%20 = load i8, i8* %5
%21 = zext i8 %20 to i32
%22 = xor i32 %21, -1
%23 = and i32 %19, %22
%24 = load i8, i8* %6
%25 = zext i8 %24 to i32
%26 = xor i32 %25, -1
%27 = and i32 %23, %26
%28 = load i8*, i8** %4
%29 = load i8, i8* %28
%30 = zext i8 %29 to i32
%31 = load i8, i8* %5
%32 = zext i8 %31 to i32
%33 = and i32 %30, %32
%34 = or i32 %27, %33
%35 = load i8*, i8** %4
%36 = load i8, i8* %35
%37 = zext i8 %36 to i32
%38 = load i8, i8* %6
%39 = zext i8 %38 to i32
%40 = and i32 %37, %39
%41 = or i32 %34, %40
%42 = trunc i32 %41 to i8
%43 = load i8*, i8** %4
store i8 %42, i8* %43
ret void
}

LLVM IR (-O2):
define void @rop3_63_1_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = or i8 %2, %1
%5 = xor i8 %4, -1
%6 = load i8, i8* %0
%7 = and i8 %6, %1
%8 = or i8 %7, %5
%9 = and i8 %6, %2
%10 = or i8 %8, %9
store i8 %10, i8* %0
ret void
}
int GetSocketNagleAlgorithm(const int fd __attribute__((__unused__))) {
  ;
  return (-1);
}


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

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

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

LLVM IR (-O2):
define i32 @GetSocketNagleAlgorithm(i32 %0) {
ret i32 -1
}
int bitset_index(int x, int y, int width) { return (y * width + x) / 32; }


x86 assembly (clang, -O0):
<bitset_index>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
add    -0x4(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitset_index>:
imul   %edx,%esi
lea    (%rsi,%rdi,1),%eax
add    $0x1f,%eax
mov    %esi,%ecx
add    %edi,%ecx
cmovns %ecx,%eax
sar    $0x5,%eax
ret

LLVM IR (-O0):
define i32 @bitset_index(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* %5
%8 = load i32, i32* %6
%9 = mul nsw i32 %7, %8
%10 = load i32, i32* %4
%11 = add nsw i32 %9, %10
%12 = sdiv i32 %11, 32
ret i32 %12
}

LLVM IR (-O2):
define i32 @bitset_index(i32 %0, i32 %1, i32 %2) {
%4 = mul nsw i32 %2, %1
%5 = add nsw i32 %4, %0
%6 = sdiv i32 %5, 32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ set_path(char *);
void add_etc_to_path(void) { set_path("/etc"); }


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

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

LLVM IR (-O0):
@.str = [5 x i8] c"/etc\00"
define void @add_etc_to_path() {
%1 = call i32 @set_path(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"/etc\00"
define void @add_etc_to_path() {
%1 = tail call i32 @set_path(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int __syscall(int, void *, void *);
int errno;
int _gettimeofday(void *tp, void *tzp) {
  int err;
  err = __syscall(116, tp, tzp);
  if (err < 0) {
    errno = -err;
    return -1;
  }
  return err;
}


x86 assembly (clang, -O0):
<_gettimeofday>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    $0x74,%edi
call   1030 <__syscall@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    1159 <_gettimeofday+0x49>
xor    %ecx,%ecx
sub    -0x1c(%rbp),%ecx
mov    0x2e95(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    115f <_gettimeofday+0x4f>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_gettimeofday>:
push   %rax
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    $0x74,%edi
call   1030 <__syscall@plt>
test   %eax,%eax
js     1127 <_gettimeofday+0x17>
pop    %rcx
ret
neg    %eax
mov    0x2eb0(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@errno = global i32 0
define i32 @_gettimeofday(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = call i32 @__syscall(i32 116, i8* %7, i8* %8)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i32, i32* %6
%14 = sub nsw i32 0, %13
store i32 %14, i32* @errno
store i32 -1, i32* %3
br label %17
15: ; preds = %2
%16 = load i32, i32* %6
store i32 %16, i32* %3
br label %17
17: ; preds = %15, %12
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
@errno = global i32 0
define i32 @_gettimeofday(i8* %0, i8* %1) {
%3 = tail call i32 @__syscall(i32 116, i8* %0, i8* %1)
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = sub nsw i32 0, %3
store i32 %6, i32* @errno
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ -1, %5 ], [ %3, %2 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ testfunc(int, float, char, long long, int, int);
int main() {
  testfunc(12, 1.245f, 'x', 123456677890LL, -10, 45e14);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xc,%edi
movss  0xed4(%rip),%xmm0
mov    $0x78,%esi
movabs $0x1cbe976802,%rdx
mov    $0xfffffff6,%ecx
call   1030 <testfunc@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movss  0xee7(%rip),%xmm0
movabs $0x1cbe976802,%rdx
mov    $0xc,%edi
mov    $0x78,%esi
mov    $0xfffffff6,%ecx
call   1030 <testfunc@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @testfunc(i32 12, float 0x3FF3EB8520000000, i8 signext 120, i64 123456677890, i32 -10, i32 poison)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @testfunc(i32 12, float 0x3FF3EB8520000000, i8 signext 120, i64 123456677890, i32 -10, i32 poison)
ret i32 0
}
int *vector_clear(int k, int *v) {
  int i;
  for (i = 0; i < k; ++i)
    v[i] = 0;
  return v;
}


x86 assembly (clang, -O0):
<vector_clear>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    113b <vector_clear+0x3b>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1112 <vector_clear+0x12>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<vector_clear>:
push   %rbx
mov    %rsi,%rbx
test   %edi,%edi
jle    1128 <vector_clear+0x18>
mov    %edi,%edx
shl    $0x2,%rdx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32* @vector_clear(i32 %0, i32* returned writeonly %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = bitcast i32* %1 to i8*
%6 = zext i32 %0 to i64
%7 = shl nuw nsw i64 %6, 2
br label %8
8: ; preds = %4, %2
ret i32* %1
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
void u32_cpy(void *a, void *b) { *(uint32_t *)a = *(uint32_t *)b; }


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

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

LLVM IR (-O0):
define void @u32_cpy(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %3
%9 = bitcast i8* %8 to i32*
store i32 %7, i32* %9
ret void
}

LLVM IR (-O2):
define void @u32_cpy(i8* nocapture writeonly %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %0 to i32*
store i32 %4, i32* %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gtia_set_byte_blank();
void antic_send_byte_mode_blank(void) { gtia_set_byte_blank(); }


x86 assembly (clang, -O0):
<antic_send_byte_mode_blank>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <gtia_set_byte_blank@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<antic_send_byte_mode_blank>:
xor    %eax,%eax
jmp    1030 <gtia_set_byte_blank@plt>

LLVM IR (-O0):
define void @antic_send_byte_mode_blank() {
%1 = call i32 (...) @gtia_set_byte_blank()
ret void
}

LLVM IR (-O2):
define void @antic_send_byte_mode_blank() {
%1 = tail call i32 (...) @gtia_set_byte_blank()
ret void
}
int test_imm_ADuint8_mem(unsigned char *val) {
  return ((*val) & (0xAD << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_ADuint8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%edx
and    $0xad,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_ADuint8_mem>:
testb  $0xad,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_ADuint8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = and i32 %5, 173
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_ADuint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -83
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void grid_alloc_init(void) {}


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

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

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

LLVM IR (-O2):
define void @grid_alloc_init() {
ret void
}
int fdump_(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @fdump_() {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int maxK(int *, int, int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int a[] = {1, 7, 9, 3, 2, 2, 16, 40};
  int k = 2;
  int v = maxK(a, k, (int)sizeof(a) / sizeof(a[0]));
  printf("%d\n", v);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xebd(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x2,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    $0x8,%edx
call   1040 <maxK@plt>
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%esi
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movaps 0xee5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x2,%esi
mov    $0x8,%edx
call   1040 <maxK@plt>
lea    0xecc(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [8 x i32] [i32 1, i32 7, i32 9, i32 3, i32 2, i32 2, i32 16, i32 40]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [8 x i32]
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = bitcast [8 x i32]* %6 to i8*
store i32 2, i32* %7
%10 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 0
%11 = load i32, i32* %7
%12 = call i32 @maxK(i32* %10, i32 %11, i32 8)
store i32 %12, i32* %8
%13 = load i32, i32* %8
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %13)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [8 x i32] [i32 1, i32 7, i32 9, i32 3, i32 2, i32 2, i32 16, i32 40]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [8 x i32]
%4 = bitcast [8 x i32]* %3 to i8*
%5 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 0
%6 = call i32 @maxK(i32* %5, i32 2, i32 8)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ TrimAnglesHandle();
int /*<<< orphan*/ UAVObjUpdated(int /*<<< orphan*/);
void TrimAnglesUpdated() { UAVObjUpdated(TrimAnglesHandle()); }


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

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

LLVM IR (-O0):
define void @TrimAnglesUpdated() {
%1 = call i32 (...) @TrimAnglesHandle()
%2 = call i32 @UAVObjUpdated(i32 %1)
ret void
}

LLVM IR (-O2):
define void @TrimAnglesUpdated() {
%1 = tail call i32 (...) @TrimAnglesHandle()
%2 = tail call i32 @UAVObjUpdated(i32 %1)
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
void encle32(const uint32_t n, void *_b) {
  uint8_t *b = (uint8_t *)_b;
  b[0] = (n >> 0) & 0xff;
  b[1] = (n >> 8) & 0xff;
  b[2] = (n >> 16) & 0xff;
  b[3] = (n >> 24) & 0xff;
}


x86 assembly (clang, -O0):
<encle32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%ecx
sar    $0x0,%ecx
and    $0xff,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x4(%rbp),%ecx
sar    $0x10,%ecx
and    $0xff,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x4(%rbp),%ecx
sar    $0x18,%ecx
and    $0xff,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<encle32>:
mov    %edi,%eax
movzbl %al,%ecx
mov    %ecx,(%rsi)
movzbl %ah,%ecx
mov    %ecx,0x4(%rsi)
mov    %edi,%ecx
shr    $0x10,%ecx
movzbl %cl,%ecx
mov    %ecx,0x8(%rsi)
shr    $0x18,%eax
mov    %eax,0xc(%rsi)
ret

LLVM IR (-O0):
define void @encle32(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32*
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = bitcast i8* %6 to i32*
store i32* %7, i32** %5
%8 = load i32, i32* %3
%9 = ashr i32 %8, 0
%10 = and i32 %9, 255
%11 = load i32*, i32** %5
%12 = getelementptr inbounds i32, i32* %11, i64 0
store i32 %10, i32* %12
%13 = load i32, i32* %3
%14 = ashr i32 %13, 8
%15 = and i32 %14, 255
%16 = load i32*, i32** %5
%17 = getelementptr inbounds i32, i32* %16, i64 1
store i32 %15, i32* %17
%18 = load i32, i32* %3
%19 = ashr i32 %18, 16
%20 = and i32 %19, 255
%21 = load i32*, i32** %5
%22 = getelementptr inbounds i32, i32* %21, i64 2
store i32 %20, i32* %22
%23 = load i32, i32* %3
%24 = ashr i32 %23, 24
%25 = and i32 %24, 255
%26 = load i32*, i32** %5
%27 = getelementptr inbounds i32, i32* %26, i64 3
store i32 %25, i32* %27
ret void
}

LLVM IR (-O2):
define void @encle32(i32 %0, i8* nocapture writeonly %1) {
%3 = bitcast i8* %1 to i32*
%4 = and i32 %0, 255
store i32 %4, i32* %3
%5 = lshr i32 %0, 8
%6 = and i32 %5, 255
%7 = getelementptr inbounds i8, i8* %1, i64 4
%8 = bitcast i8* %7 to i32*
store i32 %6, i32* %8
%9 = lshr i32 %0, 16
%10 = and i32 %9, 255
%11 = getelementptr inbounds i8, i8* %1, i64 8
%12 = bitcast i8* %11 to i32*
store i32 %10, i32* %12
%13 = lshr i32 %0, 24
%14 = getelementptr inbounds i8, i8* %1, i64 12
%15 = bitcast i8* %14 to i32*
store i32 %13, i32* %15
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printLanguageList();
void processListLanguagesOption(const char *const option
                                __attribute__((unused)),
                                const char *const parameter
                                __attribute__((unused))) {
  printLanguageList();
  exit(0);
}


x86 assembly (clang, -O0):
<processListLanguagesOption>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <printLanguageList@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<processListLanguagesOption>:
push   %rax
xor    %eax,%eax
call   1030 <printLanguageList@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @processListLanguagesOption(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = call i32 (...) @printLanguageList()
%6 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @processListLanguagesOption(i8* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = tail call i32 (...) @printLanguageList()
%4 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int mvprintw(int, int, char const *);
int n_mvprintw(int y, int x, const char *fmt) { return (mvprintw(y, x, fmt)); }


x86 assembly (clang, -O0):
<n_mvprintw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1030 <mvprintw@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<n_mvprintw>:
jmp    1030 <mvprintw@plt>

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

LLVM IR (-O2):
define i32 @n_mvprintw(i32 %0, i32 %1, i8* %2) {
%4 = tail call i32 @mvprintw(i32 %0, i32 %1, i8* %2)
ret i32 %4
}
int is_ordering_lossy(int ordering) {
  return (
      ((ordering) ==
       (((int)-(((int)0x37EF)
                << (8 * (((!!(((!!(sizeof(int))) * ((sizeof(int)) - 1)))) *
                          ((((!!(sizeof(int))) * ((sizeof(int)) - 1))) -
                           1)))))))) ||
      ((ordering) ==
       (((int)-(
           ((int)-(((int)0x37EF)
                   << (8 * (((!!(((!!(sizeof(int))) * ((sizeof(int)) - 1)))) *
                             ((((!!(sizeof(int))) * ((sizeof(int)) - 1))) -
                              1)))))))))) ||
      ((ordering) ==
       (((int)-(
           ((int)-(((int)0x37EE)
                   << (8 * (((!!(((!!(sizeof(int))) * ((sizeof(int)) - 1)))) *
                             ((((!!(sizeof(int))) * ((sizeof(int)) - 1))) -
                              1)))))))))) ||
      ((ordering) ==
       (((int)-(
           ((int)-(((int)0x37ED)
                   << (8 * (((!!(((!!(sizeof(int))) * ((sizeof(int)) - 1)))) *
                             ((((!!(sizeof(int))) * ((sizeof(int)) - 1))) -
                              1)))))))))));
}


x86 assembly (clang, -O0):
<is_ordering_lossy>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0xc8110000,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     114a <is_ordering_lossy+0x4a>
mov    $0x1,%al
cmpl   $0x37ef0000,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     114a <is_ordering_lossy+0x4a>
mov    $0x1,%al
cmpl   $0x37ee0000,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     114a <is_ordering_lossy+0x4a>
cmpl   $0x37ed0000,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_ordering_lossy>:
mov    $0x1,%eax
cmp    $0xc8110000,%edi
je     1128 <is_ordering_lossy+0x28>
cmp    $0x37ee0000,%edi
je     1128 <is_ordering_lossy+0x28>
cmp    $0x37ef0000,%edi
je     1128 <is_ordering_lossy+0x28>
xor    %eax,%eax
cmp    $0x37ed0000,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @is_ordering_lossy(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, -938409984
br i1 %4, label %14, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 938409984
br i1 %7, label %14, label %8
8: ; preds = %5
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 938344448
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 938278912
br label %14
14: ; preds = %11, %8, %5, %1
%15 = phi i1 [ true, %8 ], [ true, %5 ], [ true, %1 ], [ %13, %11 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @is_ordering_lossy(i32 %0) {
switch i32 %0, label %2 [
i32 -938409984, label %5
i32 938409984, label %5
i32 938344448, label %5
]
2: ; preds = %1
%3 = icmp eq i32 %0, 938278912
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %1, %1, %1, %2
%6 = phi i32 [ 1, %1 ], [ %4, %2 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %6
}
unsigned int BUS_compute_shuffled_ADDRESS(unsigned int A, unsigned int B,
                                          unsigned C) {
  unsigned int address = ((A & 0x6000) << 1) | ((B & 0x0700) >> 8) |
                         ((B & 0x0018) << 7) | (C & 0x33F8);
  return address;
}


x86 assembly (clang, -O0):
<BUS_compute_shuffled_ADDRESS>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    $0x6000,%eax
shl    $0x1,%eax
mov    -0x8(%rbp),%ecx
and    $0x700,%ecx
shr    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    $0x18,%ecx
shl    $0x7,%ecx
or     %ecx,%eax
mov    -0xc(%rbp),%ecx
and    $0x33f8,%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<BUS_compute_shuffled_ADDRESS>:
and    $0x6000,%edi
mov    %esi,%eax
shr    $0x8,%eax
and    $0x7,%eax
lea    (%rax,%rdi,2),%eax
and    $0x18,%esi
shl    $0x7,%esi
or     %esi,%eax
and    $0x33f8,%edx
or     %edx,%eax
ret

LLVM IR (-O0):
define i32 @BUS_compute_shuffled_ADDRESS(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = and i32 %8, 24576
%10 = shl i32 %9, 1
%11 = load i32, i32* %5
%12 = and i32 %11, 1792
%13 = lshr i32 %12, 8
%14 = or i32 %10, %13
%15 = load i32, i32* %5
%16 = and i32 %15, 24
%17 = shl i32 %16, 7
%18 = or i32 %14, %17
%19 = load i32, i32* %6
%20 = and i32 %19, 13304
%21 = or i32 %18, %20
store i32 %21, i32* %7
%22 = load i32, i32* %7
ret i32 %22
}

LLVM IR (-O2):
define i32 @BUS_compute_shuffled_ADDRESS(i32 %0, i32 %1, i32 %2) {
%4 = shl i32 %0, 1
%5 = and i32 %4, 49152
%6 = lshr i32 %1, 8
%7 = and i32 %6, 7
%8 = or i32 %7, %5
%9 = shl i32 %1, 7
%10 = and i32 %9, 3072
%11 = or i32 %8, %10
%12 = and i32 %2, 13304
%13 = or i32 %11, %12
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ test_inc_dec();
int /*<<< orphan*/ test_inc_dec_float();
int /*<<< orphan*/ test_inc_dec_pointer();
int /*<<< orphan*/ test_minus_plus();
int main() {
  test_inc_dec();
  test_inc_dec_float();
  test_inc_dec_pointer();
  test_minus_plus();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <test_inc_dec@plt>
mov    $0x0,%al
call   1050 <test_inc_dec_float@plt>
mov    $0x0,%al
call   1060 <test_inc_dec_pointer@plt>
mov    $0x0,%al
call   1030 <test_minus_plus@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <test_inc_dec@plt>
xor    %eax,%eax
call   1050 <test_inc_dec_float@plt>
xor    %eax,%eax
call   1060 <test_inc_dec_pointer@plt>
xor    %eax,%eax
call   1030 <test_minus_plus@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test_inc_dec()
%3 = call i32 (...) @test_inc_dec_float()
%4 = call i32 (...) @test_inc_dec_pointer()
%5 = call i32 (...) @test_minus_plus()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_inc_dec()
%2 = tail call i32 (...) @test_inc_dec_float()
%3 = tail call i32 (...) @test_inc_dec_pointer()
%4 = tail call i32 (...) @test_minus_plus()
ret i32 0
}
void board_putc(int ch) {
  while ((*(volatile unsigned int *)(0xB2600000 + (0x18)) & (1 << 7)) == 0)
    ;
  *(volatile unsigned int *)(0xB2600000 + (0x00)) = (ch);
  while ((*(volatile unsigned int *)(0xB2600000 + (0x18)) & (1 << 7)) == 0)
    ;
}


x86 assembly (clang, -O0):
<board_putc>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0xb2600018,%eax
mov    (%rax),%eax
and    $0x80,%eax
cmp    $0x0,%eax
jne    1121 <board_putc+0x21>
jmp    1107 <board_putc+0x7>
mov    -0x4(%rbp),%ecx
mov    $0xb2600000,%eax
mov    %ecx,(%rax)
mov    $0xb2600018,%eax
mov    (%rax),%eax
and    $0x80,%eax
cmp    $0x0,%eax
jne    1145 <board_putc+0x45>
jmp    112b <board_putc+0x2b>
pop    %rbp
ret

x86 assembly (clang, -O2):
<board_putc>:
mov    $0xb2600018,%eax
cs nopw 0x0(%rax,%rax,1)
nop
testl  $0x80,(%rax)
je     1110 <board_putc+0x10>
mov    %edi,-0x18(%rax)
nopl   0x0(%rax,%rax,1)
testl  $0x80,(%rax)
je     1120 <board_putc+0x20>
ret

LLVM IR (-O0):
define void @board_putc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %7, %1
%4 = load volatile i32, i32* inttoptr (i64 2992635928 to i32*)
%5 = and i32 %4, 128
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %3
br label %3
8: ; preds = %3
%9 = load i32, i32* %2
store volatile i32 %9, i32* inttoptr (i64 2992635904 to i32*)
br label %10
10: ; preds = %14, %8
%11 = load volatile i32, i32* inttoptr (i64 2992635928 to i32*)
%12 = and i32 %11, 128
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %10
br label %10
15: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @board_putc(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = load volatile i32, i32* inttoptr (i64 2992635928 to i32*)
%4 = and i32 %3, 128
%5 = icmp eq i32 %4, 0
br i1 %5, label %2, label %6
6: ; preds = %2
store volatile i32 %0, i32* inttoptr (i64 2992635904 to i32*)
br label %7
7: ; preds = %7, %6
%8 = load volatile i32, i32* inttoptr (i64 2992635928 to i32*)
%9 = and i32 %8, 128
%10 = icmp eq i32 %9, 0
br i1 %10, label %7, label %11
11: ; preds = %7
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("USAGE:\n");
  printf("pkp c [username] [ip]\n");
  printf("pkp s [username] \n");
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xee3(%rip),%rdi
call   1030 <puts@plt>
lea    0xeed(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"USAGE:\0A\00"
@.str.1 = [23 x i8] c"pkp c [username] [ip]\0A\00"
@.str.2 = [19 x i8] c"pkp s [username] \0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [7 x i8] c"USAGE:\00"
@str.3 = [22 x i8] c"pkp c [username] [ip]\00"
@str.4 = [18 x i8] c"pkp s [username] \00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.4, i64 0, i64 0))
ret void
}
/* Variables and functions */
int close(int);
int errno;
int os_closesocket(int socketdesc) {
  int retval;
  retval = close(socketdesc);
  if (retval == -1)
    retval = -errno;
  return retval;
}


x86 assembly (clang, -O0):
<os_closesocket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    113e <os_closesocket+0x2e>
xor    %eax,%eax
mov    0x2ea7(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<os_closesocket>:
push   %rax
call   1030 <close@plt>
mov    0x2ec3(%rip),%rcx
xor    %edx,%edx
sub    (%rcx),%edx
cmp    $0xffffffff,%eax
cmove  %edx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@errno = global i32 0
define i32 @os_closesocket(i32 %0) {
%2 = tail call i32 @close(i32 %0)
%3 = icmp eq i32 %2, -1
%4 = load i32, i32* @errno
%5 = sub nsw i32 0, %4
%6 = select i1 %3, i32 %5, i32 %2
ret i32 %6
}
/* Variables and functions */
int bar();
int foo();
int main() { return foo() - bar(); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <foo@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <bar@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <foo@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <bar@plt>
sub    %eax,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @foo()
%3 = call i32 (...) @bar()
%4 = sub nsw i32 %2, %3
ret i32 %4
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @foo()
%2 = tail call i32 (...) @bar()
%3 = sub nsw i32 %1, %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ nrf_802154_swi_timeslot_exit_terminate();
void nrf_802154_priority_drop_timeslot_exit_terminate(void) {
  nrf_802154_swi_timeslot_exit_terminate();
}


x86 assembly (clang, -O0):
<nrf_802154_priority_drop_timeslot_exit_terminate>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <nrf_802154_swi_timeslot_exit_terminate@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<nrf_802154_priority_drop_timeslot_exit_terminate>:
xor    %eax,%eax
jmp    1030 <nrf_802154_swi_timeslot_exit_terminate@plt>

LLVM IR (-O0):
define void @nrf_802154_priority_drop_timeslot_exit_terminate() {
%1 = call i32 (...) @nrf_802154_swi_timeslot_exit_terminate()
ret void
}

LLVM IR (-O2):
define void @nrf_802154_priority_drop_timeslot_exit_terminate() {
%1 = tail call i32 (...) @nrf_802154_swi_timeslot_exit_terminate()
ret void
}
/* Type definitions */
struct timezone {
  int dummy;
};
struct timeval {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ bt_sys_gettimeofday(struct timeval *, struct timezone *);
int gettimeofday(struct timeval *p, struct timezone *z) {
  bt_sys_gettimeofday(p, z);
  return 0;
}


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

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

LLVM IR (-O0):
%struct.timeval = type { i32 }
%struct.timezone = type { i32 }
define i32 @gettimeofday(%struct.timeval* %0, %struct.timezone* %1) {
%3 = alloca %struct.timeval*
%4 = alloca %struct.timezone*
store %struct.timeval* %0, %struct.timeval** %3
store %struct.timezone* %1, %struct.timezone** %4
%5 = load %struct.timeval*, %struct.timeval** %3
%6 = load %struct.timezone*, %struct.timezone** %4
%7 = call i32 @bt_sys_gettimeofday(%struct.timeval* %5, %struct.timezone* %6)
ret i32 0
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
%struct.timezone = type { i32 }
define i32 @gettimeofday(%struct.timeval* %0, %struct.timezone* %1) {
%3 = tail call i32 @bt_sys_gettimeofday(%struct.timeval* %0, %struct.timezone* %1)
ret i32 0
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int p264_tapfilter1(uint8_t *pix) {
  return pix[-2] - 5 * pix[-1] + 20 * (pix[0] + pix[1]) - 5 * pix[2] + pix[3];
}


x86 assembly (clang, -O0):
<p264_tapfilter1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x8(%rax),%eax
mov    -0x8(%rbp),%rcx
imul   $0x5,-0x4(%rcx),%ecx
sub    %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%ecx
mov    -0x8(%rbp),%rdx
add    0x4(%rdx),%ecx
imul   $0x14,%ecx,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%rcx
imul   $0x5,0x8(%rcx),%ecx
sub    %ecx,%eax
mov    -0x8(%rbp),%rcx
add    0xc(%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<p264_tapfilter1>:
mov    0x4(%rdi),%eax
mov    0x8(%rdi),%ecx
add    (%rdi),%eax
lea    (%rax,%rax,4),%eax
shl    $0x2,%eax
add    -0x4(%rdi),%ecx
add    -0x8(%rdi),%eax
lea    (%rcx,%rcx,4),%ecx
add    0xc(%rdi),%eax
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @p264_tapfilter1(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 -2
%5 = load i32, i32* %4
%6 = load i32*, i32** %2
%7 = getelementptr inbounds i32, i32* %6, i64 -1
%8 = load i32, i32* %7
%9 = mul nsw i32 5, %8
%10 = sub nsw i32 %5, %9
%11 = load i32*, i32** %2
%12 = getelementptr inbounds i32, i32* %11, i64 0
%13 = load i32, i32* %12
%14 = load i32*, i32** %2
%15 = getelementptr inbounds i32, i32* %14, i64 1
%16 = load i32, i32* %15
%17 = add nsw i32 %13, %16
%18 = mul nsw i32 20, %17
%19 = add nsw i32 %10, %18
%20 = load i32*, i32** %2
%21 = getelementptr inbounds i32, i32* %20, i64 2
%22 = load i32, i32* %21
%23 = mul nsw i32 5, %22
%24 = sub nsw i32 %19, %23
%25 = load i32*, i32** %2
%26 = getelementptr inbounds i32, i32* %25, i64 3
%27 = load i32, i32* %26
%28 = add nsw i32 %24, %27
ret i32 %28
}

LLVM IR (-O2):
define i32 @p264_tapfilter1(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 -2
%3 = load i32, i32* %2
%4 = getelementptr inbounds i32, i32* %0, i64 -1
%5 = load i32, i32* %4
%6 = load i32, i32* %0
%7 = getelementptr inbounds i32, i32* %0, i64 1
%8 = load i32, i32* %7
%9 = add nsw i32 %8, %6
%10 = mul nsw i32 %9, 20
%11 = getelementptr inbounds i32, i32* %0, i64 2
%12 = load i32, i32* %11
%13 = getelementptr inbounds i32, i32* %0, i64 3
%14 = load i32, i32* %13
%15 = add i32 %12, %5
%16 = mul i32 %15, -5
%17 = add i32 %10, %3
%18 = add i32 %17, %14
%19 = add i32 %18, %16
ret i32 %19
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int copy_quaddobl_Laurent_container_to_start_system(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc4c(779, a, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<copy_quaddobl_Laurent_container_to_start_system>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x30b,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_quaddobl_Laurent_container_to_start_system>:
mov    $0x30b,%edi
xor    %r8d,%r8d
jmp    1030 <_ada_use_c2phc4c@plt>

LLVM IR (-O0):
define i32 @copy_quaddobl_Laurent_container_to_start_system() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double*
%5 = load i32*, i32** %1
%6 = load i32*, i32** %2
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc4c(i32 779, i32* %5, i32* %6, double* %7, i32 0)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @copy_quaddobl_Laurent_container_to_start_system() {
%1 = tail call i32 @_ada_use_c2phc4c(i32 779, i32* undef, i32* undef, double* undef, i32 0)
ret i32 %1
}
/* Variables and functions */
double cos(double);
double f(double x) { return (cos(x) - x); }


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

x86 assembly (clang, -O2):
<f>:
push   %rax
movsd  %xmm0,(%rsp)
call   1030 <cos@plt>
subsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @f(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @cos(double %3)
%5 = load double, double* %2
%6 = fsub double %4, %5
ret double %6
}

LLVM IR (-O2):
define double @f(double %0) {
%2 = tail call double @cos(double %0)
%3 = fsub double %2, %0
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ output(char *);
void printCPUNiceInfo(const char *cmd) {
  (void)cmd;
  output("CPU Nice Load\t0\t100\t%%\n");
}


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

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

LLVM IR (-O0):
@.str = [24 x i8] c"CPU Nice Load\090\09100\09%%\0A\00"
define void @printCPUNiceInfo(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @output(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"CPU Nice Load\090\09100\09%%\0A\00"
define void @printCPUNiceInfo(i8* nocapture readnone %0) {
%2 = tail call i32 @output(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int __u32;

/* Variables and functions */
__u32 tcmu_hdr_get_len(__u32 len_op) { return len_op & ~0x7; }


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

x86 assembly (clang, -O2):
<tcmu_hdr_get_len>:
mov    %edi,%eax
and    $0xfffffff8,%eax
ret

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

LLVM IR (-O2):
define i32 @tcmu_hdr_get_len(i32 %0) {
%2 = and i32 %0, -8
ret i32 %2
}
/* Variables and functions */
double __ocml_logb_f64(double);
double logb(double x) { return __ocml_logb_f64(x); }


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

x86 assembly (clang, -O2):
<logb>:
jmp    1030 <__ocml_logb_f64@plt>

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

LLVM IR (-O2):
define double @logb(double %0) {
%2 = tail call double @__ocml_logb_f64(double %0)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ MCUSendCmdUserEventRecordCtrl(int /*<<< orphan*/);
void MCUSendCmdUserEventRecordCtrlStart() { MCUSendCmdUserEventRecordCtrl(0); }


x86 assembly (clang, -O0):
<MCUSendCmdUserEventRecordCtrlStart>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <MCUSendCmdUserEventRecordCtrl@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @MCUSendCmdUserEventRecordCtrlStart() {
%1 = call i32 @MCUSendCmdUserEventRecordCtrl(i32 0)
ret void
}

LLVM IR (-O2):
define void @MCUSendCmdUserEventRecordCtrlStart() {
%1 = tail call i32 @MCUSendCmdUserEventRecordCtrl(i32 0)
ret void
}
void f4(void) {
  int i = 0, j = 0;
#pragma omp task default(shared) if (0)
  {
#pragma omp simd collapse(2) lastprivate(i, j)
    for (i = 0; i < 10; i++)
      for (j = 0; j < 10; j++)
        ;
  }
  if (i != 10 || j != 10)
    __builtin_abort();
}


x86 assembly (clang, -O0):
<f4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    116e <f4+0x5e>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    115b <f4+0x4b>
jmp    114d <f4+0x3d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113e <f4+0x2e>
jmp    1160 <f4+0x50>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112d <f4+0x1d>
cmpl   $0xa,-0x4(%rbp)
jne    1182 <f4+0x72>
cmpl   $0xa,-0x8(%rbp)
je     1187 <f4+0x77>
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @f4() {
ret void
}
int user_bill(int unit) {
  int total_bill;
  total_bill = unit * 2;
  return total_bill;
}


x86 assembly (clang, -O0):
<user_bill>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<user_bill>:
lea    (%rdi,%rdi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @user_bill(i32 %0) {
%2 = shl nsw i32 %0, 1
ret i32 %2
}