xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ ENOMEM;
int fail(int /*<<< orphan*/, char *);
int fail_out_of_memory() { return fail(ENOMEM, "out of memory"); }


x86 assembly (clang, -O0):
<fail_out_of_memory>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fail@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fail_out_of_memory>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fail@plt>

LLVM IR (-O0):
@ENOMEM = global i32 0
@.str = [14 x i8] c"out of memory\00"
define i32 @fail_out_of_memory() {
%1 = load i32, i32* @ENOMEM
%2 = call i32 @fail(i32 %1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}

LLVM IR (-O2):
@ENOMEM = global i32 0
@.str = [14 x i8] c"out of memory\00"
define i32 @fail_out_of_memory() {
%1 = load i32, i32* @ENOMEM
%2 = tail call i32 @fail(i32 %1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}
/* Variables and functions */
int wordncmp(char *, char *);
int sortcmp(const void *p, const void *q) {
  return wordncmp(*((char **)p), *((char **)q));
}


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

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

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

LLVM IR (-O2):
define i32 @sortcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
%7 = tail call i32 @wordncmp(i8* %4, i8* %6)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *xmalloc(scalar_t__);
char *xstrdup(const char *s) {
  char *p = xmalloc(strlen(s) + 1);
  strcpy(p, s);
  return p;
}


x86 assembly (clang, -O0):
<xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <xmalloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <xmalloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @xstrdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i8* @xmalloc(i64 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = load i8*, i8** %2
%10 = call i32 @strcpy(i8* %8, i8* %9)
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
define i8* @xstrdup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @xmalloc(i64 %3)
%5 = tail call i32 @strcpy(i8* %4, i8* %0)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int foo1();
int main(void) {
  if (foo1() != -1)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <foo1@plt>
cmp    $0xffffffff,%eax
je     1146 <main+0x26>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <foo1@plt>
cmp    $0xffffffff,%eax
jne    1131 <main+0x11>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @foo1()
%3 = icmp ne i32 %2, -1
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @foo1()
%2 = icmp eq i32 %1, -1
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ run(char *, char const *, char const *, char const *);
void translation(const char *phrase, const char *source, const char *destiny) {
  run("xdg-open \"http://translate.google.com/translate_t#%s|%s|%s\"", source,
      destiny, phrase);
}


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

x86 assembly (clang, -O2):
<translation>:
mov    %rdi,%rcx
lea    0xee6(%rip),%rdi
jmp    1030 <run@plt>

LLVM IR (-O0):
@.str = [60 x i8] c"xdg-open \22http://translate.google.com/translate_t#%s|%s|%s\22\00"
define void @translation(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %5
%8 = load i8*, i8** %6
%9 = load i8*, i8** %4
%10 = call i32 @run(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8, i8* %9)
ret void
}

LLVM IR (-O2):
@.str = [60 x i8] c"xdg-open \22http://translate.google.com/translate_t#%s|%s|%s\22\00"
define void @translation(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @run(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2, i8* %0)
ret void
}
long ab_plus_c(long a, long b, long c) { return a * b + c; }


x86 assembly (clang, -O0):
<ab_plus_c>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
imul   -0x10(%rbp),%rax
add    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ab_plus_c>:
imul   %rsi,%rdi
lea    (%rdi,%rdx,1),%rax
ret

LLVM IR (-O0):
define i64 @ab_plus_c(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %4
%8 = load i64, i64* %5
%9 = mul nsw i64 %7, %8
%10 = load i64, i64* %6
%11 = add nsw i64 %9, %10
ret i64 %11
}

LLVM IR (-O2):
define i64 @ab_plus_c(i64 %0, i64 %1, i64 %2) {
%4 = mul nsw i64 %1, %0
%5 = add nsw i64 %4, %2
ret i64 %5
}
/* Variables and functions */
float get_overhead();
float memory_latency(float);
int /*<<< orphan*/ pmcr_init();
int /*<<< orphan*/ printf(char *, float);
int main() {
  float memlatency_result;
  pmcr_init();
  float ccnt_overhead;
  ccnt_overhead = get_overhead();
  printf("Reading overhead time is : %f\n", ccnt_overhead);
  memlatency_result = memory_latency(ccnt_overhead);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <pmcr_init@plt>
mov    $0x0,%al
call   1040 <get_overhead@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
call   1050 <memory_latency@plt>
movss  %xmm0,-0x8(%rbp)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1060 <pmcr_init@plt>
xor    %eax,%eax
call   1040 <get_overhead@plt>
movss  %xmm0,0x4(%rsp)
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
movss  0x4(%rsp),%xmm0
call   1050 <memory_latency@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Reading overhead time is : %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store i32 0, i32* %1
%4 = call i32 (...) @pmcr_init()
%5 = call float (...) @get_overhead()
store float %5, float* %3
%6 = load float, float* %3
%7 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), float %6)
%8 = load float, float* %3
%9 = call float @memory_latency(float %8)
store float %9, float* %2
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"Reading overhead time is : %f\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @pmcr_init()
%2 = tail call float (...) @get_overhead()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), float %2)
%4 = tail call float @memory_latency(float %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ GetDstFileSize();
char *HashPassword(char *);
int /*<<< orphan*/ JudgeEBmpValidity();
int /*<<< orphan*/ OpenAllFile(char *, char *);
int /*<<< orphan*/ SaveCarryFile(char *);
int /*<<< orphan*/ closeAllFile();
unsigned long decryption(char *src, char *password, char *dst) {
  char *hashPwd;
  hashPwd = HashPassword(password);
  OpenAllFile(src, dst);
  JudgeEBmpValidity();
  GetDstFileSize();
  SaveCarryFile(hashPwd);
  closeAllFile();
  return 0;
}


x86 assembly (clang, -O0):
<decryption>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <HashPassword@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <OpenAllFile@plt>
mov    $0x0,%al
call   1050 <JudgeEBmpValidity@plt>
mov    $0x0,%al
call   1070 <GetDstFileSize@plt>
mov    -0x20(%rbp),%rdi
call   1080 <SaveCarryFile@plt>
mov    $0x0,%al
call   1030 <closeAllFile@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decryption>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1060 <HashPassword@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <OpenAllFile@plt>
xor    %eax,%eax
call   1050 <JudgeEBmpValidity@plt>
xor    %eax,%eax
call   1070 <GetDstFileSize@plt>
mov    %r15,%rdi
call   1080 <SaveCarryFile@plt>
xor    %eax,%eax
call   1030 <closeAllFile@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @decryption(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %5
%9 = call i8* @HashPassword(i8* %8)
store i8* %9, i8** %7
%10 = load i8*, i8** %4
%11 = load i8*, i8** %6
%12 = call i32 @OpenAllFile(i8* %10, i8* %11)
%13 = call i32 (...) @JudgeEBmpValidity()
%14 = call i32 (...) @GetDstFileSize()
%15 = load i8*, i8** %7
%16 = call i32 @SaveCarryFile(i8* %15)
%17 = call i32 (...) @closeAllFile()
ret i64 0
}

LLVM IR (-O2):
define i64 @decryption(i8* %0, i8* %1, i8* %2) {
%4 = tail call i8* @HashPassword(i8* %1)
%5 = tail call i32 @OpenAllFile(i8* %0, i8* %2)
%6 = tail call i32 (...) @JudgeEBmpValidity()
%7 = tail call i32 (...) @GetDstFileSize()
%8 = tail call i32 @SaveCarryFile(i8* %4)
%9 = tail call i32 (...) @closeAllFile()
ret i64 0
}
void NV12ToRAW() {}


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

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

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

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

/* Variables and functions */
void *nla_reserve(void **, int, int);
void nla_put_le32(void **ctx, int t, __le32 var) {
  void *data = nla_reserve(ctx, t, sizeof(__le32));
  *(__le32 *)data = var;
}


x86 assembly (clang, -O0):
<nla_put_le32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    $0x4,%edx
call   1030 <nla_reserve@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nla_put_le32>:
push   %rbx
mov    %edx,%ebx
mov    $0x4,%edx
call   1030 <nla_reserve@plt>
mov    %ebx,(%rax)
pop    %rbx
ret

LLVM IR (-O0):
define void @nla_put_le32(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
%9 = load i32, i32* %5
%10 = call i8* @nla_reserve(i8** %8, i32 %9, i32 4)
store i8* %10, i8** %7
%11 = load i32, i32* %6
%12 = load i8*, i8** %7
%13 = bitcast i8* %12 to i32*
store i32 %11, i32* %13
ret void
}

LLVM IR (-O2):
define void @nla_put_le32(i8** %0, i32 %1, i32 %2) {
%4 = tail call i8* @nla_reserve(i8** %0, i32 %1, i32 4)
%5 = bitcast i8* %4 to i32*
store i32 %2, i32* %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *, float *);
int main() {
  float a, b;
  printf("Enter two numbers: ");
  scanf("%f %f", &a, &b);
  float c = a + b;
  printf("c = %f\n", c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeaa(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
addss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xec1(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Enter two numbers: \00"
@.str.1 = [6 x i8] c"%f %f\00"
@.str.2 = [8 x i8] c"c = %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float* %2, float* %3)
%7 = load float, float* %2
%8 = load float, float* %3
%9 = fadd float %7, %8
store float %9, float* %4
%10 = load float, float* %4
%11 = fpext float %10 to double
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), double %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Enter two numbers: \00"
@.str.1 = [6 x i8] c"%f %f\00"
@.str.2 = [8 x i8] c"c = %f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = bitcast float* %1 to i8*
%4 = bitcast float* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float* %1, float* %2)
%7 = load float, float* %1
%8 = load float, float* %2
%9 = fadd float %7, %8
%10 = fpext float %9 to double
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), double %10)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ usb_stop();
void usb_stor_exit(void) { usb_stop(); }


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

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

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

LLVM IR (-O2):
define void @usb_stor_exit() {
%1 = tail call i32 (...) @usb_stop()
ret void
}
/* Type definitions */
typedef scalar_t__ int16_t;

/* Variables and functions */
int16_t sum(int16_t n) {
  int16_t result = 0;
  while (n > 0) {
    result += n;
    n--;
  }
  return result;
}


x86 assembly (clang, -O0):
<sum>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jle    1138 <sum+0x38>
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
jmp    1110 <sum+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sum>:
test   %rdi,%rdi
jle    1126 <sum+0x26>
lea    -0x1(%rdi),%rax
mov    %rax,%rcx
imul   %rax,%rcx
lea    -0x2(%rdi),%rdx
mul    %rdx
shld   $0x3f,%rax,%rdx
add    %rdi,%rcx
sub    %rdx,%rcx
mov    %rcx,%rax
ret
xor    %ecx,%ecx
mov    %rcx,%rax
ret

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

LLVM IR (-O2):
define i64 @sum(i64 %0) {
%2 = icmp sgt i64 %0, 0
br i1 %2, label %3, label %14
3: ; preds = %1
%4 = add nsw i64 %0, -1
%5 = mul i64 %4, %4
%6 = zext i64 %4 to i65
%7 = add nsw i64 %0, -2
%8 = zext i64 %7 to i65
%9 = mul i65 %6, %8
%10 = lshr i65 %9, 1
%11 = trunc i65 %10 to i64
%12 = add i64 %5, %0
%13 = sub i64 %12, %11
br label %14
14: ; preds = %3, %1
%15 = phi i64 [ 0, %1 ], [ %13, %3 ]
ret i64 %15
}
extern void impl_aux_info(int const len1, int const len2) {
  if (0 == len1 || 0 == len2) {
  }
}


x86 assembly (clang, -O0):
<impl_aux_info>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %eax,%eax
cmp    -0x4(%rbp),%eax
je     1120 <impl_aux_info+0x20>
xor    %eax,%eax
cmp    -0x8(%rbp),%eax
jne    1125 <impl_aux_info+0x25>
jmp    1125 <impl_aux_info+0x25>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @impl_aux_info(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 = icmp eq i32 0, %5
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = load i32, i32* %4
%9 = icmp eq i32 0, %8
br i1 %9, label %10, label %11
10: ; preds = %7, %2
br label %11
11: ; preds = %10, %7
ret void
}

LLVM IR (-O2):
define void @impl_aux_info(i32 %0, i32 %1) {
ret void
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int type;
};
struct TYPE_4__ {
  TYPE_1__ xerror;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
void set_XEvent_xerror_type(void *_p, int _v) {
  ((XEvent *)_p)->xerror.type = (int)_v;
}


x86 assembly (clang, -O0):
<set_XEvent_xerror_type>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_XEvent_xerror_type>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i32 }
define void @set_XEvent_xerror_type(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_4__*
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
store i32 %5, i32* %9
ret void
}

LLVM IR (-O2):
define void @set_XEvent_xerror_type(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
void logDebug(const char *logline, ...) {}


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

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

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

LLVM IR (-O2):
define void @logDebug(i8* nocapture %0, ...) {
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, char const *, int);
const char *firmware_make_path(const char *firmware_dir, uint32_t addr) {
  static char path_out[256];
  snprintf(path_out, 256, "%s/%08X.hex", firmware_dir, addr);
  return path_out;
}


x86 assembly (clang, -O0):
<firmware_make_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%r8d
lea    0x2f12(%rip),%rdi
mov    $0x100,%esi
lea    0xec6(%rip),%rdx
call   1030 <snprintf@plt>
lea    0x2efa(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<firmware_make_path>:
push   %rbx
mov    %esi,%r8d
mov    %rdi,%rcx
lea    0x2f22(%rip),%rbx
lea    0xedb(%rip),%rdx
mov    %rbx,%rdi
mov    $0x100,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@firmware_make_path.path_out = internal global [256 x i8] zeroinitializer
@.str = [12 x i8] c"%s/%08X.hex\00"
define i8* @firmware_make_path(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 @snprintf(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @firmware_make_path.path_out, i64 0, i64 0), i32 256, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %6)
ret i8* getelementptr inbounds ([256 x i8], [256 x i8]* @firmware_make_path.path_out, i64 0, i64 0)
}

LLVM IR (-O2):
@firmware_make_path.path_out = internal global [256 x i8] zeroinitializer
@.str = [12 x i8] c"%s/%08X.hex\00"
define i8* @firmware_make_path(i8* %0, i32 %1) {
%3 = tail call i32 @snprintf(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @firmware_make_path.path_out, i64 0, i64 0), i32 256, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
ret i8* getelementptr inbounds ([256 x i8], [256 x i8]* @firmware_make_path.path_out, i64 0, i64 0)
}
void wait_less(long *wait) {
  if (*wait > 0)
    *wait -= 50000000L;
}


x86 assembly (clang, -O0):
<wait_less>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
jle    1127 <wait_less+0x27>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
sub    $0x2faf080,%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_less>:
mov    (%rdi),%rax
test   %rax,%rax
jle    1111 <wait_less+0x11>
add    $0xfffffffffd050f80,%rax
mov    %rax,(%rdi)
ret

LLVM IR (-O0):
define void @wait_less(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = icmp sgt i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i64*, i64** %2
%8 = load i64, i64* %7
%9 = sub nsw i64 %8, 50000000
store i64 %9, i64* %7
br label %10
10: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
define void @wait_less(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = icmp sgt i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = add nsw i64 %2, -50000000
store i64 %5, i64* %0
br label %6
6: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, int, char const *);
void _debug_printf(const char *message) {
  printf("%s(%d) : %s\n",
         "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/zrk571/libobdii/refs/heads/master/src/"
         "various.c",
         4, message);
}


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

x86 assembly (clang, -O2):
<_debug_printf>:
mov    %rdi,%rcx
lea    0xee6(%rip),%rdi
lea    0xeec(%rip),%rsi
mov    $0x4,%edx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"%s(%d) : %s\0A\00"
@.str.1 = [138 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/zrk571/libobdii/refs/heads/master/src/various.c\00"
define void @_debug_printf(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.1, i64 0, i64 0), i32 4, i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"%s(%d) : %s\0A\00"
@.str.1 = [138 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/zrk571/libobdii/refs/heads/master/src/various.c\00"
define void @_debug_printf(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.1, i64 0, i64 0), i32 4, i8* %0)
ret void
}
OP(ed, e1) {}


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

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

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

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
ret i32 undef
}
int test_imm_EEint32_mem(int *val) {
  return ((*val) & (0xEE << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_EEint32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 238
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
float *vec2_zero(float *result) {
  result[0] = 0.0f;
  result[1] = 0.0f;
  return result;
}


x86 assembly (clang, -O0):
<vec2_zero>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x4(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec2_zero>:
mov    %rdi,%rax
movq   $0x0,(%rdi)
ret

LLVM IR (-O0):
define float* @vec2_zero(float* %0) {
%2 = alloca float*
store float* %0, float** %2
%3 = load float*, float** %2
%4 = getelementptr inbounds float, float* %3, i64 0
store float 0.000000e+00, float* %4
%5 = load float*, float** %2
%6 = getelementptr inbounds float, float* %5, i64 1
store float 0.000000e+00, float* %6
%7 = load float*, float** %2
ret float* %7
}

LLVM IR (-O2):
define float* @vec2_zero(float* returned writeonly %0) {
store float 0.000000e+00, float* %0
%2 = getelementptr inbounds float, float* %0, i64 1
store float 0.000000e+00, float* %2
ret float* %0
}
/* Variables and functions */
int /*<<< orphan*/ hc_pairs_downstream(unsigned int, char, char *, unsigned int,
                                       int *);
int /*<<< orphan*/ hc_pairs_upstream(unsigned int, char, char *, unsigned int,
                                     int *);
void hc_cant_pair(unsigned int i, char c_option, char *hc, unsigned int length,
                  unsigned int min_loop_size, int *index) {
  hc_pairs_upstream(i, c_option, hc, length, index);
  hc_pairs_downstream(i, c_option, hc, length, index);
}


x86 assembly (clang, -O0):
<hc_cant_pair>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x5(%rbp),%al
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x20(%rbp),%r8
movsbl %al,%esi
call   1040 <hc_pairs_upstream@plt>
mov    -0x4(%rbp),%edi
mov    -0x5(%rbp),%al
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x20(%rbp),%r8
movsbl %al,%esi
call   1030 <hc_pairs_downstream@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hc_cant_pair>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r9,%r14
mov    %ecx,%r15d
mov    %rdx,%r12
mov    %esi,%ebp
mov    %edi,%ebx
mov    %r9,%r8
call   1040 <hc_pairs_upstream@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r12,%rdx
mov    %r15d,%ecx
mov    %r14,%r8
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <hc_pairs_downstream@plt>

LLVM IR (-O0):
define void @hc_cant_pair(i32 %0, i8 signext %1, i8* %2, i32 %3, i32 %4, i32* %5) {
%7 = alloca i32
%8 = alloca i8
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
store i32 %0, i32* %7
store i8 %1, i8* %8
store i8* %2, i8** %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32* %5, i32** %12
%13 = load i32, i32* %7
%14 = load i8, i8* %8
%15 = load i8*, i8** %9
%16 = load i32, i32* %10
%17 = load i32*, i32** %12
%18 = call i32 @hc_pairs_upstream(i32 %13, i8 signext %14, i8* %15, i32 %16, i32* %17)
%19 = load i32, i32* %7
%20 = load i8, i8* %8
%21 = load i8*, i8** %9
%22 = load i32, i32* %10
%23 = load i32*, i32** %12
%24 = call i32 @hc_pairs_downstream(i32 %19, i8 signext %20, i8* %21, i32 %22, i32* %23)
ret void
}

LLVM IR (-O2):
define void @hc_cant_pair(i32 %0, i8 signext %1, i8* %2, i32 %3, i32 %4, i32* %5) {
%7 = tail call i32 @hc_pairs_upstream(i32 %0, i8 signext %1, i8* %2, i32 %3, i32* %5)
%8 = tail call i32 @hc_pairs_downstream(i32 %0, i8 signext %1, i8* %2, i32 %3, i32* %5)
ret void
}
/* Type definitions */
typedef unsigned long uint8_t;

/* Variables and functions */
void bit_set8(volatile uint8_t *ptr, uint8_t bit) {
  *((volatile uint8_t *)(((uintptr_t)ptr) | (1 << 27))) =
      (uint8_t)((1ul << bit));
}


x86 assembly (clang, -O0):
<bit_set8>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    $0x1,%eax
shl    %cl,%rax
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
or     $0x8000000,%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_set8>:
mov    %rsi,%rcx
mov    $0x1,%eax
shl    %cl,%rax
or     $0x8000000,%rdi
mov    %rax,(%rdi)
ret

LLVM IR (-O0):
define void @bit_set8(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 = shl i64 1, %5
%7 = load i64*, i64** %3
%8 = ptrtoint i64* %7 to i64
%9 = or i64 %8, 134217728
%10 = inttoptr i64 %9 to i64*
store volatile i64 %6, i64* %10
ret void
}

LLVM IR (-O2):
define void @bit_set8(i64* %0, i64 %1) {
%3 = shl nuw i64 1, %1
%4 = ptrtoint i64* %0 to i64
%5 = or i64 %4, 134217728
%6 = inttoptr i64 %5 to i64*
store volatile i64 %3, i64* %6
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ putc(int, int /*<<< orphan*/ *);
void filecopy(FILE *ifp, FILE *ofp) {
  int c;
  while ((c = getc(ifp)) != EOF)
    putc(c, ofp);
}


x86 assembly (clang, -O0):
<filecopy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <getc@plt>
mov    %eax,-0x14(%rbp)
mov    0x2ea5(%rip),%rcx
cmp    (%rcx),%eax
je     115c <filecopy+0x3c>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <putc@plt>
jmp    1130 <filecopy+0x10>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filecopy>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <getc@plt>
mov    0x2eb1(%rip),%r15
cmp    (%r15),%eax
je     1157 <filecopy+0x37>
nopl   0x0(%rax)
mov    %eax,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
mov    %rbx,%rdi
call   1040 <getc@plt>
cmp    (%r15),%eax
jne    1140 <filecopy+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@EOF = global i32 0
define void @filecopy(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
br label %6
6: ; preds = %11, %2
%7 = load i32*, i32** %3
%8 = call i32 @getc(i32* %7)
store i32 %8, i32* %5
%9 = load i32, i32* @EOF
%10 = icmp ne i32 %8, %9
br i1 %10, label %11, label %15
11: ; preds = %6
%12 = load i32, i32* %5
%13 = load i32*, i32** %4
%14 = call i32 @putc(i32 %12, i32* %13)
br label %6
15: ; preds = %6
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
define void @filecopy(i32* nocapture %0, i32* nocapture %1) {
%3 = tail call i32 @getc(i32* %0)
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %12, label %6
6: ; preds = %2, %6
%7 = phi i32 [ %9, %6 ], [ %3, %2 ]
%8 = tail call i32 @putc(i32 %7, i32* %1)
%9 = tail call i32 @getc(i32* %0)
%10 = load i32, i32* @EOF
%11 = icmp eq i32 %9, %10
br i1 %11, label %12, label %6
12: ; preds = %6, %2
ret void
}
void flash_ram_copy_all_end() { asm volatile("nop"); }


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

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

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

LLVM IR (-O2):
define void @flash_ram_copy_all_end() {
tail call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int test_socket(void) { return socket(AF_INET, SOCK_STREAM, 0); }


x86 assembly (clang, -O0):
<test_socket>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
mov    0x2eb4(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <socket@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_socket>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
mov    0x2eb8(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
jmp    1030 <socket@plt>

LLVM IR (-O0):
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
define i32 @test_socket() {
%1 = load i32, i32* @AF_INET
%2 = load i32, i32* @SOCK_STREAM
%3 = call i32 @socket(i32 %1, i32 %2, i32 0)
ret i32 %3
}

LLVM IR (-O2):
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
define i32 @test_socket() {
%1 = load i32, i32* @AF_INET
%2 = load i32, i32* @SOCK_STREAM
%3 = tail call i32 @socket(i32 %1, i32 %2, i32 0)
ret i32 %3
}
void random_init(void) {}


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

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

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

LLVM IR (-O2):
define void @random_init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ syslog(int, char *, char const *);
void syslog_log_func(int level, const char *msg) { syslog(level, "%s\n", msg); }


x86 assembly (clang, -O0):
<syslog_log_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xed3(%rip),%rsi
call   1030 <syslog@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @syslog_log_func(i32 %0, i8* %1) {
%3 = tail call i32 @syslog(i32 %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}
/* Variables and functions */
scalar_t__ errno;
size_t fread(void *, int, size_t, void *);
long io_read(void *buf, size_t bytes, void *uptr) {
  size_t sz = fread(buf, 1, bytes, uptr);
  if (sz < bytes && errno)
    return -1;
  return sz;
}


x86 assembly (clang, -O0):
<io_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
call   1030 <fread@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    116a <io_read+0x5a>
mov    0x2e8d(%rip),%rax
cmpq   $0x0,(%rax)
je     116a <io_read+0x5a>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    1172 <io_read+0x62>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_read>:
push   %rbx
mov    %rdx,%rcx
mov    %rsi,%rbx
mov    $0x1,%esi
mov    %rbx,%rdx
call   1030 <fread@plt>
mov    0x2eb5(%rip),%rcx
xor    %edx,%edx
cmp    (%rcx),%rdx
sbb    %rcx,%rcx
or     %rax,%rcx
cmp    %rbx,%rax
cmovb  %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@errno = global i64 0
define i64 @io_read(i8* %0, i64 %1, i8* %2) {
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = load i8*, i8** %7
%12 = call i64 @fread(i8* %9, i32 1, i64 %10, i8* %11)
store i64 %12, i64* %8
%13 = load i64, i64* %8
%14 = load i64, i64* %6
%15 = icmp ult i64 %13, %14
br i1 %15, label %16, label %20
16: ; preds = %3
%17 = load i64, i64* @errno
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %16
store i64 -1, i64* %4
br label %22
20: ; preds = %16, %3
%21 = load i64, i64* %8
store i64 %21, i64* %4
br label %22
22: ; preds = %20, %19
%23 = load i64, i64* %4
ret i64 %23
}

LLVM IR (-O2):
@errno = global i64 0
define i64 @io_read(i8* nocapture %0, i64 %1, i8* nocapture %2) {
%4 = tail call i64 @fread(i8* %0, i32 1, i64 %1, i8* %2)
%5 = icmp ult i64 %4, %1
%6 = load i64, i64* @errno
%7 = icmp ne i64 %6, 0
%8 = select i1 %5, i1 %7, i1 false
%9 = select i1 %8, i64 -1, i64 %4
ret i64 %9
}
/* Variables and functions */
int env_is_set(char const **, char const *);
int ft_strlen(char const *);
char *env_get_var(char **env, const char *var_asked) {
  int i;
  if ((i = env_is_set((const char **)env, var_asked)) < 0)
    return (NULL);
  return (env[i] + ft_strlen(var_asked) + 1);
}


x86 assembly (clang, -O0):
<env_get_var>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <env_is_set@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
jge    1156 <env_get_var+0x36>
movq   $0x0,-0x8(%rbp)
jmp    1183 <env_get_var+0x63>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <ft_strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<env_get_var>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <env_is_set@plt>
test   %eax,%eax
js     114c <env_get_var+0x2c>
mov    %eax,%eax
mov    (%rbx,%rax,8),%rbx
mov    %r14,%rdi
call   1030 <ft_strlen@plt>
cltq
add    %rbx,%rax
add    $0x1,%rax
jmp    114e <env_get_var+0x2e>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @env_get_var(i8** %0, i8* %1) {
%3 = tail call i32 @env_is_set(i8** %0, i8* %1)
%4 = icmp slt i32 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2
%6 = zext i32 %3 to i64
%7 = getelementptr inbounds i8*, i8** %0, i64 %6
%8 = load i8*, i8** %7
%9 = tail call i32 @ft_strlen(i8* %1)
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = getelementptr inbounds i8, i8* %11, i64 1
br label %13
13: ; preds = %2, %5
%14 = phi i8* [ %12, %5 ], [ null, %2 ]
ret i8* %14
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_ip(char *host) { printf("TODO\n"); }


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

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

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

LLVM IR (-O2):
@str = [5 x i8] c"TODO\00"
define void @print_ip(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int debug() {
  printf("Hello from debug");
  return 0;
}


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

x86 assembly (clang, -O2):
<debug>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Hello from debug\00"
define i32 @debug() {
%1 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Hello from debug\00"
define i32 @debug() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ registerPipe(int /*<<< orphan*/ *);
int /*<<< orphan*/ stdout;
FILE *openPipe(char *pipeName, char *mode) {
  FILE *pipe;
  fflush(stdout);
  if ((pipe = popen(pipeName, mode)))
    registerPipe(pipe);
  return pipe;
}


x86 assembly (clang, -O0):
<openPipe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <popen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1172 <openPipe+0x42>
mov    -0x18(%rbp),%rdi
call   1030 <registerPipe@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<openPipe>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x2e9f(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <popen@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1163 <openPipe+0x33>
mov    %rbx,%rdi
call   1030 <registerPipe@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@stdout = global i32 0
define i32* @openPipe(i8* nocapture %0, i8* nocapture %1) {
%3 = load i32, i32* @stdout
%4 = tail call i32 @fflush(i32 %3)
%5 = tail call i32* @popen(i8* %0, i8* %1)
%6 = icmp eq i32* %5, null
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = tail call i32 @registerPipe(i32* %5)
br label %9
9: ; preds = %7, %2
ret i32* %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *);
int main(void) {
  printf("%s %s\n", "Hello", "Linux");
  printf("%s : %s\n", "Author", "tauqeer.mf@gail.com");
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xee8(%rip),%rsi
lea    0xee7(%rip),%rdx
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
lea    0xee3(%rip),%rsi
lea    0xee3(%rip),%rdx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%s %s\0A\00"
@.str.1 = [6 x i8] c"Hello\00"
@.str.2 = [6 x i8] c"Linux\00"
@.str.3 = [9 x i8] c"%s : %s\0A\00"
@.str.4 = [7 x i8] c"Author\00"
@.str.5 = [20 x i8] c"tauqeer.mf@gail.com\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s %s\0A\00"
@.str.1 = [6 x i8] c"Hello\00"
@.str.2 = [6 x i8] c"Linux\00"
@.str.3 = [9 x i8] c"%s : %s\0A\00"
@.str.4 = [7 x i8] c"Author\00"
@.str.5 = [20 x i8] c"tauqeer.mf@gail.com\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}
int do_705() { return 705; }


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

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

LLVM IR (-O0):
define i32 @do_705() {
ret i32 705
}

LLVM IR (-O2):
define i32 @do_705() {
ret i32 705
}