xunge/DecIR huggingface dataset:
int test_imm_1Dint8_reg(signed char val) {
  return ((val) & (0x1D << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_1Dint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0x1d,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_1Dint8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, 29
%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_1Dint8_reg(i8 signext %0) {
%2 = and i8 %0, 29
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void SobelXRow_SSE2() {}


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

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

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

LLVM IR (-O2):
define void @SobelXRow_SSE2() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *malloc(int /*<<< orphan*/);
int main(int argc, char **argv) {
  char *ptr;
  ptr = malloc(0);
  free(ptr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %edi,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1040 <malloc@plt>
mov    %rax,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i8* @malloc(i32 0)
%4 = tail call i32 @free(i8* %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ ENOMEM;
int /*<<< orphan*/ errno;
int sys_stat(const char *file, void *buf) {
  errno = ENOMEM;
  return -1;
}


x86 assembly (clang, -O0):
<sys_stat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ecd(%rip),%rax
mov    (%rax),%ecx
mov    0x2ebc(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys_stat>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
@ENOMEM = global i32 0
@errno = global i32 0
define i32 @sys_stat(i8* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = load i32, i32* @ENOMEM
store i32 %3, i32* @errno
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ die(char *);
void __attribute__((noreturn)) bad_index(void) {
  die("Vector index out-of-range");
}


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

x86 assembly (clang, -O2):
<bad_index>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <die@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"Vector index out-of-range\00"
define void @bad_index() {
%1 = call i32 @die(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
unreachable
}

LLVM IR (-O2):
@.str = [26 x i8] c"Vector index out-of-range\00"
define void @bad_index() {
%1 = tail call i32 @die(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
unreachable
}
/* Variables and functions */
double time_getCPUSeconds();
double time_get_cpu_seconds_(void) { return (time_getCPUSeconds()); }


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

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

LLVM IR (-O0):
define double @time_get_cpu_seconds_() {
%1 = call double (...) @time_getCPUSeconds()
ret double %1
}

LLVM IR (-O2):
define double @time_get_cpu_seconds_() {
%1 = tail call double (...) @time_getCPUSeconds()
ret double %1
}
char *keyname(void) {
  static char name[] = "X11";
  return name;
}


x86 assembly (clang, -O0):
<keyname>:
push   %rbp
mov    %rsp,%rbp
lea    0x2f15(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<keyname>:
lea    0x2f19(%rip),%rax
ret

LLVM IR (-O0):
@keyname.name = internal global [4 x i8] c"X11\00"
define i8* @keyname() {
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @keyname.name, i64 0, i64 0)
}

LLVM IR (-O2):
@keyname.name = internal global [4 x i8] c"X11\00"
define i8* @keyname() {
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @keyname.name, i64 0, i64 0)
}
/* Variables and functions */
scalar_t__ _is_whitespace(char);
char *_eat_whitespace(char *buf) {
  char *ptr = buf;
  while (_is_whitespace(*ptr)) {
    ptr++;
  }
  return ptr;
}


x86 assembly (clang, -O0):
<_eat_whitespace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <_is_whitespace@plt>
cmp    $0x0,%rax
je     114b <_eat_whitespace+0x3b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <_eat_whitespace+0x14>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_eat_whitespace>:
push   %rbx
mov    %rdi,%rbx
add    $0xffffffffffffffff,%rbx
nopl   0x0(%rax,%rax,1)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1030 <_is_whitespace@plt>
test   %rax,%rax
jne    1120 <_eat_whitespace+0x10>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @_eat_whitespace(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %7, %2 ]
%4 = load i8, i8* %3
%5 = tail call i64 @_is_whitespace(i8 signext %4)
%6 = icmp eq i64 %5, 0
%7 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %6, label %8, label %2
8: ; preds = %2
ret i8* %3
}
int lfs_rambd_sync(const struct lfs_config *cfg) {
  ;
  (void)cfg;
  ;
  return 0;
}


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

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

LLVM IR (-O0):
%struct.lfs_config = type opaque
define i32 @lfs_rambd_sync(%struct.lfs_config* %0) {
%2 = alloca %struct.lfs_config*
store %struct.lfs_config* %0, %struct.lfs_config** %2
%3 = load %struct.lfs_config*, %struct.lfs_config** %2
ret i32 0
}

LLVM IR (-O2):
%struct.lfs_config = type opaque
define i32 @lfs_rambd_sync(%struct.lfs_config* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
void *calloc(size_t, size_t);
void *LibTomCalloc(size_t n, size_t s) { return calloc(n, s); }


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

x86 assembly (clang, -O2):
<LibTomCalloc>:
jmp    1030 <calloc@plt>

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

LLVM IR (-O2):
define noalias i8* @LibTomCalloc(i64 %0, i64 %1) {
%3 = tail call i8* @calloc(i64 %0, i64 %1)
ret i8* %3
}
/* Variables and functions */
scalar_t__ check_fa_mid(char const *);
int check_fa(char *unused) {
  const char c = 0;
  return check_fa_mid(&c) != 0;
}


x86 assembly (clang, -O0):
<check_fa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
lea    -0x9(%rbp),%rdi
call   1030 <check_fa_mid@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_fa>:
push   %rax
movb   $0x0,0x7(%rsp)
lea    0x7(%rsp),%rdi
call   1030 <check_fa_mid@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @check_fa(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
store i8* %0, i8** %2
store i8 0, i8* %3
%4 = call i64 @check_fa_mid(i8* %3)
%5 = icmp ne i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @check_fa(i8* nocapture readnone %0) {
%2 = alloca i8
store i8 0, i8* %2
%3 = call i64 @check_fa_mid(i8* %2)
%4 = icmp ne i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
void do_gotoxy(int x, int y) {}


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

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

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

LLVM IR (-O2):
define void @do_gotoxy(i32 %0, i32 %1) {
ret void
}
char Signum(int n) {
  if (n < 0)
    return -1;
  return 1;
}


x86 assembly (clang, -O0):
<Signum>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    111a <Signum+0x1a>
movb   $0xff,-0x1(%rbp)
jmp    111e <Signum+0x1e>
movb   $0x1,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Signum>:
test   %edi,%edi
setns  %al
add    %al,%al
add    $0xff,%al
ret

LLVM IR (-O0):
define signext i8 @Signum(i32 %0) {
%2 = alloca i8
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i8 -1, i8* %2
br label %8
7: ; preds = %1
store i8 1, i8* %2
br label %8
8: ; preds = %7, %6
%9 = load i8, i8* %2
ret i8 %9
}

LLVM IR (-O2):
define signext i8 @Signum(i32 %0) {
%2 = icmp slt i32 %0, 0
%3 = select i1 %2, i8 -1, i8 1
ret i8 %3
}
unsigned char __atomic_fetch_xor_1(volatile void *atom, unsigned char value,
                                   int memorder) {
  unsigned char xchg;
  unsigned char cmp;
  __atomic_load((unsigned char *)atom, (unsigned char *)&cmp, 0);
  do {
    xchg = ((cmp ^ value));
  } while (
      !__atomic_compare_exchange((unsigned char *)atom, &cmp, &xchg, 1, 5, 5));
  return cmp;
}


x86 assembly (clang, -O0):
<__atomic_fetch_xor_1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x12(%rbp)
movzbl -0x12(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x12(%rbp),%al
mov    -0x11(%rbp),%dl
lock cmpxchg %dl,(%rcx)
mov    %al,%cl
sete   %al
mov    %al,-0x15(%rbp)
mov    %cl,-0x14(%rbp)
test   $0x1,%al
jne    114e <__atomic_fetch_xor_1+0x4e>
mov    -0x14(%rbp),%al
mov    %al,-0x12(%rbp)
mov    -0x15(%rbp),%al
and    $0x1,%al
mov    %al,-0x13(%rbp)
mov    -0x13(%rbp),%al
xor    $0xff,%al
test   $0x1,%al
jne    111a <__atomic_fetch_xor_1+0x1a>
movzbl -0x12(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__atomic_fetch_xor_1>:
mov    (%rdi),%al
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %eax,%ecx
mov    %eax,%edx
xor    %sil,%dl
lock cmpxchg %dl,(%rdi)
jne    1110 <__atomic_fetch_xor_1+0x10>
mov    %ecx,%eax
ret

LLVM IR (-O0):
define zeroext i8 @__atomic_fetch_xor_1(i8* %0, i8 zeroext %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i32
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i32 %2, i32* %6
%10 = load i8*, i8** %4
%11 = load atomic i8, i8* %10 monotonic
store i8 %11, i8* %8
br label %12
12: ; preds = %27, %3
%13 = load i8, i8* %8
%14 = zext i8 %13 to i32
%15 = load i8, i8* %5
%16 = zext i8 %15 to i32
%17 = xor i32 %14, %16
%18 = trunc i32 %17 to i8
store i8 %18, i8* %7
br label %19
19: ; preds = %12
%20 = load i8*, i8** %4
%21 = load i8, i8* %8
%22 = load i8, i8* %7
%23 = cmpxchg weak i8* %20, i8 %21, i8 %22 seq_cst seq_cst
%24 = extractvalue { i8, i1 } %23, 0
%25 = extractvalue { i8, i1 } %23, 1
br i1 %25, label %27, label %26
26: ; preds = %19
store i8 %24, i8* %8
br label %27
27: ; preds = %26, %19
%28 = zext i1 %25 to i8
store i8 %28, i8* %9
%29 = load i8, i8* %9
%30 = trunc i8 %29 to i1
%31 = xor i1 %30, true
br i1 %31, label %12, label %32
32: ; preds = %27
%33 = load i8, i8* %8
ret i8 %33
}

LLVM IR (-O2):
define zeroext i8 @__atomic_fetch_xor_1(i8* nocapture %0, i8 zeroext %1, i32 %2) {
%4 = load atomic i8, i8* %0 monotonic
br label %5
5: ; preds = %5, %3
%6 = phi i8 [ %4, %3 ], [ %10, %5 ]
%7 = xor i8 %6, %1
%8 = cmpxchg weak i8* %0, i8 %6, i8 %7 seq_cst seq_cst
%9 = extractvalue { i8, i1 } %8, 1
%10 = extractvalue { i8, i1 } %8, 0
br i1 %9, label %11, label %5
11: ; preds = %5
ret i8 %6
}
/* Variables and functions */
int /*<<< orphan*/ dummy(int *);
void paths_mislabeling(void) {
  int x;
  int y = 0;
  if (y == 1) {
    int z;
  } else {
    dummy(&x);
  }
  y += x;
}


x86 assembly (clang, -O0):
<paths_mislabeling>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    112e <paths_mislabeling+0x1e>
jmp    1137 <paths_mislabeling+0x27>
lea    -0x4(%rbp),%rdi
call   1030 <dummy@plt>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<paths_mislabeling>:
push   %rax
lea    0x4(%rsp),%rdi
call   1030 <dummy@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @paths_mislabeling() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @dummy(i32* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ lua_pushnil();
int /*<<< orphan*/ lua_pushstring(int /*<<< orphan*/);
int /*<<< orphan*/ lua_pushusertag(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
void pushresult(int i) {
  if (i)
    lua_pushusertag(NULL, 0);
  else {
    lua_pushnil();
    lua_pushstring(strerror(errno));
  }
}


x86 assembly (clang, -O0):
<pushresult>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1165 <pushresult+0x25>
xor    %eax,%eax
mov    %eax,%edi
xor    %esi,%esi
call   1030 <lua_pushusertag@plt>
jmp    1181 <pushresult+0x41>
mov    $0x0,%al
call   1040 <lua_pushnil@plt>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    %eax,%edi
call   1050 <lua_pushstring@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pushresult>:
test   %edi,%edi
je     114d <pushresult+0xd>
xor    %edi,%edi
xor    %esi,%esi
jmp    1030 <lua_pushusertag@plt>
push   %rax
xor    %eax,%eax
call   1040 <lua_pushnil@plt>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    %eax,%edi
pop    %rax
jmp    1050 <lua_pushstring@plt>

LLVM IR (-O0):
@errno = global i32 0
define void @pushresult(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @lua_pushusertag(i32* null, i32 0)
br label %12
7: ; preds = %1
%8 = call i32 (...) @lua_pushnil()
%9 = load i32, i32* @errno
%10 = call i32 @strerror(i32 %9)
%11 = call i32 @lua_pushstring(i32 %10)
br label %12
12: ; preds = %7, %5
ret void
}

LLVM IR (-O2):
@errno = global i32 0
define void @pushresult(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @lua_pushusertag(i32* null, i32 0)
br label %10
5: ; preds = %1
%6 = tail call i32 (...) @lua_pushnil()
%7 = load i32, i32* @errno
%8 = tail call i32 @strerror(i32 %7)
%9 = tail call i32 @lua_pushstring(i32 %8)
br label %10
10: ; preds = %5, %3
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ str;

/* Variables and functions */
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ reverse(char *);
int /*<<< orphan*/ strcpy(char *, char *);
void test(char *str) {
  char *testStr = (char *)malloc(sizeof(str));
  strcpy(testStr, str);
  reverse(testStr);
  printf("%s\n", testStr);
  free(testStr);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x8,%edi
call   1070 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1050 <strcpy@plt>
mov    -0x10(%rbp),%rdi
call   1030 <reverse@plt>
mov    -0x10(%rbp),%rsi
lea    0xe75(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x8,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1050 <strcpy@plt>
mov    %rbx,%rdi
call   1030 <reverse@plt>
lea    0xe82(%rip),%rdi
mov    %rbx,%rsi
call   1060 <printf@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <free@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @test(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = call i64 @malloc(i32 8)
%5 = inttoptr i64 %4 to i8*
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = load i8*, i8** %2
%8 = call i32 @strcpy(i8* %6, i8* %7)
%9 = load i8*, i8** %3
%10 = call i32 @reverse(i8* %9)
%11 = load i8*, i8** %3
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = load i8*, i8** %3
%14 = call i32 @free(i8* %13)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @test(i8* %0) {
%2 = tail call i64 @malloc(i32 8)
%3 = inttoptr i64 %2 to i8*
%4 = tail call i32 @strcpy(i8* %3, i8* %0)
%5 = tail call i32 @reverse(i8* %3)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%7 = tail call i32 @free(i8* %3)
ret void
}
int test(char *v) {
  int *a = (int *)v;
  int x = 1;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test(i8* nocapture readnone %0) {
ret i32 undef
}
/* Variables and functions */
int first();
int main() { return first(); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @first()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ _alloc_failed();
void *realloc(void *, size_t);
void *checked_realloc(void *ptr, size_t size) {
  void *mem = realloc(ptr, size);
  if (mem == NULL && size > 0)
    _alloc_failed();
  return mem;
}


x86 assembly (clang, -O0):
<checked_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    115e <checked_realloc+0x3e>
cmpq   $0x0,-0x10(%rbp)
jbe    115e <checked_realloc+0x3e>
mov    $0x0,%al
call   1040 <_alloc_failed@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checked_realloc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
call   1030 <realloc@plt>
mov    %rax,%r14
test   %rbx,%rbx
je     1140 <checked_realloc+0x20>
test   %r14,%r14
jne    1140 <checked_realloc+0x20>
xor    %eax,%eax
call   1040 <_alloc_failed@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @checked_realloc(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 i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i64, i64* %4
%13 = icmp ugt i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 (...) @_alloc_failed()
br label %16
16: ; preds = %14, %11, %2
%17 = load i8*, i8** %5
ret i8* %17
}

LLVM IR (-O2):
define noalias i8* @checked_realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
%5 = icmp ne i64 %1, 0
%6 = and i1 %5, %4
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 (...) @_alloc_failed()
br label %9
9: ; preds = %7, %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ ispunct(int);
void t_ispunct_0x54() {
  Assert_real((ispunct(84) == 0),
              "/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_ispunct.c",
              425, ("ispunct should be 0 for T"));
}


x86 assembly (clang, -O0):
<t_ispunct_0x54>:
push   %rbp
mov    %rsp,%rbp
mov    $0x54,%edi
call   1030 <ispunct@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x1a9,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_ispunct_0x54>:
push   %rax
mov    $0x54,%edi
call   1030 <ispunct@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x1a9,%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_ispunct.c\00"
@.str.1 = [26 x i8] c"ispunct should be 0 for T\00"
define void @t_ispunct_0x54() {
%1 = call i64 @ispunct(i32 84)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 425, 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_ispunct.c\00"
@.str.1 = [26 x i8] c"ispunct should be 0 for T\00"
define void @t_ispunct_0x54() {
%1 = tail call i64 @ispunct(i32 84)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 425, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ root;
};
typedef TYPE_1__ XMotionEvent;

/* Variables and functions */
unsigned long get_XMotionEvent_root(void *_p) {
  return (unsigned long)((XMotionEvent *)_p)->root;
}


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

x86 assembly (clang, -O2):
<get_XMotionEvent_root>:
mov    (%rdi),%rax
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i64 @get_XMotionEvent_root(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
ret i64 %6
}

LLVM IR (-O2):
define i64 @get_XMotionEvent_root(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
ret i64 %3
}
/* Variables and functions */
unsigned long sysfs_get_transition_latency(unsigned int);
unsigned long cpufreq_get_transition_latency(unsigned int cpu) {
  return sysfs_get_transition_latency(cpu);
}


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

x86 assembly (clang, -O2):
<cpufreq_get_transition_latency>:
jmp    1030 <sysfs_get_transition_latency@plt>

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

LLVM IR (-O2):
define i64 @cpufreq_get_transition_latency(i32 %0) {
%2 = tail call i64 @sysfs_get_transition_latency(i32 %0)
ret i64 %2
}
void mipssim_free(void *ptr) {}


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

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

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

LLVM IR (-O2):
define void @mipssim_free(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int foo(int);
int main(int argc, char **argv) {
  if (foo(0x080000000LL) != -1)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x80000000,%edi
call   1040 <foo@plt>
cmp    $0xffffffff,%eax
je     1160 <main+0x30>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x80000000,%edi
call   1040 <foo@plt>
cmp    $0xffffffff,%eax
jne    1147 <main+0x17>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @foo(i32 -2147483648)
%7 = icmp ne i32 %6, -1
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 (...) @abort()
unreachable
10: ; preds = %2
%11 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @foo(i32 -2147483648)
%4 = icmp eq i32 %3, -1
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 (...) @abort()
unreachable
7: ; preds = %2
%8 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
char *malloc(size_t);
int /*<<< orphan*/ strncpy(char *, char const *, size_t);
char *agregar_cadena(const char *str, size_t indice) {
  char *str_aux = malloc(indice + 1);
  if (!str_aux)
    return NULL;
  strncpy(str_aux, str, indice);
  str_aux[indice] = '\0';
  return str_aux;
}


x86 assembly (clang, -O0):
<agregar_cadena>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1159 <agregar_cadena+0x39>
movq   $0x0,-0x8(%rbp)
jmp    117e <agregar_cadena+0x5e>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <strncpy@plt>
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<agregar_cadena>:
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 <agregar_cadena+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* @agregar_cadena(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %4
store i64 %1, i64* %5
%7 = load i64, i64* %5
%8 = add i64 %7, 1
%9 = call i8* @malloc(i64 %8)
store i8* %9, i8** %6
%10 = load i8*, i8** %6
%11 = icmp ne i8* %10, null
br i1 %11, label %13, label %12
12: ; preds = %2
store i8* null, i8** %3
br label %22
13: ; preds = %2
%14 = load i8*, i8** %6
%15 = load i8*, i8** %4
%16 = load i64, i64* %5
%17 = call i32 @strncpy(i8* %14, i8* %15, i64 %16)
%18 = load i8*, i8** %6
%19 = load i64, i64* %5
%20 = getelementptr inbounds i8, i8* %18, i64 %19
store i8 0, i8* %20
%21 = load i8*, i8** %6
store i8* %21, i8** %3
br label %22
22: ; preds = %13, %12
%23 = load i8*, i8** %3
ret i8* %23
}

LLVM IR (-O2):
define i8* @agregar_cadena(i8* %0, i64 %1) {
%3 = add i64 %1, 1
%4 = tail call i8* @malloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = tail call i32 @strncpy(i8* %4, i8* %0, i64 %1)
%8 = getelementptr inbounds i8, i8* %4, i64 %1
store i8 0, i8* %8
br label %9
9: ; preds = %2, %6
ret i8* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ coco_error(char const *, int /*<<< orphan*/,
                              int /*<<< orphan*/ *);
int /*<<< orphan*/ strerror(int);
void logger_bbob_error_io(FILE *path, int errnum) {
  const char *error_format = "Error opening file: %s\n ";
  coco_error(error_format, strerror(errnum), path);
}


x86 assembly (clang, -O0):
<logger_bbob_error_io>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <strerror@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
mov    -0x8(%rbp),%rdx
call   1030 <coco_error@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logger_bbob_error_io>:
push   %rbx
mov    %rdi,%rbx
mov    %esi,%edi
call   1040 <strerror@plt>
lea    0xece(%rip),%rdi
mov    %eax,%esi
mov    %rbx,%rdx
pop    %rbx
jmp    1030 <coco_error@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"Error opening file: %s\0A \00"
define void @logger_bbob_error_io(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i8*
store i32* %0, i32** %3
store i32 %1, i32* %4
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8** %5
%6 = load i8*, i8** %5
%7 = load i32, i32* %4
%8 = call i32 @strerror(i32 %7)
%9 = load i32*, i32** %3
%10 = call i32 @coco_error(i8* %6, i32 %8, i32* %9)
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"Error opening file: %s\0A \00"
define void @logger_bbob_error_io(i32* %0, i32 %1) {
%3 = tail call i32 @strerror(i32 %1)
%4 = tail call i32 @coco_error(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %3, i32* %0)
ret void
}
/* Type definitions */
struct mmpool {
  int dummy;
};

/* Variables and functions */
long mmp_free(struct mmpool *, void *);
long __mmp_free_agent(void *alloc, void *p) {
  return mmp_free((struct mmpool *)alloc, p);
}


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

x86 assembly (clang, -O2):
<__mmp_free_agent>:
jmp    1030 <mmp_free@plt>

LLVM IR (-O0):
%struct.mmpool = type { i32 }
define i64 @__mmp_free_agent(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 %struct.mmpool*
%7 = load i8*, i8** %4
%8 = call i64 @mmp_free(%struct.mmpool* %6, i8* %7)
ret i64 %8
}

LLVM IR (-O2):
%struct.mmpool = type { i32 }
define i64 @__mmp_free_agent(i8* %0, i8* %1) {
%3 = bitcast i8* %0 to %struct.mmpool*
%4 = tail call i64 @mmp_free(%struct.mmpool* %3, i8* %1)
ret i64 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char *fgets(char *, int, int /*<<< orphan*/ *);
char *malloc(int);
char *getLine(FILE *file) {
  char *s;
  s = malloc(1024);
  return (fgets(s, 1024, file));
}


x86 assembly (clang, -O0):
<getLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x400,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x400,%esi
call   1030 <fgets@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getLine>:
push   %rbx
mov    %rdi,%rbx
mov    $0x400,%edi
call   1040 <malloc@plt>
mov    %rax,%rdi
mov    $0x400,%esi
mov    %rbx,%rdx
pop    %rbx
jmp    1030 <fgets@plt>

LLVM IR (-O0):
define i8* @getLine(i32* %0) {
%2 = alloca i32*
%3 = alloca i8*
store i32* %0, i32** %2
%4 = call i8* @malloc(i32 1024)
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = load i32*, i32** %2
%7 = call i8* @fgets(i8* %5, i32 1024, i32* %6)
ret i8* %7
}

LLVM IR (-O2):
define i8* @getLine(i32* nocapture %0) {
%2 = tail call dereferenceable_or_null(1024) i8* @malloc(i32 1024)
%3 = tail call i8* @fgets(i8* %2, i32 1024, i32* %0)
ret i8* %3
}
__attribute__((__always___)) void sx_memory_barrier() { __sync_synchronize(); }


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

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

LLVM IR (-O0):
define void @sx_memory_barrier() {
fence seq_cst
ret void
}

LLVM IR (-O2):
define void @sx_memory_barrier() {
fence seq_cst
ret void
}
/* Variables and functions */
int /*<<< orphan*/ endwin();
void end_dialog(void) { endwin(); }


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

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

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

LLVM IR (-O2):
define void @end_dialog() {
%1 = tail call i32 (...) @endwin()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sub(double *, double *, double *, int);
void matrix_sub(double **Z, double **X, double **Y, int n, int m) {
  sub(Z[0], X[0], Y[0], n * m);
}


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

x86 assembly (clang, -O2):
<matrix_sub>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
mov    (%rdx),%rdx
imul   %r8d,%ecx
jmp    1030 <sub@plt>

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

LLVM IR (-O2):
define void @matrix_sub(double** nocapture %0, double** nocapture %1, double** nocapture %2, i32 %3, i32 %4) {
%6 = load double*, double** %0
%7 = load double*, double** %1
%8 = load double*, double** %2
%9 = mul nsw i32 %4, %3
%10 = tail call i32 @sub(double* %6, double* %7, double* %8, i32 %9)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(
      stderr,
      "Usage: bdftruncate [+w|-w] threshold <source.bdf >destination.bdf\n"
      "\n"
      "Example:\n"
      "\n"
      "  bdftruncate 0x3200 <6x13.bdf >6x13t.bdf\n"
      "\n"
      "will generate the file 6x13t.bdf in which all glyphs with codes\n"
      ">= 0x3200 will only be stored unencoded (i.e., ENCODING -1).\n"
      "Option -w removes East Asian Wide and East Asian FullWidth characters\n"
      "(default if threshold <= 0x3200), and option +w keeps them.\n");
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [376 x i8] c"Usage: bdftruncate [+w|-w] threshold <source.bdf >destination.bdf\0A\0AExample:\0A\0A bdftruncate 0x3200 <6x13.bdf >6x13t.bdf\0A\0Awill generate the file 6x13t.bdf in which all glyphs with codes\0A>= 0x3200 will only be stored unencoded (i.e., ENCODING -1).\0AOption -w removes East Asian Wide and East Asian FullWidth characters\0A(default if threshold <= 0x3200), and option +w keeps them.\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([376 x i8], [376 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_FAILURE
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [376 x i8] c"Usage: bdftruncate [+w|-w] threshold <source.bdf >destination.bdf\0A\0AExample:\0A\0A bdftruncate 0x3200 <6x13.bdf >6x13t.bdf\0A\0Awill generate the file 6x13t.bdf in which all glyphs with codes\0A>= 0x3200 will only be stored unencoded (i.e., ENCODING -1).\0AOption -w removes East Asian Wide and East Asian FullWidth characters\0A(default if threshold <= 0x3200), and option +w keeps them.\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([376 x i8], [376 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
double dot_product(double va[3], double vb[3]) {
  return va[0] * vb[0] + va[1] * vb[1] + va[2] * vb[2];
}


x86 assembly (clang, -O0):
<dot_product>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dot_product>:
movsd  0x8(%rdi),%xmm0
mulsd  0x8(%rsi),%xmm0
movsd  (%rdi),%xmm1
mulsd  (%rsi),%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rdi),%xmm0
mulsd  0x10(%rsi),%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @dot_product(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = load double*, double** %3
%6 = getelementptr inbounds double, double* %5, i64 0
%7 = load double, double* %6
%8 = load double*, double** %4
%9 = getelementptr inbounds double, double* %8, i64 0
%10 = load double, double* %9
%11 = load double*, double** %3
%12 = getelementptr inbounds double, double* %11, i64 1
%13 = load double, double* %12
%14 = load double*, double** %4
%15 = getelementptr inbounds double, double* %14, i64 1
%16 = load double, double* %15
%17 = fmul double %13, %16
%18 = call double @llvm.fmuladd.f64(double %7, double %10, double %17)
%19 = load double*, double** %3
%20 = getelementptr inbounds double, double* %19, i64 2
%21 = load double, double* %20
%22 = load double*, double** %4
%23 = getelementptr inbounds double, double* %22, i64 2
%24 = load double, double* %23
%25 = call double @llvm.fmuladd.f64(double %21, double %24, double %18)
ret double %25
}

LLVM IR (-O2):
define double @dot_product(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
%5 = getelementptr inbounds double, double* %0, i64 1
%6 = load double, double* %5
%7 = getelementptr inbounds double, double* %1, i64 1
%8 = load double, double* %7
%9 = fmul double %6, %8
%10 = tail call double @llvm.fmuladd.f64(double %3, double %4, double %9)
%11 = getelementptr inbounds double, double* %0, i64 2
%12 = load double, double* %11
%13 = getelementptr inbounds double, double* %1, i64 2
%14 = load double, double* %13
%15 = tail call double @llvm.fmuladd.f64(double %12, double %14, double %10)
ret double %15
}
/* Variables and functions */
double mode_vclock(int /*<<< orphan*/);
int /*<<< orphan*/ video_current_mode();
double video_vclock(void) { return mode_vclock(video_current_mode()); }


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

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

LLVM IR (-O0):
define double @video_vclock() {
%1 = call i32 (...) @video_current_mode()
%2 = call double @mode_vclock(i32 %1)
ret double %2
}

LLVM IR (-O2):
define double @video_vclock() {
%1 = tail call i32 (...) @video_current_mode()
%2 = tail call double @mode_vclock(i32 %1)
ret double %2
}
short abs_fun_short(short a) {
  short mask = a >> 15;
  return (a + mask) ^ mask;
}


x86 assembly (clang, -O0):
<abs_fun_short>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
sar    $0xf,%eax
mov    %ax,-0x4(%rbp)
movswl -0x2(%rbp),%eax
movswl -0x4(%rbp),%ecx
add    %ecx,%eax
movswl -0x4(%rbp),%ecx
xor    %ecx,%eax
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<abs_fun_short>:
mov    %edi,%eax
neg    %ax
cmovs  %di,%ax
ret

LLVM IR (-O0):
define signext i16 @abs_fun_short(i16 signext %0) {
%2 = alloca i16
%3 = alloca i16
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = sext i16 %4 to i32
%6 = ashr i32 %5, 15
%7 = trunc i32 %6 to i16
store i16 %7, i16* %3
%8 = load i16, i16* %2
%9 = sext i16 %8 to i32
%10 = load i16, i16* %3
%11 = sext i16 %10 to i32
%12 = add nsw i32 %9, %11
%13 = load i16, i16* %3
%14 = sext i16 %13 to i32
%15 = xor i32 %12, %14
%16 = trunc i32 %15 to i16
ret i16 %16
}

LLVM IR (-O2):
define signext i16 @abs_fun_short(i16 signext %0) {
%2 = tail call i16 @llvm.abs.i16(i16 %0, i1 false)
ret i16 %2
}
int ft_isspace(int chr) { return ((chr >= 9 && chr <= 13) || chr == 32); }


x86 assembly (clang, -O0):
<ft_isspace>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x9,-0x4(%rbp)
jl     1120 <ft_isspace+0x20>
mov    $0x1,%al
cmpl   $0xd,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jle    112a <ft_isspace+0x2a>
cmpl   $0x20,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_isspace>:
lea    -0x9(%rdi),%eax
cmp    $0x5,%eax
setb   %al
cmp    $0x20,%edi
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @ft_isspace(i32 %0) {
%2 = add i32 %0, -9
%3 = icmp ult i32 %2, 5
%4 = icmp eq i32 %0, 32
%5 = or i1 %4, %3
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
float Com_Clamp(float, float, float);
float Com_AbsClamp(float min, float max, float value) {
  if (value < 0.0f) {
    return Com_Clamp(-max, -min, value);
  } else {
    return Com_Clamp(min, max, value);
  }
}


x86 assembly (clang, -O0):
<Com_AbsClamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    116c <Com_AbsClamp+0x5c>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  -0x8(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
movss  -0x10(%rbp),%xmm2
call   1030 <Com_Clamp@plt>
movss  %xmm0,-0x4(%rbp)
jmp    1185 <Com_AbsClamp+0x75>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
call   1030 <Com_Clamp@plt>
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Com_AbsClamp>:
movaps %xmm0,%xmm3
xorps  %xmm0,%xmm0
ucomiss %xmm2,%xmm0
jbe    1133 <Com_AbsClamp+0x23>
movaps 0xede(%rip),%xmm0
xorps  %xmm0,%xmm1
xorps  %xmm0,%xmm3
movaps %xmm1,%xmm0
movaps %xmm3,%xmm1
jmp    1030 <Com_Clamp@plt>
movaps %xmm3,%xmm0
jmp    1030 <Com_Clamp@plt>

LLVM IR (-O0):
define float @Com_AbsClamp(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
%8 = load float, float* %7
%9 = fcmp olt float %8, 0.000000e+00
br i1 %9, label %10, label %17
10: ; preds = %3
%11 = load float, float* %6
%12 = fneg float %11
%13 = load float, float* %5
%14 = fneg float %13
%15 = load float, float* %7
%16 = call float @Com_Clamp(float %12, float %14, float %15)
store float %16, float* %4
br label %22
17: ; preds = %3
%18 = load float, float* %5
%19 = load float, float* %6
%20 = load float, float* %7
%21 = call float @Com_Clamp(float %18, float %19, float %20)
store float %21, float* %4
br label %22
22: ; preds = %17, %10
%23 = load float, float* %4
ret float %23
}

LLVM IR (-O2):
define float @Com_AbsClamp(float %0, float %1, float %2) {
%4 = fcmp olt float %2, 0.000000e+00
br i1 %4, label %5, label %9
5: ; preds = %3
%6 = fneg float %1
%7 = fneg float %0
%8 = tail call float @Com_Clamp(float %6, float %7, float %2)
br label %11
9: ; preds = %3
%10 = tail call float @Com_Clamp(float %0, float %1, float %2)
br label %11
11: ; preds = %9, %5
%12 = phi float [ %8, %5 ], [ %10, %9 ]
ret float %12
}