xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint32_t;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int bufToUInt32(int /*<<< orphan*/ *);
int readTag(int, char *, int /*<<< orphan*/ *, int);
uint32_t readCredits(int entId) {
  uint8_t buf[4];
  if (readTag(entId, "credits", buf, sizeof(buf)) != 4)
    return -1;
  else
    return bufToUInt32(buf);
}


x86 assembly (clang, -O0):
<readCredits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x20(%rbp),%rdx
lea    0xec7(%rip),%rsi
mov    $0x10,%ecx
call   1040 <readTag@plt>
cmp    $0x4,%eax
je     1158 <readCredits+0x38>
movl   $0xffffffff,-0x4(%rbp)
jmp    1164 <readCredits+0x44>
lea    -0x20(%rbp),%rdi
call   1030 <bufToUInt32@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readCredits>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rsi
mov    %rsp,%rdx
mov    $0x10,%ecx
call   1040 <readTag@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    $0x4,%ecx
jne    114c <readCredits+0x2c>
mov    %rsp,%rdi
call   1030 <bufToUInt32@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"credits\00"
define i32 @readCredits(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [4 x i32]
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 0
%7 = call i32 @readTag(i32 %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32* %6, i32 16)
%8 = icmp ne i32 %7, 4
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 -1, i32* %2
br label %13
10: ; preds = %1
%11 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 0
%12 = call i32 @bufToUInt32(i32* %11)
store i32 %12, i32* %2
br label %13
13: ; preds = %10, %9
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@.str = [8 x i8] c"credits\00"
define i32 @readCredits(i32 %0) {
%2 = alloca [4 x i32]
%3 = bitcast [4 x i32]* %2 to i8*
%4 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%5 = call i32 @readTag(i32 %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32* %4, i32 16)
%6 = icmp eq i32 %5, 4
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @bufToUInt32(i32* %4)
br label %9
9: ; preds = %1, %7
%10 = phi i32 [ %8, %7 ], [ -1, %1 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ _I8080_();
void do0x20() { _I8080_(); }


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

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

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

LLVM IR (-O2):
define void @do0x20() {
%1 = tail call i32 (...) @_I8080_()
ret void
}
void svm_struct_learn_api_exit() {}


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

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

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

LLVM IR (-O2):
define void @svm_struct_learn_api_exit() {
ret void
}
/* Type definitions */
struct pkt_buff {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ tprintf(char *);
void no_next_header_less(struct pkt_buff *pkt) { tprintf(" No Next Header"); }


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

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

LLVM IR (-O0):
%struct.pkt_buff = type { i32 }
@.str = [16 x i8] c" No Next Header\00"
define void @no_next_header_less(%struct.pkt_buff* %0) {
%2 = alloca %struct.pkt_buff*
store %struct.pkt_buff* %0, %struct.pkt_buff** %2
%3 = call i32 @tprintf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.pkt_buff = type { i32 }
@.str = [16 x i8] c" No Next Header\00"
define void @no_next_header_less(%struct.pkt_buff* nocapture readnone %0) {
%2 = tail call i32 @tprintf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret void
}
int fdatasync(int fd) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @fdatasync(i32 %0) {
ret i32 0
}
__attribute__((no)) void foo(int i,
                             void (*__attribute__((regparm(3))) bar)(int)) {
  bar(i);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%edi
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
jmp    *%rsi

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

LLVM IR (-O2):
define void @foo(i32 %0, void (i32)* nocapture %1) {
tail call void %1(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ enprintf(int, char *);
char *strdup(char const *);
char *enstrdup(int status, const char *s) {
  char *p;
  p = strdup(s);
  if (!p)
    enprintf(status, "strdup: out of memory\n");
  return p;
}


x86 assembly (clang, -O0):
<enstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1156 <enstrdup+0x36>
mov    -0x4(%rbp),%edi
lea    0xeaf(%rip),%rsi
call   1030 <enprintf@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<enstrdup>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    %rsi,%rdi
call   1040 <strdup@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1143 <enstrdup+0x23>
lea    0xec4(%rip),%rsi
mov    %ebp,%edi
call   1030 <enprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"strdup: out of memory\0A\00"
define i8* @enstrdup(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i8* @strdup(i8* %6)
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = icmp ne i8* %8, null
br i1 %9, label %13, label %10
10: ; preds = %2
%11 = load i32, i32* %3
%12 = call i32 @enprintf(i32 %11, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %10, %2
%14 = load i8*, i8** %5
ret i8* %14
}

LLVM IR (-O2):
@.str = [23 x i8] c"strdup: out of memory\0A\00"
define noalias i8* @enstrdup(i32 %0, i8* nocapture %1) {
%3 = tail call i8* @strdup(i8* %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @enprintf(i32 %0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret i8* %3
}
/* Type definitions */
typedef int /*<<< orphan*/ EVP_MD_CTX;

/* Variables and functions */
int /*<<< orphan*/ EVP_MD_CTX_md_data(int /*<<< orphan*/ *);
int SHA1_Final(unsigned char *, int /*<<< orphan*/);
int final(EVP_MD_CTX *ctx, unsigned char *md) {
  return SHA1_Final(md, EVP_MD_CTX_md_data(ctx));
}


x86 assembly (clang, -O0):
<final>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <EVP_MD_CTX_md_data@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1040 <SHA1_Final@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<final>:
push   %rbx
mov    %rsi,%rbx
call   1030 <EVP_MD_CTX_md_data@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1040 <SHA1_Final@plt>

LLVM IR (-O0):
define i32 @final(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i32*, i32** %3
%7 = call i32 @EVP_MD_CTX_md_data(i32* %6)
%8 = call i32 @SHA1_Final(i8* %5, i32 %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @final(i32* %0, i8* %1) {
%3 = tail call i32 @EVP_MD_CTX_md_data(i32* %0)
%4 = tail call i32 @SHA1_Final(i8* %1, i32 %3)
ret i32 %4
}
/* Variables and functions */
long GetMousePosX290();
long getmouseposx() { return GetMousePosX290(); }


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

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

LLVM IR (-O0):
define i64 @getmouseposx() {
%1 = call i64 (...) @GetMousePosX290()
ret i64 %1
}

LLVM IR (-O2):
define i64 @getmouseposx() {
%1 = tail call i64 (...) @GetMousePosX290()
ret i64 %1
}
short test_40_2(short *mem) { return __atomic_fetch_add(mem + 4, 1, 4); }


x86 assembly (clang, -O0):
<test_40_2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
movw   $0x1,-0xa(%rbp)
mov    -0xa(%rbp),%ax
lock xadd %ax,0x8(%rcx)
mov    %ax,-0xc(%rbp)
movswl -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_40_2>:
mov    $0x1,%ax
lock xadd %ax,0x8(%rdi)
ret

LLVM IR (-O0):
define signext i16 @test_40_2(i16* %0) {
%2 = alloca i16*
%3 = alloca i16
%4 = alloca i16
store i16* %0, i16** %2
%5 = load i16*, i16** %2
%6 = getelementptr inbounds i16, i16* %5, i64 4
store i16 1, i16* %3
%7 = load i16, i16* %3
%8 = atomicrmw add i16* %6, i16 %7 acq_rel
store i16 %8, i16* %4
%9 = load i16, i16* %4
ret i16 %9
}

LLVM IR (-O2):
define signext i16 @test_40_2(i16* nocapture %0) {
%2 = getelementptr inbounds i16, i16* %0, i64 4
%3 = atomicrmw add i16* %2, i16 1 acq_rel
ret i16 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int configure_ssl_no_compression(char **argv) {
  printf("ssl_no_compression is deprecated, and always on by default\n");
  return (1);
}


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

x86 assembly (clang, -O2):
<configure_ssl_no_compression>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [60 x i8] c"ssl_no_compression is deprecated, and always on by default\0A\00"
define i32 @configure_ssl_no_compression(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@str = [59 x i8] c"ssl_no_compression is deprecated, and always on by default\00"
define i32 @configure_ssl_no_compression(i8** nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str, i64 0, i64 0))
ret i32 1
}
/* Variables and functions */
scalar_t__ malloc(size_t);
int /*<<< orphan*/ strncpy(char *, char *, size_t);
extern char *strndup(char *str, size_t len) {
  char *dup = (char *)malloc(len + 1);
  if (dup) {
    strncpy(dup, str, len);
    dup[len] = '\0';
  }
  return dup;
}


x86 assembly (clang, -O0):
<strndup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1169 <strndup+0x49>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strndup>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
lea    0x1(%rsi),%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     114f <strndup+0x2f>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <strncpy@plt>
movb   $0x0,(%rbx,%r14,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @strndup(i8* %0, i64 %1) {
%3 = add i64 %1, 1
%4 = tail call i64 @malloc(i64 %3)
%5 = inttoptr i64 %4 to i8*
%6 = icmp eq i64 %4, 0
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = tail call i32 @strncpy(i8* %5, i8* %0, i64 %1)
%9 = getelementptr inbounds i8, i8* %5, i64 %1
store i8 0, i8* %9
br label %10
10: ; preds = %7, %2
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ HplAtm128Timer1P__Capture__reset();
void Atm128GpioCaptureC__0__Atm128Capture__reset(void) {
  HplAtm128Timer1P__Capture__reset();
}


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

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

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

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

/* Variables and functions */
void USBDevLPMRemoteWake(uint32_t ui32Base) {
  ;
  (*((volatile uint8_t *)(ui32Base + 0x00000362))) |= 0x00000002;
}


x86 assembly (clang, -O0):
<USBDevLPMRemoteWake>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x362(%rax),%ecx
or     $0x2,%ecx
mov    %ecx,0x362(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBDevLPMRemoteWake>:
orl    $0x2,0x362(%rdi)
ret

LLVM IR (-O0):
define void @USBDevLPMRemoteWake(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add nsw i64 %3, 866
%5 = inttoptr i64 %4 to i32*
%6 = load volatile i32, i32* %5
%7 = or i32 %6, 2
store volatile i32 %7, i32* %5
ret void
}

LLVM IR (-O2):
define void @USBDevLPMRemoteWake(i64 %0) {
%2 = add nsw i64 %0, 866
%3 = inttoptr i64 %2 to i32*
%4 = load volatile i32, i32* %3
%5 = or i32 %4, 2
store volatile i32 %5, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ asserter_crash_if(int, int);
void asserter_crash_if_equal(int lvalue, int rvalue, int return_code) {
  asserter_crash_if(lvalue == rvalue, return_code);
}


x86 assembly (clang, -O0):
<asserter_crash_if_equal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    -0xc(%rbp),%esi
call   1030 <asserter_crash_if@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asserter_crash_if_equal>:
xor    %eax,%eax
cmp    %esi,%edi
sete   %al
mov    %eax,%edi
mov    %edx,%esi
jmp    1030 <asserter_crash_if@plt>

LLVM IR (-O0):
define void @asserter_crash_if_equal(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = icmp eq i32 %7, %8
%10 = zext i1 %9 to i32
%11 = load i32, i32* %6
%12 = call i32 @asserter_crash_if(i32 %10, i32 %11)
ret void
}

LLVM IR (-O2):
define void @asserter_crash_if_equal(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, %1
%5 = zext i1 %4 to i32
%6 = tail call i32 @asserter_crash_if(i32 %5, i32 %2)
ret void
}
char *strcpy(char *dest, const char *src) {
  char *ret = dest;
  while ((*dest++ = *src++) != '\0')
    ;
  return ret;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
je     1147 <strcpy+0x47>
jmp    1114 <strcpy+0x14>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rsi,%rcx,1),%edx
mov    %dl,(%rax,%rcx,1)
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <strcpy+0x10>
ret

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

LLVM IR (-O2):
define i8* @strcpy(i8* returned writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %1, %2 ], [ %6, %3 ]
%5 = phi i8* [ %0, %2 ], [ %8, %3 ]
%6 = getelementptr inbounds i8, i8* %4, i64 1
%7 = load i8, i8* %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %7, i8* %5
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret i8* %0
}
void hw_enable_movement_detect(void) { ; }


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

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

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

LLVM IR (-O2):
define void @hw_enable_movement_detect() {
ret void
}
/* Type definitions */
struct feed_glyph {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ feed_glyph_cleanup(struct feed_glyph *const);
void feed_glyph_cleanup_cb(void *const p_object) {
  struct feed_glyph *const p_glyph = (struct feed_glyph *)(p_object);
  feed_glyph_cleanup(p_glyph);
}


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

x86 assembly (clang, -O2):
<feed_glyph_cleanup_cb>:
jmp    1030 <feed_glyph_cleanup@plt>

LLVM IR (-O0):
%struct.feed_glyph = type { i32 }
define void @feed_glyph_cleanup_cb(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.feed_glyph*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to %struct.feed_glyph*
store %struct.feed_glyph* %5, %struct.feed_glyph** %3
%6 = load %struct.feed_glyph*, %struct.feed_glyph** %3
%7 = call i32 @feed_glyph_cleanup(%struct.feed_glyph* %6)
ret void
}

LLVM IR (-O2):
%struct.feed_glyph = type { i32 }
define void @feed_glyph_cleanup_cb(i8* %0) {
%2 = bitcast i8* %0 to %struct.feed_glyph*
%3 = tail call i32 @feed_glyph_cleanup(%struct.feed_glyph* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ goToLOOPEND();
void nextLoop(void) { goToLOOPEND(); }


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

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

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

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

/* Variables and functions */
struct MinHeapNode *buildHuffmanTree(char *, int *, int);
int /*<<< orphan*/ printCodes(struct MinHeapNode *, int *, int);
void HuffmanCodes(char data[], int freq[], int size) {
  struct MinHeapNode *root = buildHuffmanTree(data, freq, size);
  int arr[100], top = 0;
  printCodes(root, arr, top);
}


x86 assembly (clang, -O0):
<HuffmanCodes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <buildHuffmanTree@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x1b4(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x1b0(%rbp),%rsi
mov    -0x1b4(%rbp),%edx
call   1030 <printCodes@plt>
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HuffmanCodes>:
sub    $0x198,%rsp
call   1040 <buildHuffmanTree@plt>
mov    %rsp,%rsi
mov    %rax,%rdi
xor    %edx,%edx
call   1030 <printCodes@plt>
add    $0x198,%rsp
ret

LLVM IR (-O0):
%struct.MinHeapNode = type { i32 }
define void @HuffmanCodes(i8* %0, i32* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca %struct.MinHeapNode*
%8 = alloca [100 x i32]
%9 = alloca i32
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%10 = load i8*, i8** %4
%11 = load i32*, i32** %5
%12 = load i32, i32* %6
%13 = call %struct.MinHeapNode* @buildHuffmanTree(i8* %10, i32* %11, i32 %12)
store %struct.MinHeapNode* %13, %struct.MinHeapNode** %7
store i32 0, i32* %9
%14 = load %struct.MinHeapNode*, %struct.MinHeapNode** %7
%15 = getelementptr inbounds [100 x i32], [100 x i32]* %8, i64 0, i64 0
%16 = load i32, i32* %9
%17 = call i32 @printCodes(%struct.MinHeapNode* %14, i32* %15, i32 %16)
ret void
}

LLVM IR (-O2):
%struct.MinHeapNode = type { i32 }
define void @HuffmanCodes(i8* %0, i32* %1, i32 %2) {
%4 = alloca [100 x i32]
%5 = tail call %struct.MinHeapNode* @buildHuffmanTree(i8* %0, i32* %1, i32 %2)
%6 = bitcast [100 x i32]* %4 to i8*
%7 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 0
%8 = call i32 @printCodes(%struct.MinHeapNode* %5, i32* %7, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isprint(int);
void t_isprint_0x66() {
  Assert_real((isprint(102)),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isprint.c",
              515, ("isprint should be 1 for f"));
}


x86 assembly (clang, -O0):
<t_isprint_0x66>:
push   %rbp
mov    %rsp,%rbp
mov    $0x66,%edi
call   1030 <isprint@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x203,%edx
lea    0xf65(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isprint_0x66>:
push   %rax
mov    $0x66,%edi
call   1030 <isprint@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0x203,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isprint.c\00"
@.str.1 = [26 x i8] c"isprint should be 1 for f\00"
define void @t_isprint_0x66() {
%1 = call i32 @isprint(i32 102)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 515, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isprint.c\00"
@.str.1 = [26 x i8] c"isprint should be 1 for f\00"
define void @t_isprint_0x66() {
%1 = tail call i32 @isprint(i32 102)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 515, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int initialize_quaddobl_solution(int k) {
  int fail, *b;
  double *c;
  fail = _ada_use_c2phc4c(505, &k, b, c, 0);
  return fail;
}


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

x86 assembly (clang, -O2):
<initialize_quaddobl_solution>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x1f9,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @initialize_quaddobl_solution(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @_ada_use_c2phc4c(i32 505, i32* %2, i32* undef, double* undef, i32 0)
ret i32 %3
}
int UARTStdDevClose(void *const pDevObj, int Handle) { return 0; }


x86 assembly (clang, -O0):
<UARTStdDevClose>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @UARTStdDevClose(i8* nocapture readnone %0, i32 %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void assertEquals(int expected, int actual) {
  if (expected != actual) {
    printf("fail: %d != %d\n", expected, actual);
  }
}


x86 assembly (clang, -O0):
<assertEquals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
je     113c <assertEquals+0x2c>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assertEquals>:
mov    %esi,%edx
cmp    %esi,%edi
jne    1117 <assertEquals+0x7>
ret
mov    %edi,%esi
lea    0xee0(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"fail: %d != %d\0A\00"
define void @assertEquals(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 = icmp ne i32 %5, %6
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %10)
br label %12
12: ; preds = %8, %2
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"fail: %d != %d\0A\00"
define void @assertEquals(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, %1
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
br label %6
6: ; preds = %4, %2
ret void
}
int ustrcmp(s, t)
char *s, *t;
{
  static int i;
  while (!(i = toupper(*s++) - toupper(*t)) && *t++)
    ;
  return i;
}


x86 assembly (clang, -O0):
<ustrcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    -0x18(%rbp),%ecx
sub    %eax,%ecx
mov    %ecx,0x2edb(%rip)
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
jne    117a <ustrcmp+0x6a>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    118a <ustrcmp+0x7a>
jmp    118f <ustrcmp+0x7f>
jmp    1120 <ustrcmp+0x10>
mov    0x2e97(%rip),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ustrcmp>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
movsbl (%r15,%rbx,1),%edi
call   1030 <toupper@plt>
mov    %eax,%ebp
movzbl (%r14,%rbx,1),%r12d
movsbl %r12b,%edi
call   1030 <toupper@plt>
sub    %eax,%ebp
jne    1147 <ustrcmp+0x37>
add    $0x1,%rbx
test   %r12b,%r12b
jne    1120 <ustrcmp+0x10>
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @ustrcmp(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %14, %3 ]
%5 = phi i8* [ %1, %2 ], [ %15, %3 ]
%6 = load i8, i8* %4
%7 = sext i8 %6 to i32
%8 = tail call i32 @toupper(i32 %7)
%9 = load i8, i8* %5
%10 = sext i8 %9 to i32
%11 = tail call i32 @toupper(i32 %10)
%12 = sub nsw i32 %8, %11
%13 = icmp ne i32 %12, 0
%14 = getelementptr inbounds i8, i8* %4, i64 1
%15 = getelementptr inbounds i8, i8* %5, i64 1
%16 = icmp eq i8 %9, 0
%17 = select i1 %13, i1 true, i1 %16
br i1 %17, label %18, label %3
18: ; preds = %3
ret i32 %12
}
/* Type definitions */
struct buff {
  int dummy;
};

/* Variables and functions */
int btcmsg_craft_msgheader(struct buff **, char *, int /*<<< orphan*/ *);
int btcmsg_craft_getaddr(struct buff **bufOut) {
  return btcmsg_craft_msgheader(bufOut, "getaddr", NULL);
}


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

x86 assembly (clang, -O2):
<btcmsg_craft_getaddr>:
lea    0xee9(%rip),%rsi
xor    %edx,%edx
jmp    1030 <btcmsg_craft_msgheader@plt>

LLVM IR (-O0):
%struct.buff = type { i32 }
@.str = [8 x i8] c"getaddr\00"
define i32 @btcmsg_craft_getaddr(%struct.buff** %0) {
%2 = alloca %struct.buff**
store %struct.buff** %0, %struct.buff*** %2
%3 = load %struct.buff**, %struct.buff*** %2
%4 = call i32 @btcmsg_craft_msgheader(%struct.buff** %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32* null)
ret i32 %4
}

LLVM IR (-O2):
%struct.buff = type { i32 }
@.str = [8 x i8] c"getaddr\00"
define i32 @btcmsg_craft_getaddr(%struct.buff** %0) {
%2 = tail call i32 @btcmsg_craft_msgheader(%struct.buff** %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32* null)
ret i32 %2
}
/* Variables and functions */
int findDuplicate(int *, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int arr[] = {1, 2, 3, 4, 5, 3, 6};
  printf("%d\n", findDuplicate(arr, 7));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec2(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x7,%esi
call   1040 <findDuplicate@plt>
mov    %eax,%esi
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movups 0xee1(%rip),%xmm0
movups %xmm0,0xc(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x7,%esi
call   1040 <findDuplicate@plt>
lea    0xecd(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

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

LLVM IR (-O2):
@__const.main.arr = [7 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 3, i32 6]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [7 x i32]
%2 = bitcast [7 x i32]* %1 to i8*
%3 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%4 = call i32 @findDuplicate(i32* %3, i32 7)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Type definitions */
typedef int val;
typedef int Elf32_Word;

/* Variables and functions */
void write_elf_word(Elf32_Word val, Elf32_Word *dst, bool swap) {
  *dst = swap ? ((((val)&0x000000ff) << 24) | (((val)&0x0000ff00) << 8) |
                 (((val)&0x00ff0000) >> 8) | (((val)&0xff000000) << 24))
              : val;
}


x86 assembly (clang, -O0):
<write_elf_word>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1155 <write_elf_word+0x55>
mov    -0x4(%rbp),%eax
and    $0xff,%eax
shl    $0x18,%eax
mov    -0x4(%rbp),%ecx
and    $0xff00,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0xff0000,%ecx
sar    $0x8,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0xff000000,%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x18(%rbp)
jmp    115b <write_elf_word+0x5b>
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_elf_word>:
mov    %edi,%eax
and    $0xffffff,%eax
test   %edx,%edx
bswap  %eax
cmove  %edi,%eax
mov    %eax,(%rsi)
ret

LLVM IR (-O0):
define void @write_elf_word(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* %6
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %25
9: ; preds = %3
%10 = load i32, i32* %4
%11 = and i32 %10, 255
%12 = shl i32 %11, 24
%13 = load i32, i32* %4
%14 = and i32 %13, 65280
%15 = shl i32 %14, 8
%16 = or i32 %12, %15
%17 = load i32, i32* %4
%18 = and i32 %17, 16711680
%19 = ashr i32 %18, 8
%20 = or i32 %16, %19
%21 = load i32, i32* %4
%22 = and i32 %21, -16777216
%23 = shl i32 %22, 24
%24 = or i32 %20, %23
br label %27
25: ; preds = %3
%26 = load i32, i32* %4
br label %27
27: ; preds = %25, %9
%28 = phi i32 [ %24, %9 ], [ %26, %25 ]
%29 = load i32*, i32** %5
store i32 %28, i32* %29
ret void
}

LLVM IR (-O2):
define void @write_elf_word(i32 %0, i32* nocapture writeonly %1, i32 %2) {
%4 = icmp eq i32 %2, 0
%5 = and i32 %0, 16777215
%6 = tail call i32 @llvm.bswap.i32(i32 %5)
%7 = select i1 %4, i32 %0, i32 %6
store i32 %7, i32* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ tmpl(char *);
void main() {
  int n;
  int i = 0;
  int k = 0;
  while (i < n) {
    tmpl("(le(i,j,k,n),le(i,j,k,n))");
    i++;
    k = k + 2;
  }
  int j = 0;
  while (j < n) {
    tmpl("(le(i,j,k,n),le(i,j,k,n))");
    if (k <= 0)
    ERROR:;
      j = j + 2;
    k--;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1155 <main+0x45>
lea    0xec7(%rip),%rdi
call   1030 <tmpl@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    1126 <main+0x16>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    119f <main+0x8f>
lea    0xe91(%rip),%rdi
call   1030 <tmpl@plt>
cmpl   $0x0,-0xc(%rbp)
jg     1188 <main+0x78>
jmp    1183 <main+0x73>
jmp    1188 <main+0x78>
mov    -0x10(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    115c <main+0x4c>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [26 x i8] c"(le(i,j,k,n),le(i,j,k,n))\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %2
store i32 0, i32* %3
br label %5
5: ; preds = %9, %0
%6 = load i32, i32* %2
%7 = load i32, i32* %1
%8 = icmp slt i32 %6, %7
br i1 %8, label %9, label %15
9: ; preds = %5
%10 = call i32 @tmpl(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 1
store i32 %12, i32* %2
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 2
store i32 %14, i32* %3
br label %5
15: ; preds = %5
store i32 0, i32* %4
br label %16
16: ; preds = %26, %15
%17 = load i32, i32* %4
%18 = load i32, i32* %1
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %31
20: ; preds = %16
%21 = call i32 @tmpl(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%22 = load i32, i32* %3
%23 = icmp sle i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %20
br label %25
25: ; preds = %24
br label %26
26: ; preds = %25, %20
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 2
store i32 %28, i32* %4
%29 = load i32, i32* %3
%30 = add nsw i32 %29, -1
store i32 %30, i32* %3
br label %16
31: ; preds = %16
ret void
}

LLVM IR (-O2):
define void @main() {
ret void
}
/* Variables and functions */
int printf(char *);
int main() {
  ;
  ;
  ;
  ;
  return printf("Hola a todos");
}


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"Hola a todos\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}

LLVM IR (-O2):
@.str = [13 x i8] c"Hola a todos\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void _print_usage(void) {
  printf("Usage: injector <target PID> <payload file>\n");
}


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

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

LLVM IR (-O0):
@.str = [45 x i8] c"Usage: injector <target PID> <payload file>\0A\00"
define void @_print_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [44 x i8] c"Usage: injector <target PID> <payload file>\00"
define void @_print_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct ibv_wq_attr {
  int dummy;
};
struct ibv_wq {
  int dummy;
};

/* Variables and functions */
int ibv_modify_wq(struct ibv_wq *, struct ibv_wq_attr *);
int mlx4_glue_modify_wq(struct ibv_wq *wq, struct ibv_wq_attr *wq_attr) {
  return ibv_modify_wq(wq, wq_attr);
}


x86 assembly (clang, -O0):
<mlx4_glue_modify_wq>:
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 <ibv_modify_wq@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mlx4_glue_modify_wq>:
jmp    1030 <ibv_modify_wq@plt>

LLVM IR (-O0):
%struct.ibv_wq = type { i32 }
%struct.ibv_wq_attr = type { i32 }
define i32 @mlx4_glue_modify_wq(%struct.ibv_wq* %0, %struct.ibv_wq_attr* %1) {
%3 = alloca %struct.ibv_wq*
%4 = alloca %struct.ibv_wq_attr*
store %struct.ibv_wq* %0, %struct.ibv_wq** %3
store %struct.ibv_wq_attr* %1, %struct.ibv_wq_attr** %4
%5 = load %struct.ibv_wq*, %struct.ibv_wq** %3
%6 = load %struct.ibv_wq_attr*, %struct.ibv_wq_attr** %4
%7 = call i32 @ibv_modify_wq(%struct.ibv_wq* %5, %struct.ibv_wq_attr* %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.ibv_wq = type { i32 }
%struct.ibv_wq_attr = type { i32 }
define i32 @mlx4_glue_modify_wq(%struct.ibv_wq* %0, %struct.ibv_wq_attr* %1) {
%3 = tail call i32 @ibv_modify_wq(%struct.ibv_wq* %0, %struct.ibv_wq_attr* %1)
ret i32 %3
}
/* Variables and functions */
int getch();
int con_getKey() { return getch(); }


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

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

LLVM IR (-O0):
define i32 @con_getKey() {
%1 = call i32 (...) @getch()
ret i32 %1
}

LLVM IR (-O2):
define i32 @con_getKey() {
%1 = tail call i32 (...) @getch()
ret i32 %1
}
void OPA_read_write_barrier(void) {
  int a = 0;
  __asm__ __volatile__("lock orl $0, %0" : "+m"(a));
}


x86 assembly (clang, -O0):
<OPA_read_write_barrier>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
lock orl $0x0,-0x4(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<OPA_read_write_barrier>:
movl   $0x0,-0x4(%rsp)
lock orl $0x0,-0x4(%rsp)
ret

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

LLVM IR (-O2):
define void @OPA_read_write_barrier() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
ret void
}
/* Type definitions */
struct lifo {
  int dummy;
};

/* Variables and functions */
double pop(struct lifo *);
double tgamma(double);
double opr_tgamma(struct lifo *stack) {
  double op = pop(stack);
  return tgamma(op);
}


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

x86 assembly (clang, -O2):
<opr_tgamma>:
push   %rax
call   1040 <pop@plt>
pop    %rax
jmp    1030 <tgamma@plt>

LLVM IR (-O0):
%struct.lifo = type { i32 }
define double @opr_tgamma(%struct.lifo* %0) {
%2 = alloca %struct.lifo*
%3 = alloca double
store %struct.lifo* %0, %struct.lifo** %2
%4 = load %struct.lifo*, %struct.lifo** %2
%5 = call double @pop(%struct.lifo* %4)
store double %5, double* %3
%6 = load double, double* %3
%7 = call double @tgamma(double %6)
ret double %7
}

LLVM IR (-O2):
%struct.lifo = type { i32 }
define double @opr_tgamma(%struct.lifo* %0) {
%2 = tail call double @pop(%struct.lifo* %0)
%3 = tail call double @tgamma(double %2)
ret double %3
}
int ptrace(r, p, a, d)
int *a;
{ return (0); }


x86 assembly (clang, -O0):
<ptrace>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @ptrace(i32 %0, i32 %1, i32* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i32 %3, i32* %8
ret i32 0
}

LLVM IR (-O2):
define i32 @ptrace(i32 %0, i32 %1, i32* nocapture readnone %2, i32 %3) {
ret i32 0
}
int divisors_num_bf(int num) {
  int i, result, start;
  start = num / 2;
  if (num % 2 == 0)
    result = 3;
  else
    result = 2;
  for (i = start; i > 2; i--)
    if (num % i == 0)
      result++;
  return result;
}


x86 assembly (clang, -O0):
<divisors_num_bf>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1135 <divisors_num_bf+0x35>
movl   $0x3,-0xc(%rbp)
jmp    113c <divisors_num_bf+0x3c>
movl   $0x2,-0xc(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    1178 <divisors_num_bf+0x78>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cmp    $0x0,%edx
jne    1165 <divisors_num_bf+0x65>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    116a <divisors_num_bf+0x6a>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1142 <divisors_num_bf+0x42>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<divisors_num_bf>:
mov    %edi,%ecx
and    $0x1,%ecx
xor    $0x3,%ecx
cmp    $0x6,%edi
jl     1135 <divisors_num_bf+0x35>
mov    %edi,%esi
shr    %esi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %edi,%eax
cltd
idiv   %esi
cmp    $0x1,%edx
adc    $0x0,%ecx
lea    -0x1(%rsi),%eax
cmp    $0x3,%esi
mov    %eax,%esi
ja     1120 <divisors_num_bf+0x20>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @divisors_num_bf(i32 %0) {
%2 = and i32 %0, 1
%3 = xor i32 %2, 3
%4 = icmp sgt i32 %0, 5
br i1 %4, label %5, label %16
5: ; preds = %1
%6 = lshr i32 %0, 1
br label %7
7: ; preds = %5, %7
%8 = phi i32 [ %14, %7 ], [ %6, %5 ]
%9 = phi i32 [ %13, %7 ], [ %3, %5 ]
%10 = srem i32 %0, %8
%11 = icmp eq i32 %10, 0
%12 = zext i1 %11 to i32
%13 = add nuw nsw i32 %9, %12
%14 = add nsw i32 %8, -1
%15 = icmp ugt i32 %8, 3
br i1 %15, label %7, label %16
16: ; preds = %7, %1
%17 = phi i32 [ %3, %1 ], [ %13, %7 ]
ret i32 %17
}