xunge/DecIR huggingface dataset:
/* Type definitions */
struct msghdr {
  int dummy;
};
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ MSG_NOSIGNAL;
int /*<<< orphan*/ sendmsg(int, struct msghdr *, int /*<<< orphan*/);
ssize_t send_process(int fd, struct msghdr *msg, int timeout_ms) {
  return sendmsg(fd, msg, MSG_NOSIGNAL);
}


x86 assembly (clang, -O0):
<send_process>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    0x2eb0(%rip),%rax
mov    (%rax),%edx
call   1030 <sendmsg@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_process>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edx
jmp    1030 <sendmsg@plt>

LLVM IR (-O0):
%struct.msghdr = type { i32 }
@MSG_NOSIGNAL = global i32 0
define i32 @send_process(i32 %0, %struct.msghdr* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.msghdr*
%6 = alloca i32
store i32 %0, i32* %4
store %struct.msghdr* %1, %struct.msghdr** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load %struct.msghdr*, %struct.msghdr** %5
%9 = load i32, i32* @MSG_NOSIGNAL
%10 = call i32 @sendmsg(i32 %7, %struct.msghdr* %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
%struct.msghdr = type { i32 }
@MSG_NOSIGNAL = global i32 0
define i32 @send_process(i32 %0, %struct.msghdr* %1, i32 %2) {
%4 = load i32, i32* @MSG_NOSIGNAL
%5 = tail call i32 @sendmsg(i32 %0, %struct.msghdr* %1, i32 %4)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ PLAL_FS450_i2c_address();
int gfx_i2c_read(int, int /*<<< orphan*/, unsigned char, unsigned char,
                 unsigned char *);
int houston_ReadReg(unsigned int reg, unsigned long *p_value,
                    unsigned int bytes) {
  return gfx_i2c_read(1, PLAL_FS450_i2c_address(), (unsigned char)reg,
                      (unsigned char)bytes, (unsigned char *)p_value);
}


x86 assembly (clang, -O0):
<houston_ReadReg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0x0,%al
call   1030 <PLAL_FS450_i2c_address@plt>
mov    %eax,%esi
mov    -0x4(%rbp),%eax
mov    %al,%cl
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%r8
mov    $0x1,%edi
movzbl %cl,%edx
movzbl %al,%ecx
call   1040 <gfx_i2c_read@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<houston_ReadReg>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %rsi,%r14
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <PLAL_FS450_i2c_address@plt>
movzbl %bpl,%edx
movzbl %bl,%ecx
mov    $0x1,%edi
mov    %eax,%esi
mov    %r14,%r8
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <gfx_i2c_read@plt>

LLVM IR (-O0):
define i32 @houston_ReadReg(i32 %0, i64* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i64*
%6 = alloca i32
store i32 %0, i32* %4
store i64* %1, i64** %5
store i32 %2, i32* %6
%7 = call i32 (...) @PLAL_FS450_i2c_address()
%8 = load i32, i32* %4
%9 = trunc i32 %8 to i8
%10 = load i32, i32* %6
%11 = trunc i32 %10 to i8
%12 = load i64*, i64** %5
%13 = bitcast i64* %12 to i8*
%14 = call i32 @gfx_i2c_read(i32 1, i32 %7, i8 zeroext %9, i8 zeroext %11, i8* %13)
ret i32 %14
}

LLVM IR (-O2):
define i32 @houston_ReadReg(i32 %0, i64* %1, i32 %2) {
%4 = tail call i32 (...) @PLAL_FS450_i2c_address()
%5 = trunc i32 %0 to i8
%6 = trunc i32 %2 to i8
%7 = bitcast i64* %1 to i8*
%8 = tail call i32 @gfx_i2c_read(i32 1, i32 %4, i8 zeroext %5, i8 zeroext %6, i8* %7)
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char const *);
int /*<<< orphan*/ stderr;
int _error(char const *message, int ret) {
  fputs("mksparse"
        ": ",
        stderr);
  perror(message);
  return ret;
}


x86 assembly (clang, -O0):
<_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%esi
lea    0xec1(%rip),%rdi
call   1030 <fputs@plt>
mov    -0x8(%rbp),%rdi
call   1040 <perror@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_error>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    0x2eb1(%rip),%rax
mov    (%rax),%esi
lea    0xec8(%rip),%rdi
call   1030 <fputs@plt>
mov    %rbx,%rdi
call   1040 <perror@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"mksparse: \00"
@stderr = global i32 0
define i32 @_error(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @stderr
%6 = call i32 @fputs(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i8*, i8** %3
%8 = call i32 @perror(i8* %7)
%9 = load i32, i32* %4
ret i32 %9
}

LLVM IR (-O2):
@.str = [11 x i8] c"mksparse: \00"
@stderr = global i32 0
define i32 @_error(i8* nocapture %0, i32 returned %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fputs(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @perror(i8* %0)
ret i32 %1
}
findGCF(int x, int y, int k) {
  if ((x % k == 0) && (y % k == 0))
    return k;
  return findGCF(x, y, k - 1);
}


x86 assembly (clang, -O0):
<findGCF>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
jne    114c <findGCF+0x3c>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
jne    114c <findGCF+0x3c>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1160 <findGCF+0x50>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
call   1030 <findGCF@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findGCF>:
mov    %edx,%ecx
jmp    1113 <findGCF+0x13>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0xffffffff,%ecx
mov    %edi,%eax
cltd
idiv   %ecx
test   %edx,%edx
jne    1110 <findGCF+0x10>
mov    %esi,%eax
cltd
idiv   %ecx
test   %edx,%edx
jne    1110 <findGCF+0x10>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @findGCF(i32 %0, i32 %1, i32 %2) {
br label %4
4: ; preds = %11, %3
%5 = phi i32 [ %2, %3 ], [ %12, %11 ]
%6 = srem i32 %0, %5
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = srem i32 %1, %5
%10 = icmp eq i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %8, %4
%12 = add nsw i32 %5, -1
br label %4
13: ; preds = %8
ret i32 %5
}
/* Variables and functions */
int U_WMRCORENONE_get(char *);
int U_WMR6C_get(void) { return U_WMRCORENONE_get("U_WMR6C"); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"U_WMR6C\00"
define i32 @U_WMR6C_get() {
%1 = call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [8 x i8] c"U_WMR6C\00"
define i32 @U_WMR6C_get() {
%1 = tail call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
unsigned int parity0(unsigned int x) {
  unsigned p;
  p = x ^ (x >> 1);
  p ^= p >> 2;
  p ^= p >> 4;
  p ^= p >> 8;
  p ^= p >> 16;
  return p & 0x1;
}


x86 assembly (clang, -O0):
<parity0>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
shr    $0x1,%ecx
xor    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x2,%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x4,%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x8,%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x10,%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<parity0>:
mov    %edi,%eax
shr    %eax
xor    %edi,%eax
mov    %eax,%ecx
shr    $0x2,%ecx
xor    %eax,%ecx
mov    %ecx,%eax
shr    $0x4,%eax
xor    %ecx,%eax
mov    %eax,%ecx
shr    $0x8,%ecx
xor    %eax,%ecx
mov    %ecx,%eax
shr    $0x10,%eax
xor    %ecx,%eax
and    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @parity0(i32 %0) {
%2 = lshr i32 %0, 1
%3 = xor i32 %2, %0
%4 = lshr i32 %3, 2
%5 = xor i32 %4, %3
%6 = lshr i32 %5, 4
%7 = xor i32 %6, %5
%8 = lshr i32 %7, 8
%9 = xor i32 %8, %7
%10 = lshr i32 %9, 16
%11 = xor i32 %10, %9
%12 = and i32 %11, 1
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void test(int a, int b) { printf("a=%d, b=%d\n", a, b); }


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

x86 assembly (clang, -O2):
<test>:
mov    %esi,%edx
mov    %edi,%esi
lea    0xee5(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [12 x i8] c"a=%d, b=%d\0A\00"
define void @test(i32 %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ md_onsignal_exit();
void md_init() { md_onsignal_exit(); }


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

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

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

LLVM IR (-O2):
define void @md_init() {
%1 = tail call i32 (...) @md_onsignal_exit()
ret void
}
int multiplication(int *a, int *b) { return *a * *b; }


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

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

LLVM IR (-O0):
define i32 @multiplication(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %5
%7 = load i32*, i32** %4
%8 = load i32, i32* %7
%9 = mul nsw i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @multiplication(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = mul nsw i32 %4, %3
ret i32 %5
}
int isArraySorted(int *array, int length) {
  int i = 0;
  for (i = 0; i < length - 1; i++) {
    if (array[i] > array[i + 1]) {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<isArraySorted>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    116a <isArraySorted+0x6a>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
cmp    (%rcx,%rdx,4),%eax
jle    1157 <isArraySorted+0x57>
movl   $0x0,-0x4(%rbp)
jmp    1171 <isArraySorted+0x71>
jmp    115c <isArraySorted+0x5c>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1119 <isArraySorted+0x19>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isArraySorted>:
add    $0xffffffff,%esi
xor    %eax,%eax
test   %esi,%esi
cmovle %eax,%esi
nopw   0x0(%rax,%rax,1)
cmp    %rax,%rsi
je     1128 <isArraySorted+0x28>
mov    (%rdi,%rax,4),%ecx
lea    0x1(%rax),%rdx
cmp    0x4(%rdi,%rax,4),%ecx
mov    %rdx,%rax
jle    1110 <isArraySorted+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @isArraySorted(i32* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 0, i32* %6
store i32 0, i32* %6
br label %7
7: ; preds = %27, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %5
%10 = sub nsw i32 %9, 1
%11 = icmp slt i32 %8, %10
br i1 %11, label %12, label %30
12: ; preds = %7
%13 = load i32*, i32** %4
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = load i32, i32* %16
%18 = load i32*, i32** %4
%19 = load i32, i32* %6
%20 = add nsw i32 %19, 1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %18, i64 %21
%23 = load i32, i32* %22
%24 = icmp sgt i32 %17, %23
br i1 %24, label %25, label %26
25: ; preds = %12
store i32 0, i32* %3
br label %31
26: ; preds = %12
br label %27
27: ; preds = %26
%28 = load i32, i32* %6
%29 = add nsw i32 %28, 1
store i32 %29, i32* %6
br label %7
30: ; preds = %7
store i32 1, i32* %3
br label %31
31: ; preds = %30, %25
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
define i32 @isArraySorted(i32* nocapture %0, i32 %1) {
%3 = add i32 %1, -1
%4 = call i32 @llvm.smax.i32(i32 %3, i32 0)
%5 = zext i32 %4 to i64
br label %6
6: ; preds = %9, %2
%7 = phi i64 [ %12, %9 ], [ 0, %2 ]
%8 = icmp eq i64 %7, %5
br i1 %8, label %16, label %9
9: ; preds = %6
%10 = getelementptr inbounds i32, i32* %0, i64 %7
%11 = load i32, i32* %10
%12 = add nuw nsw i64 %7, 1
%13 = getelementptr inbounds i32, i32* %0, i64 %12
%14 = load i32, i32* %13
%15 = icmp sgt i32 %11, %14
br i1 %15, label %16, label %6
16: ; preds = %6, %9
%17 = phi i32 [ 0, %9 ], [ 1, %6 ]
ret i32 %17
}
void object_module_deinit() {}


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

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

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

LLVM IR (-O2):
define void @object_module_deinit() {
ret void
}
/* Variables and functions */
int _tx_server;
int /*<<< orphan*/ close(int);
int tx_close(void) {
  extern _tx_server;
  close(_tx_server);
  _tx_server = -1;
  return 0;
}


x86 assembly (clang, -O0):
<tx_close>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
call   1030 <close@plt>
mov    0x2eb7(%rip),%rax
movl   $0xffffffff,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tx_close>:
push   %rbx
mov    0x2ec8(%rip),%rbx
mov    (%rbx),%edi
call   1030 <close@plt>
movl   $0xffffffff,(%rbx)
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@_tx_server = global i32 0
define i32 @tx_close() {
%1 = load i32, i32* @_tx_server
%2 = call i32 @close(i32 %1)
store i32 -1, i32* @_tx_server
ret i32 0
}

LLVM IR (-O2):
@_tx_server = global i32 0
define i32 @tx_close() {
%1 = load i32, i32* @_tx_server
%2 = tail call i32 @close(i32 %1)
store i32 -1, i32* @_tx_server
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void show(void *element) { printf("res: %s\n", (char *)element); }


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

x86 assembly (clang, -O2):
<show>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"res: %s\0A\00"
define void @show(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"res: %s\0A\00"
define void @show(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
void *cgc_memset(void *str, int ch, unsigned int n) {
  char *ch_ptr = (char *)str;
  while (n > 0) {
    *ch_ptr = (char)ch;
    ch_ptr++;
    n--;
  }
  return str;
}


x86 assembly (clang, -O0):
<cgc_memset>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x0,-0x10(%rbp)
jbe    1145 <cgc_memset+0x45>
mov    -0xc(%rbp),%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1116 <cgc_memset+0x16>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgc_memset>:
push   %rbx
mov    %rdi,%rbx
test   %edx,%edx
je     1122 <cgc_memset+0x12>
mov    %edx,%edx
mov    %rbx,%rdi
call   1030 <memset@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @cgc_memset(i8* returned writeonly %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = trunc i32 %1 to i8
%7 = zext i32 %2 to i64
br label %8
8: ; preds = %5, %3
ret i8* %0
}
int postcheck_init(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @postcheck_init() {
ret i32 0
}
void Counter_1_RestoreConfig(void) {}


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

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

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

LLVM IR (-O2):
define void @Counter_1_RestoreConfig() {
ret void
}
int test_imm_E9uint32_reg(unsigned int val) {
  return ((val) & (0xE9 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_E9uint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0xe9,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_E9uint32_reg>:
test   $0xe9,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_E9uint32_reg(i32 %0) {
%2 = and i32 %0, 233
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ die(int, char *);
int /*<<< orphan*/ strncpy(char *, char const *, int);
char *xmalloc(int);
char *xstrndup(const char *s, int n) {
  char *t;
  if (s == NULL)
    die(4, ("bug in xstrndup call"));
  t = xmalloc(n + 1);
  strncpy(t, s, n);
  t[n] = 0;
  return t;
}


x86 assembly (clang, -O0):
<xstrndup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    115b <xstrndup+0x2b>
mov    $0x4,%edi
lea    0xeaa(%rip),%rsi
call   1050 <die@plt>
mov    -0xc(%rbp),%edi
add    $0x1,%edi
call   1040 <xmalloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrndup>:
push   %r15
push   %r14
push   %rbx
mov    %esi,%r15d
mov    %rdi,%r14
test   %rdi,%rdi
jne    1151 <xstrndup+0x21>
lea    0xeb9(%rip),%rsi
mov    $0x4,%edi
call   1050 <die@plt>
lea    0x1(%r15),%edi
call   1040 <xmalloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1030 <strncpy@plt>
movslq %r15d,%rax
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [21 x i8] c"bug in xstrndup call\00"
define i8* @xstrndup(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @die(i32 4, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
%11 = load i32, i32* %4
%12 = add nsw i32 %11, 1
%13 = call i8* @xmalloc(i32 %12)
store i8* %13, i8** %5
%14 = load i8*, i8** %5
%15 = load i8*, i8** %3
%16 = load i32, i32* %4
%17 = call i32 @strncpy(i8* %14, i8* %15, i32 %16)
%18 = load i8*, i8** %5
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
store i8 0, i8* %21
%22 = load i8*, i8** %5
ret i8* %22
}

LLVM IR (-O2):
@.str = [21 x i8] c"bug in xstrndup call\00"
define i8* @xstrndup(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @die(i32 4, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %2
%7 = add nsw i32 %1, 1
%8 = tail call i8* @xmalloc(i32 %7)
%9 = tail call i32 @strncpy(i8* %8, i8* %0, i32 %1)
%10 = sext i32 %1 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
store i8 0, i8* %11
ret i8* %8
}
/* Type definitions */
struct stat {
  size_t st_size;
  unsigned int st_mtime;
};
typedef int int32_t;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, int, int);
void onion_shortcut_etag(struct stat *st, char etag[32]) {
  size_t size = st->st_size;
  unsigned int time = st->st_mtime;
  snprintf(etag, 32, "%04X-%04X", (int32_t)size, (int32_t)time);
  ;
}


x86 assembly (clang, -O0):
<onion_shortcut_etag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    %eax,%ecx
mov    -0x1c(%rbp),%r8d
mov    $0x20,%esi
lea    0xeb1(%rip),%rdx
call   1030 <snprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<onion_shortcut_etag>:
mov    (%rdi),%ecx
mov    0x8(%rdi),%r8d
lea    0xee3(%rip),%rdx
mov    %rsi,%rdi
mov    $0x20,%esi
jmp    1030 <snprintf@plt>

LLVM IR (-O0):
%struct.stat = type { i64, i32 }
@.str = [10 x i8] c"%04X-%04X\00"
define void @onion_shortcut_etag(%struct.stat* %0, i8* %1) {
%3 = alloca %struct.stat*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
store %struct.stat* %0, %struct.stat** %3
store i8* %1, i8** %4
%7 = load %struct.stat*, %struct.stat** %3
%8 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
%9 = load i64, i64* %8
store i64 %9, i64* %5
%10 = load %struct.stat*, %struct.stat** %3
%11 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 1
%12 = load i32, i32* %11
store i32 %12, i32* %6
%13 = load i8*, i8** %4
%14 = load i64, i64* %5
%15 = trunc i64 %14 to i32
%16 = load i32, i32* %6
%17 = call i32 @snprintf(i8* %13, i32 32, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %16)
ret void
}

LLVM IR (-O2):
%struct.stat = type { i64, i32 }
@.str = [10 x i8] c"%04X-%04X\00"
define void @onion_shortcut_etag(%struct.stat* nocapture %0, i8* %1) {
%3 = getelementptr inbounds %struct.stat, %struct.stat* %0, i64 0, i32 0
%4 = load i64, i64* %3
%5 = getelementptr inbounds %struct.stat, %struct.stat* %0, i64 0, i32 1
%6 = load i32, i32* %5
%7 = trunc i64 %4 to i32
%8 = tail call i32 @snprintf(i8* %1, i32 32, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ LOG_DEBUG;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ sendPADT();
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, int);
void sigPADT(int src) {
  syslog(LOG_DEBUG, "Received signal %d.", (int)src);
  sendPADT();
  exit(0);
}


x86 assembly (clang, -O0):
<sigPADT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2e9e(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xeb2(%rip),%rsi
call   1030 <syslog@plt>
mov    $0x0,%al
call   1040 <sendPADT@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<sigPADT>:
push   %rax
mov    %edi,%edx
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
lea    0xebd(%rip),%rsi
call   1030 <syslog@plt>
xor    %eax,%eax
call   1040 <sendPADT@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@LOG_DEBUG = global i32 0
@.str = [20 x i8] c"Received signal %d.\00"
define void @sigPADT(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @LOG_DEBUG
%4 = load i32, i32* %2
%5 = call i32 @syslog(i32 %3, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 (...) @sendPADT()
%7 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@LOG_DEBUG = global i32 0
@.str = [20 x i8] c"Received signal %d.\00"
define void @sigPADT(i32 %0) {
%2 = load i32, i32* @LOG_DEBUG
%3 = tail call i32 @syslog(i32 %2, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %0)
%4 = tail call i32 (...) @sendPADT()
%5 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
struct timespec {
  int dummy;
};
typedef int /*<<< orphan*/ clockid_t;

/* Variables and functions */
int clock_gettime(int /*<<< orphan*/, struct timespec *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int safe_clock_gettime(clockid_t clk_id, struct timespec *tp) {
  int ret = 0;
  if ((ret = clock_gettime(clk_id, tp)) < 0) {
    perror("clock_gettime failed");
    ret = -1;
    exit(0);
  }
  return ret;
}


x86 assembly (clang, -O0):
<safe_clock_gettime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    1178 <safe_clock_gettime+0x48>
lea    0xe9b(%rip),%rdi
call   1040 <perror@plt>
movl   $0xffffffff,-0x14(%rbp)
xor    %edi,%edi
call   1050 <exit@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_clock_gettime>:
push   %rax
call   1030 <clock_gettime@plt>
test   %eax,%eax
js     113c <safe_clock_gettime+0xc>
pop    %rcx
ret
lea    0xebd(%rip),%rdi
call   1040 <perror@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.timespec = type { i32 }
@.str = [21 x i8] c"clock_gettime failed\00"
define i32 @safe_clock_gettime(i32 %0, %struct.timespec* %1) {
%3 = alloca i32
%4 = alloca %struct.timespec*
%5 = alloca i32
store i32 %0, i32* %3
store %struct.timespec* %1, %struct.timespec** %4
store i32 0, i32* %5
%6 = load i32, i32* %3
%7 = load %struct.timespec*, %struct.timespec** %4
%8 = call i32 @clock_gettime(i32 %6, %struct.timespec* %7)
store i32 %8, i32* %5
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %5
%12 = call i32 @exit(i32 0)
unreachable
13: ; preds = %2
%14 = load i32, i32* %5
ret i32 %14
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@.str = [21 x i8] c"clock_gettime failed\00"
define i32 @safe_clock_gettime(i32 %0, %struct.timespec* %1) {
%3 = tail call i32 @clock_gettime(i32 %0, %struct.timespec* %1)
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 0)
unreachable
8: ; preds = %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ ao();
int camera_open();
int /*<<< orphan*/ closeGate(int /*<<< orphan*/);
int get_channel_count();
int /*<<< orphan*/ openGate(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%d \n", get_channel_count());
  printf("%d \n", camera_open());
  openGate(0);
  closeGate(0);
  ao();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <get_channel_count@plt>
mov    %eax,%esi
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1080 <camera_open@plt>
mov    %eax,%esi
lea    0xe6c(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1070 <openGate@plt>
xor    %edi,%edi
call   1050 <closeGate@plt>
mov    $0x0,%al
call   1040 <ao@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1060 <get_channel_count@plt>
lea    0xe91(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1080 <camera_open@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %edi,%edi
call   1070 <openGate@plt>
xor    %edi,%edi
call   1050 <closeGate@plt>
xor    %eax,%eax
call   1040 <ao@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%d \0A\00"
define i32 @main() {
%1 = tail call i32 (...) @get_channel_count()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 (...) @camera_open()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @openGate(i32 0)
%6 = tail call i32 @closeGate(i32 0)
%7 = tail call i32 (...) @ao()
ret i32 0
}
void WeaponSG550_SecondaryFire(void) {}


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

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

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

LLVM IR (-O2):
define void @WeaponSG550_SecondaryFire() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fftss_cleanup_threads();
void dfftss_cleanup_threads__(void) { fftss_cleanup_threads(); }


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

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

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

LLVM IR (-O2):
define void @dfftss_cleanup_threads__() {
%1 = tail call i32 (...) @fftss_cleanup_threads()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ xcb_window_t;
typedef int /*<<< orphan*/ xcb_get_property_cookie_t;
typedef int /*<<< orphan*/ xcb_connection_t;

/* Variables and functions */
int /*<<< orphan*/ XCB_ATOM_WM_HINTS;
int /*<<< orphan*/ xcb_get_property_unchecked(int /*<<< orphan*/ *,
                                              int /*<<< orphan*/,
                                              int /*<<< orphan*/,
                                              int /*<<< orphan*/,
                                              int /*<<< orphan*/, long, int);
xcb_get_property_cookie_t
xcb_icccm_get_wm_hints_unchecked(xcb_connection_t *c, xcb_window_t window) {
  return xcb_get_property_unchecked(c, 0, window, XCB_ATOM_WM_HINTS,
                                    XCB_ATOM_WM_HINTS, 0L, 9);
}


x86 assembly (clang, -O0):
<xcb_icccm_get_wm_hints_unchecked>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    0x2eab(%rip),%rax
mov    (%rax),%ecx
mov    0x2ea2(%rip),%rax
mov    (%rax),%r8d
xor    %esi,%esi
xor    %eax,%eax
mov    %eax,%r9d
movl   $0x9,(%rsp)
call   1030 <xcb_get_property_unchecked@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcb_icccm_get_wm_hints_unchecked>:
push   %rax
mov    %esi,%edx
mov    0x2ebe(%rip),%rax
mov    (%rax),%ecx
movl   $0x9,(%rsp)
xor    %esi,%esi
mov    %ecx,%r8d
xor    %r9d,%r9d
call   1030 <xcb_get_property_unchecked@plt>
pop    %rcx
ret

LLVM IR (-O0):
@XCB_ATOM_WM_HINTS = global i32 0
define i32 @xcb_icccm_get_wm_hints_unchecked(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %4
%7 = load i32, i32* @XCB_ATOM_WM_HINTS
%8 = load i32, i32* @XCB_ATOM_WM_HINTS
%9 = call i32 @xcb_get_property_unchecked(i32* %5, i32 0, i32 %6, i32 %7, i32 %8, i64 0, i32 9)
ret i32 %9
}

LLVM IR (-O2):
@XCB_ATOM_WM_HINTS = global i32 0
define i32 @xcb_icccm_get_wm_hints_unchecked(i32* %0, i32 %1) {
%3 = load i32, i32* @XCB_ATOM_WM_HINTS
%4 = tail call i32 @xcb_get_property_unchecked(i32* %0, i32 0, i32 %1, i32 %3, i32 %3, i64 0, i32 9)
ret i32 %4
}
/* Variables and functions */
unsigned char mbc_read(int);
unsigned char cpu_read8(int adr) { return mbc_read(adr); }


x86 assembly (clang, -O0):
<cpu_read8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <mbc_read@plt>
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpu_read8>:
jmp    1030 <mbc_read@plt>

LLVM IR (-O0):
define zeroext i8 @cpu_read8(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call zeroext i8 @mbc_read(i32 %3)
ret i8 %4
}

LLVM IR (-O2):
define zeroext i8 @cpu_read8(i32 %0) {
%2 = tail call zeroext i8 @mbc_read(i32 %0)
ret i8 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void printver(void) { printf("threestacks %s\n", "1.1"); }


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

x86 assembly (clang, -O2):
<printver>:
lea    0xee9(%rip),%rdi
lea    0xef2(%rip),%rsi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [16 x i8] c"threestacks %s\0A\00"
@.str.1 = [4 x i8] c"1.1\00"
define void @printver() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int __opensock(void) {
  int fd = -1;
  return fd;
}


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

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

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

LLVM IR (-O2):
define i32 @__opensock() {
ret i32 -1
}
/* Variables and functions */
long long strtoull(char const *, char **, unsigned int);
long long strtoll(const char *cp, char **endp, unsigned int base) {
  if (*cp == '-')
    return -strtoull(cp + 1, endp, base);
  return strtoull(cp, endp, base);
}


x86 assembly (clang, -O0):
<strtoll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1158 <strtoll+0x48>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <strtoull@plt>
mov    %rax,%rcx
xor    %eax,%eax
sub    %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    116c <strtoll+0x5c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <strtoull@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strtoll>:
push   %rax
cmpb   $0x2d,(%rdi)
jne    1124 <strtoll+0x14>
add    $0x1,%rdi
call   1030 <strtoull@plt>
neg    %rax
pop    %rcx
ret
pop    %rax
jmp    1030 <strtoull@plt>

LLVM IR (-O0):
define i64 @strtoll(i8* %0, i8** %1, i32 %2) {
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i32
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i32 %2, i32* %7
%8 = load i8*, i8** %5
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 45
br i1 %11, label %12, label %19
12: ; preds = %3
%13 = load i8*, i8** %5
%14 = getelementptr inbounds i8, i8* %13, i64 1
%15 = load i8**, i8*** %6
%16 = load i32, i32* %7
%17 = call i64 @strtoull(i8* %14, i8** %15, i32 %16)
%18 = sub nsw i64 0, %17
store i64 %18, i64* %4
br label %24
19: ; preds = %3
%20 = load i8*, i8** %5
%21 = load i8**, i8*** %6
%22 = load i32, i32* %7
%23 = call i64 @strtoull(i8* %20, i8** %21, i32 %22)
store i64 %23, i64* %4
br label %24
24: ; preds = %19, %12
%25 = load i64, i64* %4
ret i64 %25
}

LLVM IR (-O2):
define i64 @strtoll(i8* %0, i8** nocapture %1, i32 %2) {
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 45
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = getelementptr inbounds i8, i8* %0, i64 1
%8 = tail call i64 @strtoull(i8* %7, i8** %1, i32 %2)
%9 = sub nsw i64 0, %8
br label %12
10: ; preds = %3
%11 = tail call i64 @strtoull(i8* %0, i8** %1, i32 %2)
br label %12
12: ; preds = %10, %6
%13 = phi i64 [ %9, %6 ], [ %11, %10 ]
ret i64 %13
}
long g1(double x) { return (double)(long)x; }


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

x86 assembly (clang, -O2):
<g1>:
cvttsd2si %xmm0,%rax
ret

LLVM IR (-O0):
define i64 @g1(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fptosi double %3 to i64
%5 = sitofp i64 %4 to double
%6 = fptosi double %5 to i64
ret i64 %6
}

LLVM IR (-O2):
define i64 @g1(double %0) {
%2 = fptosi double %0 to i64
ret i64 %2
}
int Memorialday(int monthStartDOW) {
  if (monthStartDOW == 0) {
    return 30;
  } else if (monthStartDOW == 6) {
    return 31;
  } else {
    return ((5 - monthStartDOW) + 25);
  }
}


x86 assembly (clang, -O0):
<Memorialday>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    111d <Memorialday+0x1d>
movl   $0x1e,-0x4(%rbp)
jmp    1141 <Memorialday+0x41>
cmpl   $0x6,-0x8(%rbp)
jne    1133 <Memorialday+0x33>
movl   $0x1f,-0x4(%rbp)
jmp    1141 <Memorialday+0x41>
mov    $0x5,%eax
sub    -0x8(%rbp),%eax
add    $0x19,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Memorialday>:
test   %edi,%edi
je     110f <Memorialday+0xf>
cmp    $0x6,%edi
jne    1115 <Memorialday+0x15>
mov    $0x1f,%eax
ret
mov    $0x1e,%eax
ret
mov    $0x1e,%eax
sub    %edi,%eax
ret

LLVM IR (-O0):
define i32 @Memorialday(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 30, i32* %2
br label %15
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 6
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 31, i32* %2
br label %15
11: ; preds = %7
%12 = load i32, i32* %3
%13 = sub nsw i32 5, %12
%14 = add nsw i32 %13, 25
store i32 %14, i32* %2
br label %15
15: ; preds = %11, %10, %6
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
define i32 @Memorialday(i32 %0) {
switch i32 %0, label %3 [
i32 0, label %5
i32 6, label %2
]
2: ; preds = %1
br label %5
3: ; preds = %1
%4 = sub i32 30, %0
br label %5
5: ; preds = %1, %3, %2
%6 = phi i32 [ 31, %2 ], [ %4, %3 ], [ 30, %1 ]
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ RamRead32A(int, unsigned long *);
int /*<<< orphan*/ RamWrite32A(int, unsigned long);
void FlashResetRelease(void) {
  unsigned long UlReadVal;
  RamWrite32A(0xC000, 0xD0006C);
  RamRead32A(0xD000, &UlReadVal);
  RamWrite32A(0xD000, (UlReadVal | 0x00000010));
}


x86 assembly (clang, -O0):
<FlashResetRelease>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xc000,%edi
mov    $0xd0006c,%esi
call   1040 <RamWrite32A@plt>
mov    $0xd000,%edi
lea    -0x8(%rbp),%rsi
call   1030 <RamRead32A@plt>
mov    -0x8(%rbp),%rsi
or     $0x10,%rsi
mov    $0xd000,%edi
call   1040 <RamWrite32A@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FlashResetRelease>:
push   %rax
mov    $0xd0006c,%esi
mov    $0xc000,%edi
call   1040 <RamWrite32A@plt>
mov    %rsp,%rsi
mov    $0xd000,%edi
call   1030 <RamRead32A@plt>
mov    (%rsp),%rsi
or     $0x10,%rsi
mov    $0xd000,%edi
call   1040 <RamWrite32A@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @FlashResetRelease() {
%1 = alloca i64
%2 = call i32 @RamWrite32A(i32 49152, i64 13631596)
%3 = call i32 @RamRead32A(i32 53248, i64* %1)
%4 = load i64, i64* %1
%5 = or i64 %4, 16
%6 = call i32 @RamWrite32A(i32 53248, i64 %5)
ret void
}

LLVM IR (-O2):
define void @FlashResetRelease() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = tail call i32 @RamWrite32A(i32 49152, i64 13631596)
%4 = call i32 @RamRead32A(i32 53248, i64* %1)
%5 = load i64, i64* %1
%6 = or i64 %5, 16
%7 = call i32 @RamWrite32A(i32 53248, i64 %6)
ret void
}
/* Variables and functions */
int strlen(char *);
void RightTrim(char *s) {
  int i;
  i = strlen(s) - 1;
  while (i >= 0 && s[i] == ' ')
    s[i--] = '\0';
}


x86 assembly (clang, -O0):
<RightTrim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0xd(%rbp)
jl     114f <RightTrim+0x3f>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    115f <RightTrim+0x4f>
jmp    117a <RightTrim+0x6a>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0xffffffff,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    112b <RightTrim+0x1b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RightTrim>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
test   %eax,%eax
jle    1147 <RightTrim+0x37>
mov    %eax,%eax
add    $0x1,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    -0x2(%rax),%ecx
cmpb   $0x20,(%rbx,%rcx,1)
jne    1147 <RightTrim+0x37>
movb   $0x0,(%rbx,%rcx,1)
add    $0xffffffffffffffff,%rax
cmp    $0x1,%rax
ja     1130 <RightTrim+0x20>
pop    %rbx
ret

LLVM IR (-O0):
define void @RightTrim(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = sub nsw i32 %5, 1
store i32 %6, i32* %3
br label %7
7: ; preds = %20, %1
%8 = load i32, i32* %3
%9 = icmp sge i32 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %7
%11 = load i8*, i8** %2
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 32
br label %18
18: ; preds = %10, %7
%19 = phi i1 [ false, %7 ], [ %17, %10 ]
br i1 %19, label %20, label %26
20: ; preds = %18
%21 = load i8*, i8** %2
%22 = load i32, i32* %3
%23 = add nsw i32 %22, -1
store i32 %23, i32* %3
%24 = sext i32 %22 to i64
%25 = getelementptr inbounds i8, i8* %21, i64 %24
store i8 0, i8* %25
br label %7
26: ; preds = %18
ret void
}

LLVM IR (-O2):
define void @RightTrim(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %15
4: ; preds = %1
%5 = zext i32 %2 to i64
br label %6
6: ; preds = %4, %13
%7 = phi i64 [ %5, %4 ], [ %8, %13 ]
%8 = add nsw i64 %7, -1
%9 = and i64 %8, 4294967295
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 32
br i1 %12, label %13, label %15
13: ; preds = %6
store i8 0, i8* %10
%14 = icmp ugt i64 %7, 1
br i1 %14, label %6, label %15
15: ; preds = %6, %13, %1
ret void
}
long long load64_reverse_4(long long dummy __attribute__((unused)),
                           long long *p) {
  return __builtin_bswap64(*p);
}


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

x86 assembly (clang, -O2):
<load64_reverse_4>:
mov    (%rsi),%rax
bswap  %rax
ret

LLVM IR (-O0):
define i64 @load64_reverse_4(i64 %0, i64* %1) {
%3 = alloca i64
%4 = alloca i64*
store i64 %0, i64* %3
store i64* %1, i64** %4
%5 = load i64*, i64** %4
%6 = load i64, i64* %5
%7 = call i64 @llvm.bswap.i64(i64 %6)
ret i64 %7
}

LLVM IR (-O2):
define i64 @load64_reverse_4(i64 %0, i64* nocapture %1) {
%3 = load i64, i64* %1
%4 = tail call i64 @llvm.bswap.i64(i64 %3)
ret i64 %4
}
int func5() { return 5; }


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

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

LLVM IR (-O0):
define i32 @func5() {
ret i32 5
}

LLVM IR (-O2):
define i32 @func5() {
ret i32 5
}
int test_imm_C0int64_lowword_reg(long long val) {
  return ((val) & (0xC0 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_C0int64_lowword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
and    $0xc0,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_C0int64_lowword_reg>:
test   $0xc0,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_C0int64_lowword_reg(i64 %0) {
%2 = and i64 %0, 192
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}