xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;
struct passwd {
  int /*<<< orphan*/ pw_name;
};

/* Variables and functions */
struct passwd *getpwuid(int /*<<< orphan*/);
int /*<<< orphan*/ system_error(char *);
char *xstrdup(int /*<<< orphan*/);
char *get_user_name(uid_t uid) {
  struct passwd *entry;
  entry = getpwuid(uid);
  if (entry == NULL)
    system_error("getpwuid");
  return xstrdup(entry->pw_name);
}


x86 assembly (clang, -O0):
<get_user_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <getpwuid@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115e <get_user_name+0x2e>
lea    0xea7(%rip),%rdi
call   1050 <system_error@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1040 <xstrdup@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_user_name>:
push   %rbx
call   1030 <getpwuid@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114a <get_user_name+0x1a>
lea    0xebb(%rip),%rdi
call   1050 <system_error@plt>
mov    (%rbx),%edi
pop    %rbx
jmp    1040 <xstrdup@plt>

LLVM IR (-O0):
%struct.passwd = type { i32 }
@.str = [9 x i8] c"getpwuid\00"
define i8* @get_user_name(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.passwd*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call %struct.passwd* @getpwuid(i32 %4)
store %struct.passwd* %5, %struct.passwd** %3
%6 = load %struct.passwd*, %struct.passwd** %3
%7 = icmp eq %struct.passwd* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 @system_error(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load %struct.passwd*, %struct.passwd** %3
%12 = getelementptr inbounds %struct.passwd, %struct.passwd* %11, i32 0, i32 0
%13 = load i32, i32* %12
%14 = call i8* @xstrdup(i32 %13)
ret i8* %14
}

LLVM IR (-O2):
%struct.passwd = type { i32 }
@.str = [9 x i8] c"getpwuid\00"
define i8* @get_user_name(i32 %0) {
%2 = tail call %struct.passwd* @getpwuid(i32 %0)
%3 = icmp eq %struct.passwd* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @system_error(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
%7 = getelementptr inbounds %struct.passwd, %struct.passwd* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = tail call i8* @xstrdup(i32 %8)
ret i8* %9
}
int fun589() { return 589; }


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

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

LLVM IR (-O0):
define i32 @fun589() {
ret i32 589
}

LLVM IR (-O2):
define i32 @fun589() {
ret i32 589
}
/* Variables and functions */
int /*<<< orphan*/ GL_COLOR_BUFFER_BIT;
int /*<<< orphan*/ createPolygon();
int /*<<< orphan*/ glClear(int /*<<< orphan*/);
int /*<<< orphan*/ glColor3f(float, float, float);
int /*<<< orphan*/ glFlush();
void display() {
  glClear(GL_COLOR_BUFFER_BIT);
  glColor3f(0.0f, 0.0f, 0.0f);
  createPolygon();
  glFlush();
}


x86 assembly (clang, -O0):
<display>:
push   %rbp
mov    %rsp,%rbp
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
call   1030 <glClear@plt>
xorps  %xmm2,%xmm2
movaps %xmm2,%xmm0
movaps %xmm2,%xmm1
call   1050 <glColor3f@plt>
mov    $0x0,%al
call   1040 <createPolygon@plt>
mov    $0x0,%al
call   1060 <glFlush@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<display>:
push   %rax
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1030 <glClear@plt>
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
call   1050 <glColor3f@plt>
xor    %eax,%eax
call   1040 <createPolygon@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <glFlush@plt>

LLVM IR (-O0):
@GL_COLOR_BUFFER_BIT = global i32 0
define void @display() {
%1 = load i32, i32* @GL_COLOR_BUFFER_BIT
%2 = call i32 @glClear(i32 %1)
%3 = call i32 @glColor3f(float 0.000000e+00, float 0.000000e+00, float 0.000000e+00)
%4 = call i32 (...) @createPolygon()
%5 = call i32 (...) @glFlush()
ret void
}

LLVM IR (-O2):
@GL_COLOR_BUFFER_BIT = global i32 0
define void @display() {
%1 = load i32, i32* @GL_COLOR_BUFFER_BIT
%2 = tail call i32 @glClear(i32 %1)
%3 = tail call i32 @glColor3f(float 0.000000e+00, float 0.000000e+00, float 0.000000e+00)
%4 = tail call i32 (...) @createPolygon()
%5 = tail call i32 (...) @glFlush()
ret void
}
void foo2(char *str) { str[20] = 'a'; }


x86 assembly (clang, -O0):
<foo2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x61,0x14(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo2>:
movb   $0x61,0x14(%rdi)
ret

LLVM IR (-O0):
define void @foo2(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 20
store i8 97, i8* %4
ret void
}

LLVM IR (-O2):
define void @foo2(i8* nocapture writeonly %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 20
store i8 97, i8* %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ vp8_variance(unsigned char *, int, unsigned char *, int, int,
                                int, unsigned int *, int *);
unsigned int vp8_variance8x8_c(unsigned char *src_ptr, int source_stride,
                               unsigned char *ref_ptr, int recon_stride,
                               unsigned int *sse) {
  unsigned int var;
  int avg;
  vp8_variance(src_ptr, source_stride, ref_ptr, recon_stride, 8, 8, &var, &avg);
  *sse = var;
  return (var - ((avg * avg) >> 6));
}


x86 assembly (clang, -O0):
<vp8_variance8x8_c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    $0x8,%r9d
lea    -0x2c(%rbp),%r10
lea    -0x30(%rbp),%rax
mov    %r9d,%r8d
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1030 <vp8_variance@plt>
mov    -0x2c(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x2c(%rbp),%eax
mov    -0x30(%rbp),%ecx
imul   -0x30(%rbp),%ecx
sar    $0x6,%ecx
sub    %ecx,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vp8_variance8x8_c>:
push   %rbx
sub    $0x10,%rsp
mov    %r8,%rbx
lea    0x8(%rsp),%rax
lea    0xc(%rsp),%r10
mov    $0x8,%r8d
mov    $0x8,%r9d
push   %rax
push   %r10
call   1030 <vp8_variance@plt>
add    $0x10,%rsp
mov    0xc(%rsp),%eax
mov    %eax,(%rbx)
mov    0x8(%rsp),%ecx
imul   %ecx,%ecx
shr    $0x6,%ecx
sub    %ecx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @vp8_variance8x8_c(i8* %0, i32 %1, i8* %2, i32 %3, i32* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i32* %4, i32** %10
%13 = load i8*, i8** %6
%14 = load i32, i32* %7
%15 = load i8*, i8** %8
%16 = load i32, i32* %9
%17 = call i32 @vp8_variance(i8* %13, i32 %14, i8* %15, i32 %16, i32 8, i32 8, i32* %11, i32* %12)
%18 = load i32, i32* %11
%19 = load i32*, i32** %10
store i32 %18, i32* %19
%20 = load i32, i32* %11
%21 = load i32, i32* %12
%22 = load i32, i32* %12
%23 = mul nsw i32 %21, %22
%24 = ashr i32 %23, 6
%25 = sub i32 %20, %24
ret i32 %25
}

LLVM IR (-O2):
define i32 @vp8_variance8x8_c(i8* %0, i32 %1, i8* %2, i32 %3, i32* nocapture writeonly %4) {
%6 = alloca i32
%7 = alloca i32
%8 = bitcast i32* %6 to i8*
%9 = bitcast i32* %7 to i8*
%10 = call i32 @vp8_variance(i8* %0, i32 %1, i8* %2, i32 %3, i32 8, i32 8, i32* %6, i32* %7)
%11 = load i32, i32* %6
store i32 %11, i32* %4
%12 = load i32, i32* %7
%13 = mul nsw i32 %12, %12
%14 = lshr i32 %13, 6
%15 = sub i32 %11, %14
ret i32 %15
}
/* Variables and functions */
int d05(int);
int d06(int a) { return d05(d05(a)); }


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

x86 assembly (clang, -O2):
<d06>:
push   %rax
call   1030 <d05@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <d05@plt>

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

LLVM IR (-O2):
define i32 @d06(i32 %0) {
%2 = tail call i32 @d05(i32 %0)
%3 = tail call i32 @d05(i32 %2)
ret i32 %3
}
/* Variables and functions */
void stub1(void const *);
void testClosurePrV(void (*closure)(const void *), const void *a1) {
  if (closure != NULL)
    (*closure)(a1);
}


x86 assembly (clang, -O0):
<testClosurePrV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1125 <testClosurePrV+0x25>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rdi
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testClosurePrV>:
test   %rdi,%rdi
je     110d <testClosurePrV+0xd>
mov    %rdi,%rax
mov    %rsi,%rdi
jmp    *%rax
ret

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

LLVM IR (-O2):
define void @testClosurePrV(void (i8*)* %0, i8* %1) {
%3 = icmp eq void (i8*)* %0, null
br i1 %3, label %5, label %4
4: ; preds = %2
tail call void %0(i8* %1)
br label %5
5: ; preds = %4, %2
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
uint32_t utl_split_int(uint32_t val, int thread_id, int num_threads) {
  assert(thread_id < num_threads);
  uint32_t s = val / num_threads;
  uint32_t m = val % num_threads;
  if (thread_id == 0) {
    s += m;
  }
  if (s == 0) {
    s = 1;
  }
  return (s);
}


x86 assembly (clang, -O0):
<utl_split_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    115b <utl_split_int+0x4b>
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    116c <utl_split_int+0x5c>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utl_split_int>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%ebp
mov    %edi,%r14d
xor    %edi,%edi
cmp    %edx,%esi
setl   %dil
call   1030 <assert@plt>
mov    %r14d,%eax
cltd
idiv   %ebx
lea    (%rdx,%rax,1),%ecx
test   %ebp,%ebp
cmove  %ecx,%eax
test   %eax,%eax
mov    $0x1,%ecx
cmove  %ecx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @utl_split_int(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = sdiv i32 %0, %2
%8 = srem i32 %0, %2
%9 = icmp eq i32 %1, 0
%10 = add nsw i32 %8, %7
%11 = select i1 %9, i32 %10, i32 %7
%12 = icmp eq i32 %11, 0
%13 = select i1 %12, i32 1, i32 %11
ret i32 %13
}
/* Variables and functions */
size_t ceiling(size_t n) {
  size_t c;
  c = 1;
  while (n > c) {
    c >>= 1;
  }
  return c;
}


x86 assembly (clang, -O0):
<ceiling>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jbe    112f <ceiling+0x2f>
mov    -0x10(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <ceiling+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i64 @ceiling(i64 %0) {
%2 = icmp ult i64 %0, 2
ret i64 1
}
/* Variables and functions */
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *, int, char *);
void Perror(const char *str) {
  char buf[100];
  snprintf(buf, 100, "%s at line:%d, file:%s\n", str, 13,
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/UsingtcNower/simple_db/refs/heads/master/"
           "src/record_lock_test.c");
  perror(buf);
}


x86 assembly (clang, -O0):
<Perror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x64,%esi
lea    0xec0(%rip),%rdx
mov    $0xd,%r8d
lea    0xecb(%rip),%r9
call   1030 <snprintf@plt>
lea    -0x70(%rbp),%rdi
call   1040 <perror@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Perror>:
push   %rbx
sub    $0x70,%rsp
mov    %rdi,%rcx
lea    0xed1(%rip),%rdx
lea    0xee2(%rip),%r9
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x64,%esi
mov    $0xd,%r8d
call   1030 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <perror@plt>
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"%s at line:%d, file:%s\0A\00"
@.str.1 = [154 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/UsingtcNower/simple_db/refs/heads/master/src/record_lock_test.c\00"
define void @Perror(i8* %0) {
%2 = alloca i8*
%3 = alloca [100 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %2
%6 = call i32 @snprintf(i8* %4, i32 100, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %5, i32 13, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.1, i64 0, i64 0))
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%8 = call i32 @perror(i8* %7)
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"%s at line:%d, file:%s\0A\00"
@.str.1 = [154 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/UsingtcNower/simple_db/refs/heads/master/src/record_lock_test.c\00"
define void @Perror(i8* %0) {
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = call i32 @snprintf(i8* %3, i32 100, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %0, i32 13, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @perror(i8* %3)
ret void
}
/* Type definitions */
typedef int uint32_t;
typedef int uint16_t;

/* Variables and functions */
void ADI8SetValBit(uint32_t ui32Base, uint32_t ui32Reg, uint16_t ui16Mask,
                   uint16_t ui16Val) {
  uint32_t ui32RegOffset;
  ;
  ;
  ;
  ;
  ui32RegOffset = 0x00000060 + (ui32Reg << 1);
  (*((volatile unsigned short *)(ui32Base + ui32RegOffset))) =
      (ui16Mask << 8) | ui16Val;
}


x86 assembly (clang, -O0):
<ADI8SetValBit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
add    $0x60,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x8,%eax
or     -0x10(%rbp),%eax
mov    %ax,%cx
mov    -0x4(%rbp),%eax
add    -0x14(%rbp),%eax
cltq
mov    %cx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ADI8SetValBit>:
shl    $0x8,%edx
or     %ecx,%edx
lea    (%rdi,%rsi,2),%eax
add    $0x60,%eax
cltq
mov    %dx,(%rax)
ret

LLVM IR (-O0):
define void @ADI8SetValBit(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %6
%11 = shl i32 %10, 1
%12 = add nsw i32 96, %11
store i32 %12, i32* %9
%13 = load i32, i32* %7
%14 = shl i32 %13, 8
%15 = load i32, i32* %8
%16 = or i32 %14, %15
%17 = trunc i32 %16 to i16
%18 = load i32, i32* %5
%19 = load i32, i32* %9
%20 = add nsw i32 %18, %19
%21 = sext i32 %20 to i64
%22 = inttoptr i64 %21 to i16*
store volatile i16 %17, i16* %22
ret void
}

LLVM IR (-O2):
define void @ADI8SetValBit(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = shl i32 %1, 1
%6 = shl i32 %2, 8
%7 = or i32 %6, %3
%8 = trunc i32 %7 to i16
%9 = add i32 %0, 96
%10 = add i32 %9, %5
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i16*
store volatile i16 %8, i16* %12
ret void
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
int S_ISDIR(int /*<<< orphan*/);
int stat(char const *, struct stat *);
int is_directory(const char *path) {
  struct stat s;
  if (-1 == stat(path, &s))
    return -1;
  return 1 == S_ISDIR(s.st_mode) ? 0 : -1;
}


x86 assembly (clang, -O0):
<is_directory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <stat@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    1154 <is_directory+0x34>
movl   $0xffffffff,-0x4(%rbp)
jmp    1172 <is_directory+0x52>
mov    -0x18(%rbp),%edi
call   1030 <S_ISDIR@plt>
mov    %eax,%esi
mov    $0x1,%edx
mov    $0xffffffff,%eax
xor    %ecx,%ecx
cmp    %esi,%edx
cmove  %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_directory>:
push   %rax
mov    %rsp,%rsi
call   1040 <stat@plt>
cmp    $0xffffffff,%eax
je     1144 <is_directory+0x24>
mov    (%rsp),%edi
call   1030 <S_ISDIR@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
setne  %al
neg    %eax
pop    %rcx
ret
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @is_directory(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @stat(i8* %5, %struct.stat* %4)
%7 = icmp eq i32 -1, %6
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 -1, i32* %2
br label %16
9: ; preds = %1
%10 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%11 = load i32, i32* %10
%12 = call i32 @S_ISDIR(i32 %11)
%13 = icmp eq i32 1, %12
%14 = zext i1 %13 to i64
%15 = select i1 %13, i32 0, i32 -1
store i32 %15, i32* %2
br label %16
16: ; preds = %9, %8
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @is_directory(i8* nocapture %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i32 %4, -1
br i1 %5, label %12, label %6
6: ; preds = %1
%7 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = tail call i32 @S_ISDIR(i32 %8)
%10 = icmp ne i32 %9, 1
%11 = sext i1 %10 to i32
br label %12
12: ; preds = %1, %6
%13 = phi i32 [ %11, %6 ], [ -1, %1 ]
ret i32 %13
}
/* Type definitions */
typedef int /*<<< orphan*/ siginfo_t;

/* Variables and functions */
int /*<<< orphan*/ sig_action(int, int /*<<< orphan*/ *, void *, char *,
                              char *);
void sigbus_action(int number, siginfo_t *info, void *data) {
  sig_action(number, info, data, "Bus Error",
             "Your application crashed due an improper memory handling.");
}


x86 assembly (clang, -O0):
<sigbus_action>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xecb(%rip),%rcx
lea    0xece(%rip),%r8
call   1030 <sig_action@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigbus_action>:
lea    0xee9(%rip),%rcx
lea    0xeec(%rip),%r8
jmp    1030 <sig_action@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"Bus Error\00"
@.str.1 = [58 x i8] c"Your application crashed due an improper memory handling.\00"
define void @sigbus_action(i32 %0, i32* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i8*
store i32 %0, i32* %4
store i32* %1, i32** %5
store i8* %2, i8** %6
%7 = load i32, i32* %4
%8 = load i32*, i32** %5
%9 = load i8*, i8** %6
%10 = call i32 @sig_action(i32 %7, i32* %8, i8* %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"Bus Error\00"
@.str.1 = [58 x i8] c"Your application crashed due an improper memory handling.\00"
define void @sigbus_action(i32 %0, i32* %1, i8* %2) {
%4 = tail call i32 @sig_action(i32 %0, i32* %1, i8* %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("\nbom dia, ola mundo!!\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [23 x i8] c"\0Abom dia, ola mundo!!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [22 x i8] c"\0Abom dia, ola mundo!!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int bit_mask_nz(unsigned int);
unsigned bit_mask(unsigned bits) { return bits ? bit_mask_nz(bits) : 0; }


x86 assembly (clang, -O0):
<bit_mask>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1135 <bit_mask+0x25>
mov    -0x4(%rbp),%edi
call   1030 <bit_mask_nz@plt>
mov    %eax,-0x8(%rbp)
jmp    113f <bit_mask+0x2f>
xor    %eax,%eax
mov    %eax,-0x8(%rbp)
jmp    113f <bit_mask+0x2f>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_mask>:
test   %edi,%edi
je     1119 <bit_mask+0x9>
jmp    1030 <bit_mask_nz@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @bit_mask(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 %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = call i32 @bit_mask_nz(i32 %6)
br label %9
8: ; preds = %1
br label %9
9: ; preds = %8, %5
%10 = phi i32 [ %7, %5 ], [ 0, %8 ]
ret i32 %10
}

LLVM IR (-O2):
define i32 @bit_mask(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @bit_mask_nz(i32 %0)
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ %4, %3 ], [ 0, %1 ]
ret i32 %6
}
void quickSort(int *array, int start, int stop) {
  int partition(int *, int, int);
  int q = partition(array, start, stop);
  if (q - 1 >= start)
    quickSort(array, start, q - 1);
  if (stop >= q + 1)
    quickSort(array, q + 1, stop);
}


x86 assembly (clang, -O0):
<quickSort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <partition@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cmp    -0xc(%rbp),%eax
jl     1165 <quickSort+0x45>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1040 <quickSort@plt>
mov    -0x10(%rbp),%eax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jl     1188 <quickSort+0x68>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <quickSort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quickSort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %esi,%ebp
mov    %rdi,%r14
jmp    1148 <quickSort+0x28>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0x1(%rbx),%ebp
cmp    %r15d,%ebx
jge    116a <quickSort+0x4a>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %r15d,%edx
call   1030 <partition@plt>
mov    %eax,%ebx
cmp    %ebp,%eax
jle    1140 <quickSort+0x20>
lea    -0x1(%rbx),%edx
mov    %r14,%rdi
mov    %ebp,%esi
call   1040 <quickSort@plt>
jmp    1140 <quickSort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @quickSort(i32* %0, i32 %1, i32 %2) {
br label %4
4: ; preds = %10, %3
%5 = phi i32 [ %1, %3 ], [ %12, %10 ]
%6 = tail call i32 @partition(i32* %0, i32 %5, i32 %2)
%7 = icmp sgt i32 %6, %5
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = add nsw i32 %6, -1
tail call void @quickSort(i32* %0, i32 %5, i32 %9)
br label %10
10: ; preds = %8, %4
%11 = icmp slt i32 %6, %2
%12 = add nsw i32 %6, 1
br i1 %11, label %4, label %13
13: ; preds = %10
ret void
}
const char *_Locale_grouping(struct _Locale_numeric *__DUMMY_PAR) { return ""; }


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

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

LLVM IR (-O0):
%struct._Locale_numeric = type opaque
@.str = [1 x i8] zeroinitializer
define i8* @_Locale_grouping(%struct._Locale_numeric* %0) {
%2 = alloca %struct._Locale_numeric*
store %struct._Locale_numeric* %0, %struct._Locale_numeric** %2
ret i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
%struct._Locale_numeric = type opaque
@.str = [1 x i8] zeroinitializer
define i8* @_Locale_grouping(%struct._Locale_numeric* nocapture readnone %0) {
ret i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
typedef int /*<<< orphan*/ ls;

/* Variables and functions */
int /*<<< orphan*/ subsets(int *, int);
int main() {
  int ls[] = {0, 1, 2, 3, 4};
  subsets(ls, sizeof(ls) / sizeof(int));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed5(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1030 <subsets@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xef6(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xedb(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x5,%esi
call   1030 <subsets@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.ls = [5 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4]
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
store i32 0, i32* %1
%3 = bitcast [5 x i32]* %2 to i8*
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%5 = call i32 @subsets(i32* %4, i32 5)
ret i32 0
}

LLVM IR (-O2):
@__const.main.ls = [5 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4]
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%4 = call i32 @subsets(i32* %3, i32 5)
ret i32 0
}
int test_imm_3Fint64_midword_reg(long long val) {
  return ((val >> 16) & (0x3F << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_3Fint64_midword_reg>:
test   $0x3f0000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_3Fint64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 16
%5 = and i64 %4, 63
%6 = icmp ne i64 %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_3Fint64_midword_reg(i64 %0) {
%2 = and i64 %0, 4128768
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int anetUnixGenericConnect(char *, char *, int /*<<< orphan*/);
int catAnetUnixConnect(char *err, char *path) {
  return anetUnixGenericConnect(err, path, 0);
}


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

x86 assembly (clang, -O2):
<catAnetUnixConnect>:
xor    %edx,%edx
jmp    1030 <anetUnixGenericConnect@plt>

LLVM IR (-O0):
define i32 @catAnetUnixConnect(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 = load i8*, i8** %4
%7 = call i32 @anetUnixGenericConnect(i8* %5, i8* %6, i32 0)
ret i32 %7
}

LLVM IR (-O2):
define i32 @catAnetUnixConnect(i8* %0, i8* %1) {
%3 = tail call i32 @anetUnixGenericConnect(i8* %0, i8* %1, i32 0)
ret i32 %3
}
/* Type definitions */
struct list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ failure(char *, char *);
int /*<<< orphan*/ list_search(struct list *, char *);
void test_search_data(struct list *list, char *data) {
  if (!list_search(list, data))
    failure("list should have had '%s'", data);
}


x86 assembly (clang, -O0):
<test_search_data>:
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   1040 <list_search@plt>
cmp    $0x0,%eax
jne    1156 <test_search_data+0x36>
mov    -0x10(%rbp),%rsi
lea    0xeaf(%rip),%rdi
call   1030 <failure@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_search_data>:
push   %rbx
mov    %rsi,%rbx
call   1040 <list_search@plt>
test   %eax,%eax
je     112f <test_search_data+0xf>
pop    %rbx
ret
lea    0xeca(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <failure@plt>

LLVM IR (-O0):
%struct.list = type { i32 }
@.str = [26 x i8] c"list should have had '%s'\00"
define void @test_search_data(%struct.list* %0, i8* %1) {
%3 = alloca %struct.list*
%4 = alloca i8*
store %struct.list* %0, %struct.list** %3
store i8* %1, i8** %4
%5 = load %struct.list*, %struct.list** %3
%6 = load i8*, i8** %4
%7 = call i32 @list_search(%struct.list* %5, i8* %6)
%8 = icmp ne i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %2
%10 = load i8*, i8** %4
%11 = call i32 @failure(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %12
12: ; preds = %9, %2
ret void
}

LLVM IR (-O2):
%struct.list = type { i32 }
@.str = [26 x i8] c"list should have had '%s'\00"
define void @test_search_data(%struct.list* %0, i8* %1) {
%3 = tail call i32 @list_search(%struct.list* %0, i8* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @failure(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %7
7: ; preds = %5, %2
ret void
}
/* Type definitions */
typedef scalar_t__ uint64_t;
struct timeval {
  int tv_sec;
  scalar_t__ tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/);
uint64_t get_current_time() {
  struct timeval t;
  gettimeofday(&t, 0);
  return (t.tv_sec * 1000000 + t.tv_usec);
}


x86 assembly (clang, -O0):
<get_current_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
imul   $0xf4240,-0x10(%rbp),%eax
cltq
add    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_current_time>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movslq 0x8(%rsp),%rax
imul   $0xf4240,%rax,%rax
add    0x10(%rsp),%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
define i64 @get_current_time() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32 0)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load i32, i32* %3
%5 = mul nsw i32 %4, 1000000
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%8 = load i64, i64* %7
%9 = add nsw i64 %6, %8
ret i64 %9
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
define i64 @get_current_time() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32 0)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000000
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%9 = load i64, i64* %8
%10 = add nsw i64 %9, %7
ret i64 %10
}
unsigned int __attribute__((warn_unused_result))
__fifo_uint_must_check_helper(unsigned int val) {
  return val;
}


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

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

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

LLVM IR (-O2):
define i32 @__fifo_uint_must_check_helper(i32 returned %0) {
ret i32 %0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
float frexpf(float x, int *ex) {
  uint32_t *dir = (uint32_t *)&x;
  *ex = ((*dir >> 23) & ((1 << 8) - 1)) - 126;
  *dir &= ~(((1 << 8) - 1) << 23);
  *dir |= 126 << 23;
  return x;
}


x86 assembly (clang, -O0):
<frexpf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
sar    $0x17,%ecx
and    $0xff,%ecx
sub    $0x7e,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
and    $0x807fffff,%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
or     $0x3f000000,%ecx
mov    %ecx,(%rax)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<frexpf>:
movd   %xmm0,%eax
mov    %eax,%ecx
shr    $0x17,%ecx
movzbl %cl,%ecx
add    $0xffffff82,%ecx
mov    %ecx,(%rdi)
and    $0x807fffff,%eax
or     $0x3f000000,%eax
movd   %eax,%xmm0
ret

LLVM IR (-O0):
define float @frexpf(float %0, i32* %1) {
%3 = alloca float
%4 = alloca i32*
%5 = alloca i32*
store float %0, float* %3
store i32* %1, i32** %4
%6 = bitcast float* %3 to i32*
store i32* %6, i32** %5
%7 = load i32*, i32** %5
%8 = load i32, i32* %7
%9 = ashr i32 %8, 23
%10 = and i32 %9, 255
%11 = sub nsw i32 %10, 126
%12 = load i32*, i32** %4
store i32 %11, i32* %12
%13 = load i32*, i32** %5
%14 = load i32, i32* %13
%15 = and i32 %14, -2139095041
store i32 %15, i32* %13
%16 = load i32*, i32** %5
%17 = load i32, i32* %16
%18 = or i32 %17, 1056964608
store i32 %18, i32* %16
%19 = load float, float* %3
ret float %19
}

LLVM IR (-O2):
define float @frexpf(float %0, i32* nocapture writeonly %1) {
%3 = bitcast float %0 to i32
%4 = lshr i32 %3, 23
%5 = and i32 %4, 255
%6 = add nsw i32 %5, -126
store i32 %6, i32* %1
%7 = and i32 %3, -2139095041
%8 = or i32 %7, 1056964608
%9 = bitcast i32 %8 to float
ret float %9
}
/* Variables and functions */
scalar_t__ cpputest_malloc_location(unsigned long, char *, int);
char *mallocAllocation() {
  return (char *)cpputest_malloc_location(
      10UL,
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/AOKP/kernel_sony_msm8974ab/refs/heads/1.kgsl/"
      "CppUTest/tests/AllocationInCFile.c",
      9);
}


x86 assembly (clang, -O0):
<mallocAllocation>:
push   %rbp
mov    %rsp,%rbp
mov    $0xa,%edi
lea    0xee0(%rip),%rsi
mov    $0x9,%edx
call   1030 <cpputest_malloc_location@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<mallocAllocation>:
lea    0xee9(%rip),%rsi
mov    $0xa,%edi
mov    $0x9,%edx
jmp    1030 <cpputest_malloc_location@plt>

LLVM IR (-O0):
@.str = [170 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AOKP/kernel_sony_msm8974ab/refs/heads/1.kgsl/CppUTest/tests/AllocationInCFile.c\00"
define i8* @mallocAllocation() {
%1 = call i64 @cpputest_malloc_location(i64 10, i8* getelementptr inbounds ([170 x i8], [170 x i8]* @.str, i64 0, i64 0), i32 9)
%2 = inttoptr i64 %1 to i8*
ret i8* %2
}

LLVM IR (-O2):
@.str = [170 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AOKP/kernel_sony_msm8974ab/refs/heads/1.kgsl/CppUTest/tests/AllocationInCFile.c\00"
define i8* @mallocAllocation() {
%1 = tail call i64 @cpputest_malloc_location(i64 10, i8* getelementptr inbounds ([170 x i8], [170 x i8]* @.str, i64 0, i64 0), i32 9)
%2 = inttoptr i64 %1 to i8*
ret i8* %2
}
int do_058() { return 58; }


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

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

LLVM IR (-O0):
define i32 @do_058() {
ret i32 58
}

LLVM IR (-O2):
define i32 @do_058() {
ret i32 58
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ LOG_print(char *);
int /*<<< orphan*/ LOG_save();
int /*<<< orphan*/ SOCKET_free();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void app_terminate(void) {
  LOG_print("Server is being closed...\n");
  SOCKET_free();
  LOG_print("Server closed.\n");
  LOG_save();
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<app_terminate>:
push   %rbp
mov    %rsp,%rbp
lea    0xeb5(%rip),%rdi
call   1050 <LOG_print@plt>
mov    $0x0,%al
call   1040 <SOCKET_free@plt>
lea    0xebd(%rip),%rdi
call   1050 <LOG_print@plt>
mov    $0x0,%al
call   1030 <LOG_save@plt>
mov    0x2e6f(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<app_terminate>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1050 <LOG_print@plt>
xor    %eax,%eax
call   1040 <SOCKET_free@plt>
lea    0xec0(%rip),%rdi
call   1050 <LOG_print@plt>
xor    %eax,%eax
call   1030 <LOG_save@plt>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"Server is being closed...\0A\00"
@.str.1 = [16 x i8] c"Server closed.\0A\00"
@EXIT_SUCCESS = global i32 0
define void @app_terminate() {
%1 = call i32 @LOG_print(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @SOCKET_free()
%3 = call i32 @LOG_print(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 (...) @LOG_save()
%5 = load i32, i32* @EXIT_SUCCESS
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@.str = [27 x i8] c"Server is being closed...\0A\00"
@.str.1 = [16 x i8] c"Server closed.\0A\00"
@EXIT_SUCCESS = global i32 0
define void @app_terminate() {
%1 = tail call i32 @LOG_print(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @SOCKET_free()
%3 = tail call i32 @LOG_print(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 (...) @LOG_save()
%5 = load i32, i32* @EXIT_SUCCESS
%6 = tail call i32 @exit(i32 %5)
unreachable
}
/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int c;
  while ((c = getchar()) != EOF) {
    if (c <= 127)
      printf("%c", c);
  }
  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)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    0x2ea1(%rip),%rcx
cmp    (%rcx),%eax
je     116d <main+0x4d>
cmpl   $0x7f,-0x14(%rbp)
jg     1168 <main+0x48>
mov    -0x14(%rbp),%esi
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb6(%rip),%rbx
cmp    (%rbx),%eax
jne    1140 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xeb9(%rip),%r14
jmp    115b <main+0x3b>
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%rbx),%eax
je     1136 <main+0x16>
cmp    $0x7f,%eax
jg     1150 <main+0x30>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
jmp    1150 <main+0x30>

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

LLVM IR (-O2):
@EOF = global i32 0
@.str = [3 x i8] c"%c\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @getchar()
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %15, label %6
6: ; preds = %2, %11
%7 = phi i32 [ %12, %11 ], [ %3, %2 ]
%8 = icmp slt i32 %7, 128
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %11
11: ; preds = %9, %6
%12 = tail call i32 (...) @getchar()
%13 = load i32, i32* @EOF
%14 = icmp eq i32 %12, %13
br i1 %14, label %15, label %6
15: ; preds = %11, %2
ret i32 0
}
/* Variables and functions */
char *date_get_now_hh_colon_mm_colon_ss(int);
char *date_get_now_time_second(int utc_offset) {
  return date_get_now_hh_colon_mm_colon_ss(utc_offset);
}


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

x86 assembly (clang, -O2):
<date_get_now_time_second>:
jmp    1030 <date_get_now_hh_colon_mm_colon_ss@plt>

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

LLVM IR (-O2):
define i8* @date_get_now_time_second(i32 %0) {
%2 = tail call i8* @date_get_now_hh_colon_mm_colon_ss(i32 %0)
ret i8* %2
}
/* Variables and functions */
float expf(float);
float alog10f(float x) { return expf(x * ((float)((2.302585092994046e+0L)))); }


x86 assembly (clang, -O0):
<alog10f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  0xedb(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
call   1030 <expf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alog10f>:
mulss  0xee8(%rip),%xmm0
jmp    1030 <expf@plt>

LLVM IR (-O0):
define float @alog10f(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fmul float %3, 0x40026BB1C0000000
%5 = call float @expf(float %4)
ret float %5
}

LLVM IR (-O2):
define float @alog10f(float %0) {
%2 = fmul float %0, 0x40026BB1C0000000
%3 = tail call float @expf(float %2)
ret float %3
}
int foo0() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @foo0() {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ GLint;
typedef int /*<<< orphan*/ GLenum;

/* Variables and functions */
int /*<<< orphan*/ glGetMaterialiv(int /*<<< orphan*/, int /*<<< orphan*/,
                                   int /*<<< orphan*/ *);
void GetMaterialiv(GLenum face, GLenum pname, GLint *params) {
  glGetMaterialiv(face, pname, params);
}


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

x86 assembly (clang, -O2):
<GetMaterialiv>:
jmp    1030 <glGetMaterialiv@plt>

LLVM IR (-O0):
define void @GetMaterialiv(i32 %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i32*, i32** %6
%10 = call i32 @glGetMaterialiv(i32 %7, i32 %8, i32* %9)
ret void
}

LLVM IR (-O2):
define void @GetMaterialiv(i32 %0, i32 %1, i32* %2) {
%4 = tail call i32 @glGetMaterialiv(i32 %0, i32 %1, i32* %2)
ret void
}