xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ calloc(scalar_t__, int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *user_dir();
char *with_user_dir(char *filename) {
  char *dir = user_dir();
  char *result =
      (char *)calloc(strlen(dir) + strlen("/.BitChess/"), sizeof(char));
  strcpy(result, dir);
  strcat(result, filename);
  return result;
}


x86 assembly (clang, -O0):
<with_user_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1070 <user_dir@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x20(%rbp)
lea    0xe85(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
add    %rax,%rdi
mov    $0x1,%esi
call   1050 <calloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<with_user_dir>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
xor    %eax,%eax
call   1070 <user_dir@plt>
mov    %rax,%r15
mov    %rax,%rdi
call   1040 <strlen@plt>
lea    0xb(%rax),%rdi
mov    $0x1,%esi
call   1050 <calloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcat@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [12 x i8] c"/.BitChess/\00"
define i8* @with_user_dir(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = call i8* (...) @user_dir()
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = call i64 @strlen(i8* %6)
%8 = call i64 @strlen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%9 = add nsw i64 %7, %8
%10 = call i64 @calloc(i64 %9, i32 1)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %4
%12 = load i8*, i8** %4
%13 = load i8*, i8** %3
%14 = call i32 @strcpy(i8* %12, i8* %13)
%15 = load i8*, i8** %4
%16 = load i8*, i8** %2
%17 = call i32 @strcat(i8* %15, i8* %16)
%18 = load i8*, i8** %4
ret i8* %18
}

LLVM IR (-O2):
define i8* @with_user_dir(i8* %0) {
%2 = tail call i8* (...) @user_dir()
%3 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%4 = add nsw i64 %3, 11
%5 = tail call i64 @calloc(i64 %4, i32 1)
%6 = inttoptr i64 %5 to i8*
%7 = tail call i32 @strcpy(i8* %6, i8* %2)
%8 = tail call i32 @strcat(i8* %6, i8* %0)
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ forceCpuLoad(int, int);
int /*<<< orphan*/ setThreadPriority();
void *thread_entry(void *arg) {
  int load = *((int *)arg);
  setThreadPriority();
  forceCpuLoad(load, 120);
  return NULL;
}


x86 assembly (clang, -O0):
<thread_entry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <setThreadPriority@plt>
mov    -0xc(%rbp),%edi
mov    $0x78,%esi
call   1040 <forceCpuLoad@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread_entry>:
push   %rbx
mov    (%rdi),%ebx
xor    %eax,%eax
call   1030 <setThreadPriority@plt>
mov    %ebx,%edi
mov    $0x78,%esi
call   1040 <forceCpuLoad@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @thread_entry(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
%6 = load i32, i32* %5
store i32 %6, i32* %3
%7 = call i32 (...) @setThreadPriority()
%8 = load i32, i32* %3
%9 = call i32 @forceCpuLoad(i32 %8, i32 120)
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @thread_entry(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 (...) @setThreadPriority()
%5 = tail call i32 @forceCpuLoad(i32 %3, i32 120)
ret i8* null
}
/* Type definitions */
typedef int uint_fast8_t;

/* Variables and functions */
bool SHAREMIND_MAP_KEY_COPY_uint_fast8_t(uint_fast8_t *const dest,
                                         uint_fast8_t const src) {
  return (((*dest) = src), true);
}


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

x86 assembly (clang, -O2):
<SHAREMIND_MAP_KEY_COPY_uint_fast8_t>:
mov    %esi,(%rdi)
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @SHAREMIND_MAP_KEY_COPY_uint_fast8_t(i32* nocapture writeonly %0, i32 %1) {
store i32 %1, i32* %0
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ e_and();
int /*<<< orphan*/ e_zp();
void e_and_zp() {
  e_zp();
  e_and();
}


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

x86 assembly (clang, -O2):
<e_and_zp>:
push   %rax
xor    %eax,%eax
call   1040 <e_zp@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <e_and@plt>

LLVM IR (-O0):
define void @e_and_zp() {
%1 = call i32 (...) @e_zp()
%2 = call i32 (...) @e_and()
ret void
}

LLVM IR (-O2):
define void @e_and_zp() {
%1 = tail call i32 (...) @e_zp()
%2 = tail call i32 (...) @e_and()
ret void
}
double Test2(void) {
  struct {
    double x;
  } a;
  struct Type {
    double y;
  };
  struct Type b;
  a.x = 5;
  b.y = a.x;
  return b.y;
}


x86 assembly (clang, -O0):
<Test2>:
push   %rbp
mov    %rsp,%rbp
movsd  0xef4(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Test2>:
movsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
%struct.anon = type { double }
%struct.Type = type { double }
define double @Test2() {
%1 = alloca %struct.anon
%2 = alloca %struct.Type
%3 = getelementptr inbounds %struct.anon, %struct.anon* %1, i32 0, i32 0
store double 5.000000e+00, double* %3
%4 = getelementptr inbounds %struct.anon, %struct.anon* %1, i32 0, i32 0
%5 = load double, double* %4
%6 = getelementptr inbounds %struct.Type, %struct.Type* %2, i32 0, i32 0
store double %5, double* %6
%7 = getelementptr inbounds %struct.Type, %struct.Type* %2, i32 0, i32 0
%8 = load double, double* %7
ret double %8
}

LLVM IR (-O2):
define double @Test2() {
ret double 5.000000e+00
}
/* Variables and functions */
char *strdup(char const *);
char *c_strdup(const char *str) {
  if (str) {
    return strdup(str);
  }
  return NULL;
}


x86 assembly (clang, -O0):
<c_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1139 <c_strdup+0x29>
mov    -0x10(%rbp),%rdi
call   1030 <strdup@plt>
mov    %rax,-0x8(%rbp)
jmp    1141 <c_strdup+0x31>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_strdup>:
test   %rdi,%rdi
je     111a <c_strdup+0xa>
jmp    1030 <strdup@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @c_strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i8*, i8** %3
%8 = call i8* @strdup(i8* %7)
store i8* %8, i8** %2
br label %10
9: ; preds = %1
store i8* null, i8** %2
br label %10
10: ; preds = %9, %6
%11 = load i8*, i8** %2
ret i8* %11
}

LLVM IR (-O2):
define noalias i8* @c_strdup(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i8* @strdup(i8* %0)
br label %5
5: ; preds = %1, %3
%6 = phi i8* [ %4, %3 ], [ null, %1 ]
ret i8* %6
}
long lseek(f, o, d)
long o;
{ return (0); }


x86 assembly (clang, -O0):
<lseek>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i64 @lseek(i32 %0, i64 %1, i32 %2) {
ret i64 0
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int store_standard_solutions(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc4c(51, a, b, c, 0);
  return fail;
}


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

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

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

LLVM IR (-O2):
define i32 @store_standard_solutions() {
%1 = tail call i32 @_ada_use_c2phc4c(i32 51, i32* undef, i32* undef, double* undef, i32 0)
ret i32 %1
}
/* Variables and functions */
int B(int, int);
int A(int a, int b) {
  int c = 0xff, d = 0xffff;
  return B(c, d);
}


x86 assembly (clang, -O0):
<A>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0xff,-0xc(%rbp)
movl   $0xffff,-0x10(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <B@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<A>:
mov    $0xff,%edi
mov    $0xffff,%esi
jmp    1030 <B@plt>

LLVM IR (-O0):
define i32 @A(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 255, i32* %5
store i32 65535, i32* %6
%7 = load i32, i32* %5
%8 = load i32, i32* %6
%9 = call i32 @B(i32 %7, i32 %8)
ret i32 %9
}

LLVM IR (-O2):
define i32 @A(i32 %0, i32 %1) {
%3 = tail call i32 @B(i32 255, i32 65535)
ret i32 %3
}
/* Type definitions */
struct __test_metadata {
  int dummy;
};
struct __fixture_variant_metadata {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ epoll32(struct __test_metadata *);
void wrapper_epoll32(struct __test_metadata *_metadata,
                     struct __fixture_variant_metadata *variant) {
  epoll32(_metadata);
}


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

x86 assembly (clang, -O2):
<wrapper_epoll32>:
jmp    1030 <epoll32@plt>

LLVM IR (-O0):
%struct.__test_metadata = type { i32 }
%struct.__fixture_variant_metadata = type { i32 }
define void @wrapper_epoll32(%struct.__test_metadata* %0, %struct.__fixture_variant_metadata* %1) {
%3 = alloca %struct.__test_metadata*
%4 = alloca %struct.__fixture_variant_metadata*
store %struct.__test_metadata* %0, %struct.__test_metadata** %3
store %struct.__fixture_variant_metadata* %1, %struct.__fixture_variant_metadata** %4
%5 = load %struct.__test_metadata*, %struct.__test_metadata** %3
%6 = call i32 @epoll32(%struct.__test_metadata* %5)
ret void
}

LLVM IR (-O2):
%struct.__test_metadata = type { i32 }
%struct.__fixture_variant_metadata = type { i32 }
define void @wrapper_epoll32(%struct.__test_metadata* %0, %struct.__fixture_variant_metadata* nocapture readnone %1) {
%3 = tail call i32 @epoll32(%struct.__test_metadata* %0)
ret void
}
void bindThisThread(int index) { (void)index; }


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

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

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

LLVM IR (-O2):
define void @bindThisThread(i32 %0) {
ret void
}
void ft_striter(char *s, void (*f)(char *)) {
  if (*f && s) {
    while (*s) {
      (*f)(s);
      s++;
    }
  }
}


x86 assembly (clang, -O0):
<ft_striter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1158 <ft_striter+0x58>
cmpq   $0x0,-0x8(%rbp)
je     1158 <ft_striter+0x58>
jmp    112b <ft_striter+0x2b>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1153 <ft_striter+0x53>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdi
call   *%rax
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    112b <ft_striter+0x2b>
jmp    1158 <ft_striter+0x58>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_striter>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     1130 <ft_striter+0x30>
mov    %rsi,%r14
test   %rsi,%rsi
je     1130 <ft_striter+0x30>
mov    %rdi,%rbx
cmpb   $0x0,(%rdi)
je     1130 <ft_striter+0x30>
nopl   0x0(%rax)
mov    %rbx,%rdi
call   *%r14
cmpb   $0x0,0x1(%rbx)
lea    0x1(%rbx),%rbx
jne    1120 <ft_striter+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @ft_striter(i8* %0, void (i8*)* %1) {
%3 = icmp ne void (i8*)* %1, null
%4 = icmp ne i8* %0, null
%5 = and i1 %4, %3
br i1 %5, label %6, label %14
6: ; preds = %2
%7 = load i8, i8* %0
%8 = icmp eq i8 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %6, %9
%10 = phi i8* [ %11, %9 ], [ %0, %6 ]
tail call void %1(i8* %10)
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %9
14: ; preds = %9, %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void draw(char c, int num) {
  int i;
  for (i = 0; i < num; i++) {
    printf("%c", c);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<draw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1154 <draw+0x44>
movsbl -0x1(%rbp),%esi
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1128 <draw+0x18>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw>:
push   %rbp
push   %rbx
push   %rax
test   %esi,%esi
jle    112c <draw+0x1c>
mov    %esi,%ebx
movsbl %dil,%ebp
nopl   (%rax)
mov    %ebp,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1120 <draw+0x10>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @draw(i8 signext %0, i32 %1) {
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
store i8 %0, i8* %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %14, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = load i8, i8* %3
%12 = sext i8 %11 to i32
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %10
%15 = load i32, i32* %5
%16 = add nsw i32 %15, 1
store i32 %16, i32* %5
br label %6
17: ; preds = %6
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
define void @draw(i8 signext %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = sext i8 %0 to i32
br label %6
6: ; preds = %4, %6
%7 = phi i32 [ 0, %4 ], [ %9, %6 ]
%8 = tail call i32 @putchar(i32 %5)
%9 = add nuw nsw i32 %7, 1
%10 = icmp eq i32 %9, %1
br i1 %10, label %11, label %6
11: ; preds = %6, %2
%12 = tail call i32 @putchar(i32 10)
ret void
}
int conv_frame(unsigned char *input, unsigned char *output, int height,
               int width) {}


x86 assembly (clang, -O0):
<conv_frame>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @conv_frame(i8* nocapture readnone %0, i8* nocapture readnone %1, i32 %2, i32 %3) {
ret i32 undef
}
/* Variables and functions */
int upcase1(int);
scalar_t__ uppercasep(int);
int upcase(int c) { return uppercasep(c) ? c : upcase1(c); }


x86 assembly (clang, -O0):
<upcase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <uppercasep@plt>
cmp    $0x0,%rax
je     1148 <upcase+0x28>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1153 <upcase+0x33>
mov    -0x4(%rbp),%edi
call   1040 <upcase1@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<upcase>:
push   %rbx
mov    %edi,%ebx
call   1030 <uppercasep@plt>
test   %rax,%rax
je     1131 <upcase+0x11>
mov    %ebx,%eax
pop    %rbx
ret
mov    %ebx,%edi
pop    %rbx
jmp    1040 <upcase1@plt>

LLVM IR (-O0):
define i32 @upcase(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @uppercasep(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load i32, i32* %2
br label %11
8: ; preds = %1
%9 = load i32, i32* %2
%10 = call i32 @upcase1(i32 %9)
br label %11
11: ; preds = %8, %6
%12 = phi i32 [ %7, %6 ], [ %10, %8 ]
ret i32 %12
}

LLVM IR (-O2):
define i32 @upcase(i32 %0) {
%2 = tail call i64 @uppercasep(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @upcase1(i32 %0)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ %0, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ str_ltrim(char *);
int /*<<< orphan*/ str_rtrim(char *);
char *str_trim(char *str) {
  if (str == NULL) {
    return NULL;
  }
  str_ltrim(str);
  str_rtrim(str);
  return str;
}


x86 assembly (clang, -O0):
<str_trim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1144 <str_trim+0x24>
movq   $0x0,-0x8(%rbp)
jmp    115e <str_trim+0x3e>
mov    -0x10(%rbp),%rdi
call   1040 <str_ltrim@plt>
mov    -0x10(%rbp),%rdi
call   1030 <str_rtrim@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_trim>:
push   %rbx
mov    %rdi,%rbx
test   %rdi,%rdi
je     1139 <str_trim+0x19>
mov    %rbx,%rdi
call   1040 <str_ltrim@plt>
mov    %rbx,%rdi
call   1030 <str_rtrim@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @str_trim(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %7
6: ; preds = %1
store i8* null, i8** %2
br label %13
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i32 @str_ltrim(i8* %8)
%10 = load i8*, i8** %3
%11 = call i32 @str_rtrim(i8* %10)
%12 = load i8*, i8** %3
store i8* %12, i8** %2
br label %13
13: ; preds = %7, %6
%14 = load i8*, i8** %2
ret i8* %14
}

LLVM IR (-O2):
define i8* @str_trim(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 @str_ltrim(i8* %0)
%5 = tail call i32 @str_rtrim(i8* %0)
br label %6
6: ; preds = %1, %3
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ free(struct bar *);
scalar_t__ malloc(int);
int main() {
  struct bar {
    int stuff;
    int array[10];
  };
  struct bar *foo = (struct bar *)malloc(sizeof(struct bar));
  foo->array[5] = 4;
  free(foo);
  return 0;
}


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

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

LLVM IR (-O0):
%struct.bar = type { i32, [10 x i32] }
%struct.bar.0 = type opaque
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.bar*
store i32 0, i32* %1
%3 = call i64 @malloc(i32 44)
%4 = inttoptr i64 %3 to %struct.bar*
store %struct.bar* %4, %struct.bar** %2
%5 = load %struct.bar*, %struct.bar** %2
%6 = getelementptr inbounds %struct.bar, %struct.bar* %5, i32 0, i32 1
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 5
store i32 4, i32* %7
%8 = load %struct.bar*, %struct.bar** %2
%9 = bitcast %struct.bar* %8 to %struct.bar.0*
%10 = call i32 @free(%struct.bar.0* %9)
ret i32 0
}

LLVM IR (-O2):
%struct.bar = type { i32, [10 x i32] }
%struct.bar.0 = type opaque
define i32 @main() {
%1 = tail call i64 @malloc(i32 44)
%2 = inttoptr i64 %1 to %struct.bar*
%3 = getelementptr inbounds %struct.bar, %struct.bar* %2, i64 0, i32 1, i64 5
store i32 4, i32* %3
%4 = inttoptr i64 %1 to %struct.bar.0*
%5 = tail call i32 @free(%struct.bar.0* %4)
ret i32 0
}
/* Variables and functions */
int PTHREAD_CANCEL_ASYNCHRONOUS;
int __libc_tcdrain(int);
int /*<<< orphan*/ pthread_setcanceltype(int, int *);
int __attribute__((weak)) tcdrain(int fd) {
  int result;
  int oldtype;
  pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype);
  result = __libc_tcdrain(fd);
  pthread_setcanceltype(oldtype, NULL);
  return result;
}


x86 assembly (clang, -O0):
<tcdrain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eb6(%rip),%rax
mov    (%rax),%edi
lea    -0xc(%rbp),%rsi
call   1030 <pthread_setcanceltype@plt>
mov    -0x4(%rbp),%edi
call   1040 <__libc_tcdrain@plt>
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <pthread_setcanceltype@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tcdrain>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
lea    0xc(%rsp),%rsi
call   1030 <pthread_setcanceltype@plt>
mov    %ebx,%edi
call   1040 <__libc_tcdrain@plt>
mov    %eax,%ebx
mov    0xc(%rsp),%edi
xor    %esi,%esi
call   1030 <pthread_setcanceltype@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@PTHREAD_CANCEL_ASYNCHRONOUS = global i32 0
define weak i32 @tcdrain(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* @PTHREAD_CANCEL_ASYNCHRONOUS
%6 = call i32 @pthread_setcanceltype(i32 %5, i32* %4)
%7 = load i32, i32* %2
%8 = call i32 @__libc_tcdrain(i32 %7)
store i32 %8, i32* %3
%9 = load i32, i32* %4
%10 = call i32 @pthread_setcanceltype(i32 %9, i32* null)
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
@PTHREAD_CANCEL_ASYNCHRONOUS = global i32 0
define weak i32 @tcdrain(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = load i32, i32* @PTHREAD_CANCEL_ASYNCHRONOUS
%5 = call i32 @pthread_setcanceltype(i32 %4, i32* %2)
%6 = call i32 @__libc_tcdrain(i32 %0)
%7 = load i32, i32* %2
%8 = call i32 @pthread_setcanceltype(i32 %7, i32* null)
ret i32 %6
}
void INT_Excep_TMR1_OVI1(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_TMR1_OVI1() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ insert_str(char *, char *, char *);
void known1(char *object_str) { insert_str(object_str, "|", ""); }


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

x86 assembly (clang, -O2):
<known1>:
lea    0xee9(%rip),%rsi
lea    0xee3(%rip),%rdx
jmp    1030 <insert_str@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"|\00"
@.str.1 = [1 x i8] zeroinitializer
define void @known1(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @insert_str(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"|\00"
@.str.1 = [1 x i8] zeroinitializer
define void @known1(i8* %0) {
%2 = tail call i32 @insert_str(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
ret void
}
unsigned char __raw_readb(unsigned int ptr) {
  return *((volatile unsigned char *)ptr);
}


x86 assembly (clang, -O0):
<__raw_readb>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    (%rax),%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__raw_readb>:
mov    %edi,%eax
mov    (%rax),%al
ret

LLVM IR (-O0):
define zeroext i8 @__raw_readb(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = zext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
%6 = load volatile i8, i8* %5
ret i8 %6
}

LLVM IR (-O2):
define zeroext i8 @__raw_readb(i32 %0) {
%2 = zext i32 %0 to i64
%3 = inttoptr i64 %2 to i8*
%4 = load volatile i8, i8* %3
ret i8 %4
}
/* Variables and functions */
char *strdup(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
char *opname(char *p, int n) {
  char buf[5];
  strncpy(buf, p, n);
  buf[n] = 0;
  return strdup(buf);
}


x86 assembly (clang, -O0):
<opname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x11(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <strncpy@plt>
movslq -0xc(%rbp),%rax
movb   $0x0,-0x11(%rbp,%rax,1)
lea    -0x11(%rbp),%rdi
call   1040 <strdup@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<opname>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%rsi
lea    0x3(%rsp),%r14
mov    %r14,%rdi
mov    %ebx,%edx
call   1030 <strncpy@plt>
movslq %ebx,%rax
movb   $0x0,0x3(%rsp,%rax,1)
mov    %r14,%rdi
call   1040 <strdup@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @opname(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [5 x i8]
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 0
%7 = load i8*, i8** %3
%8 = load i32, i32* %4
%9 = call i32 @strncpy(i8* %6, i8* %7, i32 %8)
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 %11
store i8 0, i8* %12
%13 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 0
%14 = call i8* @strdup(i8* %13)
ret i8* %14
}

LLVM IR (-O2):
define noalias i8* @opname(i8* %0, i32 %1) {
%3 = alloca [5 x i8]
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%5 = call i32 @strncpy(i8* %4, i8* %0, i32 %1)
%6 = sext i32 %1 to i64
%7 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 %6
store i8 0, i8* %7
%8 = call i8* @strdup(i8* %4)
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ CatchAbort(int /*<<< orphan*/);
int main() {
  CatchAbort(0);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @CatchAbort(i32 0)
ret i32 0
}
int DB_InitReadWords_Native(void *db) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @DB_InitReadWords_Native(i8* nocapture readnone %0) {
ret i32 0
}
int p_dig(int n) {
  int aux;
  while (n > 0) {
    aux = n % 10;
    n = n / 10;
  }
  return aux;
}


x86 assembly (clang, -O0):
<p_dig>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1132 <p_dig+0x32>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    1107 <p_dig+0x7>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<p_dig>:
test   %edi,%edi
jle    1139 <p_dig+0x39>
mov    $0xcccccccd,%eax
nopl   0x0(%rax)
mov    %edi,%ecx
mov    %edi,%edi
imul   %rax,%rdi
shr    $0x23,%rdi
cmp    $0x9,%ecx
ja     1110 <p_dig+0x10>
movzbl %cl,%eax
imul   $0xcd,%eax,%ecx
shr    $0xa,%ecx
and    $0xfffffffe,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %cl,%al
movzbl %al,%eax
ret
ret

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

LLVM IR (-O2):
define i32 @p_dig(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %11
3: ; preds = %1, %3
%4 = phi i32 [ %5, %3 ], [ %0, %1 ]
%5 = udiv i32 %4, 10
%6 = icmp ult i32 %4, 10
br i1 %6, label %7, label %3
7: ; preds = %3
%8 = trunc i32 %4 to i8
%9 = urem i8 %8, 10
%10 = zext i8 %9 to i32
br label %11
11: ; preds = %7, %1
%12 = phi i32 [ %10, %7 ], [ undef, %1 ]
ret i32 %12
}
/* Variables and functions */
int PnameRef();
PpropertyNameRef() {
  int b = -1;
  ;
  b = PnameRef();
  return (b);
}


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

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

LLVM IR (-O0):
define i32 @PpropertyNameRef() {
%1 = alloca i32
store i32 -1, i32* %1
%2 = call i32 (...) @PnameRef()
store i32 %2, i32* %1
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @PpropertyNameRef() {
%1 = tail call i32 (...) @PnameRef()
ret i32 %1
}
void printchar(char **str, int c) {
  extern int putch(int c);
  if (str) {
    **str = c;
    ++(*str);
  } else
    (void)putch(c);
}


x86 assembly (clang, -O0):
<printchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     114b <printchar+0x3b>
mov    -0xc(%rbp),%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    1153 <printchar+0x43>
mov    -0xc(%rbp),%edi
call   1030 <putch@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printchar>:
test   %rdi,%rdi
je     1120 <printchar+0x10>
mov    (%rdi),%rax
mov    %sil,(%rax)
addq   $0x1,(%rdi)
ret
mov    %esi,%edi
jmp    1030 <putch@plt>

LLVM IR (-O0):
define void @printchar(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 = icmp ne i8** %5, null
br i1 %6, label %7, label %15
7: ; preds = %2
%8 = load i32, i32* %4
%9 = trunc i32 %8 to i8
%10 = load i8**, i8*** %3
%11 = load i8*, i8** %10
store i8 %9, i8* %11
%12 = load i8**, i8*** %3
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %12
br label %18
15: ; preds = %2
%16 = load i32, i32* %4
%17 = call i32 @putch(i32 %16)
br label %18
18: ; preds = %15, %7
ret void
}

LLVM IR (-O2):
define void @printchar(i8** %0, i32 %1) {
%3 = icmp eq i8** %0, null
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = trunc i32 %1 to i8
%6 = load i8*, i8** %0
store i8 %5, i8* %6
%7 = load i8*, i8** %0
%8 = getelementptr inbounds i8, i8* %7, i64 1
store i8* %8, i8** %0
br label %11
9: ; preds = %2
%10 = tail call i32 @putch(i32 %1)
br label %11
11: ; preds = %9, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ hash(char const *);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  const char *str = "Hello World";
  printf("\nThe hash is %lu", hash(str));
  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)
lea    0xec3(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <hash@plt>
mov    %eax,%esi
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <hash@plt>
lea    0xed8(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Hello World\00"
@.str.1 = [17 x i8] c"\0AThe hash is %lu\00"
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
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %6
%7 = load i8*, i8** %6
%8 = call i32 @hash(i8* %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"Hello World\00"
@.str.1 = [17 x i8] c"\0AThe hash is %lu\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @hash(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret i32 0
}
void cache_write(void) { return; }


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

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

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

LLVM IR (-O2):
define void @cache_write() {
ret void
}
int f(int a) {
  int *b[10];
  return a || b[10];
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x61(%rbp)
jne    1121 <f+0x21>
cmpq   $0x0,-0x10(%rbp)
setne  %al
mov    %al,-0x61(%rbp)
mov    -0x61(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @f(i32 %0) {
%2 = alloca i32
%3 = alloca [10 x i32*]
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = getelementptr inbounds [10 x i32*], [10 x i32*]* %3, i64 0, i64 10
%8 = load i32*, i32** %7
%9 = icmp ne i32* %8, null
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ true, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @f(i32 %0) {
ret i32 1
}
void g_get_charset() {}


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

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

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

LLVM IR (-O2):
define void @g_get_charset() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void die(char *s) {
  perror(s);
  exit(1);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rax
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @die(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @die(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
double deg2rad(double ang) { return ang * 3.141592653589793 / 180.0; }


x86 assembly (clang, -O0):
<deg2rad>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xef7(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xee2(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<deg2rad>:
mulsd  0xef8(%rip),%xmm0
divsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @deg2rad(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 0x400921FB54442D18
%5 = fdiv double %4, 1.800000e+02
ret double %5
}

LLVM IR (-O2):
define double @deg2rad(double %0) {
%2 = fmul double %0, 0x400921FB54442D18
%3 = fdiv double %2, 1.800000e+02
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ show(int);
int main() {
  show(1);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <show@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @show(i32 1)
ret i32 0
}
/* Variables and functions */
char *BDISASM_GetFixReg(int, int);
int /*<<< orphan*/ printf(char *, char *);
void BDISASM_PrintFixRegSF(int i) {
  char *s;
  s = BDISASM_GetFixReg(i, 1);
  if (s)
    printf(", %s", s);
}


x86 assembly (clang, -O0):
<BDISASM_PrintFixRegSF>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1040 <BDISASM_GetFixReg@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1157 <BDISASM_PrintFixRegSF+0x37>
mov    -0x10(%rbp),%rsi
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BDISASM_PrintFixRegSF>:
push   %rax
mov    $0x1,%esi
call   1040 <BDISASM_GetFixReg@plt>
test   %rax,%rax
je     1140 <BDISASM_PrintFixRegSF+0x20>
lea    0xec9(%rip),%rdi
mov    %rax,%rsi
pop    %rax
jmp    1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c", %s\00"
define void @BDISASM_PrintFixRegSF(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8* @BDISASM_GetFixReg(i32 %4, i32 1)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %11
11: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c", %s\00"
define void @BDISASM_PrintFixRegSF(i32 %0) {
%2 = tail call i8* @BDISASM_GetFixReg(i32 %0, i32 1)
%3 = icmp eq i8* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %6
6: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int fun(const char x) {
  const int y = x + 1;
  int const *ptr = NULL;
  ;
  if (ptr != NULL) {
    printf("ERROR\n");
  }
  return y;
}


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1147 <fun+0x37>
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
lea    0x1(%rdi),%eax
ret

LLVM IR (-O0):
@.str = [7 x i8] c"ERROR\0A\00"
define i32 @fun(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32*
store i8 %0, i8* %2
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = add nsw i32 %6, 1
store i32 %7, i32* %3
store i32* null, i32** %4
%8 = load i32*, i32** %4
%9 = icmp ne i32* %8, null
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %1
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @fun(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, 1
ret i32 %3
}
/* Variables and functions */
char getchar();
int /*<<< orphan*/ printf(char *, char);
void rev() {
  char c = getchar();
  if (c != '\n')
    rev();
  printf("%c", c);
}


x86 assembly (clang, -O0):
<rev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0xa,%eax
je     1154 <rev+0x24>
call   1030 <rev@plt>
lea    0xea5(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rev>:
push   %rbx
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebx
cmp    $0xa,%al
je     1143 <rev+0x13>
call   1030 <rev@plt>
movsbl %bl,%esi
lea    0xeb3(%rip),%rdi
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
define void @rev() {
%1 = alloca i8
%2 = call signext i8 (...) @getchar()
store i8 %2, i8* %1
%3 = load i8, i8* %1
%4 = sext i8 %3 to i32
%5 = icmp ne i32 %4, 10
br i1 %5, label %6, label %7
6: ; preds = %0
br label %7
7: ; preds = %6, %0
%8 = load i8, i8* %1
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %8)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @rev() {
%1 = tail call signext i8 (...) @getchar()
%2 = icmp eq i8 %1, 10
br i1 %2, label %4, label %3
3: ; preds = %0
tail call void @rev()
br label %4
4: ; preds = %3, %0
%5 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %1)
ret void
}
int abs(int arg) {
  if (arg < 0)
    arg = -arg;
  return (arg);
}


x86 assembly (clang, -O0):
<abs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1119 <abs+0x19>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  char buffer[128];
  printf("You win this game if you are able to do something other than "
         "reaching the end of this function.'\n");
  gets(buffer);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
lea    -0x90(%rbp),%rdi
call   1040 <gets@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x88,%rsp
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rdi
call   1040 <gets@plt>
xor    %eax,%eax
add    $0x88,%rsp
ret

LLVM IR (-O0):
@.str = [98 x i8] c"You win this game if you are able to do something other than reaching the end of this function.'\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [128 x i8]
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = call i32 @printf(i8* getelementptr inbounds ([98 x i8], [98 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%8 = call i32 @gets(i8* %7)
ret i32 0
}

LLVM IR (-O2):
@str = [97 x i8] c"You win this game if you are able to do something other than reaching the end of this function.'\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [128 x i8]
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([97 x i8], [97 x i8]* @str, i64 0, i64 0))
%6 = call i32 @gets(i8* %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ bar();
void foo(void *frame) { bar(); }


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

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

LLVM IR (-O0):
define void @foo(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @bar()
ret void
}

LLVM IR (-O2):
define void @foo(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @bar()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int /*<<< orphan*/ sysfs_read(char *);
uint64_t ad_read(int idx) {
  char tmp[256];
  snprintf(tmp, 256, "/sys/bus/iio/devices/iio:device0/in_voltage%d_raw", idx);
  return (uint64_t)sysfs_read(tmp);
}


x86 assembly (clang, -O0):
<ad_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x4(%rbp),%ecx
mov    $0x100,%esi
lea    0xebc(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x110(%rbp),%rdi
call   1040 <sysfs_read@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ad_read>:
push   %rbx
sub    $0x100,%rsp
mov    %edi,%ecx
lea    0xecf(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <sysfs_read@plt>
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [50 x i8] c"/sys/bus/iio/devices/iio:device0/in_voltage%d_raw\00"
define i32 @ad_read(i32 %0) {
%2 = alloca i32
%3 = alloca [256 x i8]
store i32 %0, i32* %2
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* %2
%6 = call i32 @snprintf(i8* %4, i32 256, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%8 = call i32 @sysfs_read(i8* %7)
ret i32 %8
}

LLVM IR (-O2):
@.str = [50 x i8] c"/sys/bus/iio/devices/iio:device0/in_voltage%d_raw\00"
define i32 @ad_read(i32 %0) {
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%4 = call i32 @snprintf(i8* %3, i32 256, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 %0)
%5 = call i32 @sysfs_read(i8* %3)
ret i32 %5
}