xunge/DecIR huggingface dataset:
/* Type definitions */
struct list_head {
  int dummy;
};

/* Variables and functions */
bool __list_add_valid(struct list_head *new, struct list_head *prev,
                      struct list_head *next) {
  return true;
}


x86 assembly (clang, -O0):
<__list_add_valid>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.list_head = type { i32 }
define i32 @__list_add_valid(%struct.list_head* %0, %struct.list_head* %1, %struct.list_head* %2) {
%4 = alloca %struct.list_head*
%5 = alloca %struct.list_head*
%6 = alloca %struct.list_head*
store %struct.list_head* %0, %struct.list_head** %4
store %struct.list_head* %1, %struct.list_head** %5
store %struct.list_head* %2, %struct.list_head** %6
ret i32 1
}

LLVM IR (-O2):
%struct.list_head = type { i32 }
define i32 @__list_add_valid(%struct.list_head* nocapture readnone %0, %struct.list_head* nocapture readnone %1, %struct.list_head* nocapture readnone %2) {
ret i32 1
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
size_t fwrite(void const *, int, size_t, int /*<<< orphan*/ *);
void write_bin(FILE *fp, const void *array, size_t arrayBytes) {
  size_t written = fwrite(array, 1, arrayBytes, fp);
  if (written != arrayBytes) {
    exit(11);
  }
}


x86 assembly (clang, -O0):
<write_bin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fwrite@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     1166 <write_bin+0x46>
mov    $0xb,%edi
call   1030 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_bin>:
push   %rbx
mov    %rdx,%rbx
mov    %rdi,%rcx
mov    %rsi,%rdi
mov    $0x1,%esi
call   1040 <fwrite@plt>
cmp    %rbx,%rax
jne    113b <write_bin+0x1b>
pop    %rbx
ret
mov    $0xb,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @write_bin(i32* %0, i8* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
store i32* %0, i32** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = load i32*, i32** %4
%11 = call i64 @fwrite(i8* %8, i32 1, i64 %9, i32* %10)
store i64 %11, i64* %7
%12 = load i64, i64* %7
%13 = load i64, i64* %6
%14 = icmp ne i64 %12, %13
br i1 %14, label %15, label %17
15: ; preds = %3
%16 = call i32 @exit(i32 11)
unreachable
17: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @write_bin(i32* nocapture %0, i8* nocapture %1, i64 %2) {
%4 = tail call i64 @fwrite(i8* %1, i32 1, i64 %2, i32* %0)
%5 = icmp eq i64 %4, %2
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @exit(i32 11)
unreachable
8: ; preds = %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(char const *);
int /*<<< orphan*/ trio_copy_max(char *, size_t, char const *);
char *trio_create(size_t);
char *internal_duplicate_max(const char *source, size_t size) {
  char *target;
  assert(source);
  size++;
  target = trio_create(size);
  if (target) {
    trio_copy_max(target, size, source);
  }
  return target;
}


x86 assembly (clang, -O0):
<internal_duplicate_max>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <trio_create@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     117e <internal_duplicate_max+0x4e>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
call   1050 <trio_copy_max@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<internal_duplicate_max>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
call   1040 <assert@plt>
add    $0x1,%rbx
mov    %rbx,%rdi
call   1030 <trio_create@plt>
mov    %rax,%r15
test   %rax,%rax
je     1162 <internal_duplicate_max+0x32>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1050 <trio_copy_max@plt>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @internal_duplicate_max(i8* %0, i64 %1) {
%3 = tail call i32 @assert(i8* %0)
%4 = add i64 %1, 1
%5 = tail call i8* @trio_create(i64 %4)
%6 = icmp eq i8* %5, null
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = tail call i32 @trio_copy_max(i8* %5, i64 %4, i8* %0)
br label %9
9: ; preds = %7, %2
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void free_dvector(double *v, long nl, long nh) { free((void *)(v + nl - 1)); }


x86 assembly (clang, -O0):
<free_dvector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
add    $0xfffffffffffffff8,%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_dvector>:
lea    (%rdi,%rsi,8),%rdi
add    $0xfffffffffffffff8,%rdi
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_dvector(double* %0, i64 %1, i64 %2) {
%4 = alloca double*
%5 = alloca i64
%6 = alloca i64
store double* %0, double** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load double*, double** %4
%8 = load i64, i64* %5
%9 = getelementptr inbounds double, double* %7, i64 %8
%10 = getelementptr inbounds double, double* %9, i64 -1
%11 = bitcast double* %10 to i8*
%12 = call i32 @free(i8* %11)
ret void
}

LLVM IR (-O2):
define void @free_dvector(double* nocapture %0, i64 %1, i64 %2) {
%4 = getelementptr inbounds double, double* %0, i64 %1
%5 = getelementptr inbounds double, double* %4, i64 -1
%6 = bitcast double* %5 to i8*
%7 = tail call i32 @free(i8* %6)
ret void
}
void foo(char *p) {
  __builtin_prefetch(p, 0, 0);
  __builtin_prefetch(p, 0, 1);
  __builtin_prefetch(p, 0, 2);
  __builtin_prefetch(p, 0, 3);
  __builtin_prefetch(p, 1, 0);
  __builtin_prefetch(p, 1, 1);
  __builtin_prefetch(p, 1, 2);
  __builtin_prefetch(p, 1, 3);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
prefetchnta (%rax)
mov    -0x8(%rbp),%rax
prefetcht2 (%rax)
mov    -0x8(%rbp),%rax
prefetcht1 (%rax)
mov    -0x8(%rbp),%rax
prefetcht0 (%rax)
mov    -0x8(%rbp),%rax
prefetchnta (%rax)
mov    -0x8(%rbp),%rax
prefetcht2 (%rax)
mov    -0x8(%rbp),%rax
prefetcht1 (%rax)
mov    -0x8(%rbp),%rax
prefetcht0 (%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
prefetchnta (%rdi)
prefetcht2 (%rdi)
prefetcht1 (%rdi)
prefetcht0 (%rdi)
prefetchnta (%rdi)
prefetcht2 (%rdi)
prefetcht1 (%rdi)
prefetcht0 (%rdi)
ret

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

LLVM IR (-O2):
define void @foo(i8* nocapture %0) {
tail call void @llvm.prefetch.p0i8(i8* %0, i32 0, i32 0, i32 1)
tail call void @llvm.prefetch.p0i8(i8* %0, i32 0, i32 1, i32 1)
tail call void @llvm.prefetch.p0i8(i8* %0, i32 0, i32 2, i32 1)
tail call void @llvm.prefetch.p0i8(i8* %0, i32 0, i32 3, i32 1)
tail call void @llvm.prefetch.p0i8(i8* %0, i32 1, i32 0, i32 1)
tail call void @llvm.prefetch.p0i8(i8* %0, i32 1, i32 1, i32 1)
tail call void @llvm.prefetch.p0i8(i8* %0, i32 1, i32 2, i32 1)
tail call void @llvm.prefetch.p0i8(i8* %0, i32 1, i32 3, i32 1)
ret void
}
/* Variables and functions */
void *realloc(void *, size_t);
void *xrealloc(void *o, size_t s) {
  void *m = realloc(o, s);
  return m;
}


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

x86 assembly (clang, -O2):
<xrealloc>:
jmp    1030 <realloc@plt>

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

LLVM IR (-O2):
define noalias i8* @xrealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
ret i8* %3
}
void desplazar1(int x, int y, int h, int v) {
  x = x + h;
  y = y + v;
}


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

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

LLVM IR (-O0):
define void @desplazar1(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %7
%11 = add nsw i32 %9, %10
store i32 %11, i32* %5
%12 = load i32, i32* %6
%13 = load i32, i32* %8
%14 = add nsw i32 %12, %13
store i32 %14, i32* %6
ret void
}

LLVM IR (-O2):
define void @desplazar1(i32 %0, i32 %1, i32 %2, i32 %3) {
ret void
}
/* Variables and functions */
scalar_t__ ispunct(char const);
int punctCount(const char *str) {
  int count = 0;
  while (*str) {
    if (ispunct(*str))
      count++;
    str++;
  }
  return count;
}


x86 assembly (clang, -O0):
<punctCount>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1160 <punctCount+0x50>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <ispunct@plt>
cmp    $0x0,%rax
je     114f <punctCount+0x3f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1123 <punctCount+0x13>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<punctCount>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     114c <punctCount+0x3c>
mov    %rdi,%rbx
add    $0x1,%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl %al,%edi
call   1030 <ispunct@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%ebp
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <punctCount+0x20>
jmp    114e <punctCount+0x3e>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @punctCount(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %13, %4 ], [ %2, %1 ]
%6 = phi i32 [ %11, %4 ], [ 0, %1 ]
%7 = phi i8* [ %12, %4 ], [ %0, %1 ]
%8 = tail call i64 @ispunct(i8 signext %5)
%9 = icmp ne i64 %8, 0
%10 = zext i1 %9 to i32
%11 = add nuw nsw i32 %6, %10
%12 = getelementptr inbounds i8, i8* %7, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %4
15: ; preds = %4, %1
%16 = phi i32 [ 0, %1 ], [ %11, %4 ]
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ power_update();
void power_init(void) { power_update(); }


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

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

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

LLVM IR (-O2):
define void @power_init() {
%1 = tail call i32 (...) @power_update()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
void chain_show_stats(FILE *f __attribute__((unused))) {}


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

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

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

LLVM IR (-O2):
define void @chain_show_stats(i32* nocapture %0) {
ret void
}
/* Variables and functions */
scalar_t__ isfinite(double);
double notfintozero(double x) { return isfinite(x) ? x : 0; }


x86 assembly (clang, -O0):
<notfintozero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <isfinite@plt>
cmp    $0x0,%rax
je     1140 <notfintozero+0x30>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    114d <notfintozero+0x3d>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    114d <notfintozero+0x3d>
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<notfintozero>:
push   %rax
movsd  %xmm0,(%rsp)
call   1030 <isfinite@plt>
xorps  %xmm0,%xmm0
test   %rax,%rax
je     1128 <notfintozero+0x18>
movsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @notfintozero(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i64 @isfinite(double %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load double, double* %2
br label %9
8: ; preds = %1
br label %9
9: ; preds = %8, %6
%10 = phi double [ %7, %6 ], [ 0.000000e+00, %8 ]
ret double %10
}

LLVM IR (-O2):
define double @notfintozero(double %0) {
%2 = tail call i64 @isfinite(double %0)
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, double 0.000000e+00, double %0
ret double %4
}
unsigned huffman_bits(const short value) { return value + (value >> 15); }


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

x86 assembly (clang, -O2):
<huffman_bits>:
mov    %edi,%eax
sar    $0xf,%eax
add    %edi,%eax
ret

LLVM IR (-O0):
define i32 @huffman_bits(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = load i16, i16* %2
%6 = sext i16 %5 to i32
%7 = ashr i32 %6, 15
%8 = add nsw i32 %4, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @huffman_bits(i16 signext %0) {
%2 = sext i16 %0 to i32
%3 = ashr i32 %2, 15
%4 = add nsw i32 %3, %2
ret i32 %4
}
char *langRomTypeMegaSCSI512() { return "512kB MEGA-SCSI"; }


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

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

LLVM IR (-O0):
@.str = [16 x i8] c"512kB MEGA-SCSI\00"
define i8* @langRomTypeMegaSCSI512() {
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [16 x i8] c"512kB MEGA-SCSI\00"
define i8* @langRomTypeMegaSCSI512() {
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
struct tm {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int main() {
  struct tm *x = NULL;
  strftime("", 1, " ", x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
lea    0xecf(%rip),%rdi
mov    $0x1,%esi
lea    0xec2(%rip),%rdx
call   1030 <strftime@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee9(%rip),%rdi
lea    0xee1(%rip),%rdx
mov    $0x1,%esi
xor    %ecx,%ecx
call   1030 <strftime@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c" \00"
define i32 @main() {
%1 = tail call i32 @strftime(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), %struct.tm* null)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ set(int *, int /*<<< orphan*/);
int /*<<< orphan*/ test_assert(int);
int main(void) {
  int a;
  set(&a, 0);
  test_assert(a == 13);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1040 <set@plt>
cmpl   $0xd,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <test_assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x4(%rsp),%rdi
xor    %esi,%esi
call   1040 <set@plt>
xor    %edi,%edi
cmpl   $0xd,0x4(%rsp)
sete   %dil
call   1030 <test_assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @set(i32* %2, i32 0)
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 13
%6 = zext i1 %5 to i32
%7 = call i32 @test_assert(i32 %6)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @set(i32* %1, i32 0)
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 13
%6 = zext i1 %5 to i32
%7 = call i32 @test_assert(i32 %6)
ret i32 0
}
func2_def() {}


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

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

LLVM IR (-O0):
define i32 @func2_def() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @func2_def() {
ret i32 undef
}
/* Variables and functions */
int analog10(int /*<<< orphan*/);
int /*<<< orphan*/ msleep(int);
int /*<<< orphan*/ printf(char *, int);
void lightDetection() {
  int reading = 1024, lightCriticalValue = 512;
  while (reading > lightCriticalValue) {
    msleep(50);
    reading = analog10(0);
    printf("The reading from light sensor is %d\n", reading);
  }
}


x86 assembly (clang, -O0):
<lightDetection>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x400,-0x4(%rbp)
movl   $0x200,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    117a <lightDetection+0x4a>
mov    $0x32,%edi
call   1040 <msleep@plt>
xor    %edi,%edi
call   1030 <analog10@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xe90(%rip),%rdi
call   1050 <printf@plt>
jmp    1146 <lightDetection+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lightDetection>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rbx
nopw   0x0(%rax,%rax,1)
mov    $0x32,%edi
call   1040 <msleep@plt>
xor    %edi,%edi
call   1030 <analog10@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
cmp    $0x200,%ebp
jg     1140 <lightDetection+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [37 x i8] c"The reading from light sensor is %d\0A\00"
define void @lightDetection() {
%1 = alloca i32
%2 = alloca i32
store i32 1024, i32* %1
store i32 512, i32* %2
br label %3
3: ; preds = %7, %0
%4 = load i32, i32* %1
%5 = load i32, i32* %2
%6 = icmp sgt i32 %4, %5
br i1 %6, label %7, label %12
7: ; preds = %3
%8 = call i32 @msleep(i32 50)
%9 = call i32 @analog10(i32 0)
store i32 %9, i32* %1
%10 = load i32, i32* %1
%11 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %3
12: ; preds = %3
ret void
}

LLVM IR (-O2):
@.str = [37 x i8] c"The reading from light sensor is %d\0A\00"
define void @lightDetection() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 @msleep(i32 50)
%3 = tail call i32 @analog10(i32 0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = icmp sgt i32 %3, 512
br i1 %5, label %1, label %6
6: ; preds = %1
ret void
}
/* Type definitions */
typedef int __u8;

/* Variables and functions */
int ethtool_validate_duplex(__u8 duplex) {
  switch (duplex) {
  case 0x00:
  case 0x01:
  case 0xff:
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<ethtool_validate_duplex>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x2,%eax
jb     112e <ethtool_validate_duplex+0x2e>
jmp    111b <ethtool_validate_duplex+0x1b>
mov    -0xc(%rbp),%eax
sub    $0xff,%eax
jne    113a <ethtool_validate_duplex+0x3a>
jmp    112e <ethtool_validate_duplex+0x2e>
movl   $0x1,-0x4(%rbp)
jmp    1141 <ethtool_validate_duplex+0x41>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ethtool_validate_duplex>:
mov    $0x1,%eax
cmp    $0x2,%edi
jb     1114 <ethtool_validate_duplex+0x14>
cmp    $0xff,%edi
je     1114 <ethtool_validate_duplex+0x14>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @ethtool_validate_duplex(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %6 [
i32 0, label %5
i32 1, label %5
i32 255, label %5
]
5: ; preds = %1, %1, %1
store i32 1, i32* %2
br label %7
6: ; preds = %1
store i32 0, i32* %2
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %2
ret i32 %8
}

LLVM IR (-O2):
define i32 @ethtool_validate_duplex(i32 %0) {
switch i32 %0, label %2 [
i32 0, label %3
i32 1, label %3
i32 255, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %2
%4 = phi i32 [ 0, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %4
}
int test_imm_23uint16_mem(unsigned short *val) {
  return ((*val) & (0x23 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_23uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 35
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
main() {
  int i, a, b;
  i = 10;
  a = 2;
  b = 3;
  printf(b);
  printf(b);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xa,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
movl   $0x3,-0xc(%rbp)
movslq -0xc(%rbp),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0xc(%rbp),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 10, i32* %1
store i32 2, i32* %2
store i32 3, i32* %3
%4 = load i32, i32* %3
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i8*
%7 = call i32 (i8*, ...) @printf(i8* %6)
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i8*
%11 = call i32 (i8*, ...) @printf(i8* %10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* inttoptr (i64 3 to i8*))
%2 = tail call i32 (i8*, ...) @printf(i8* inttoptr (i64 3 to i8*))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ write_src(char *);
void bitor_handler(void) {
  write_src("{\n");
  write_src("imm_t b = POP();\n");
  write_src("imm_t a = POP();\n");
  write_src("PUSH(a|b);\n");
  write_src("}\n");
}


x86 assembly (clang, -O0):
<bitor_handler>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <write_src@plt>
lea    0xedc(%rip),%rdi
call   1030 <write_src@plt>
lea    0xee2(%rip),%rdi
call   1030 <write_src@plt>
lea    0xee8(%rip),%rdi
call   1030 <write_src@plt>
lea    0xee8(%rip),%rdi
call   1030 <write_src@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitor_handler>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <write_src@plt>
lea    0xedf(%rip),%rdi
call   1030 <write_src@plt>
lea    0xee5(%rip),%rdi
call   1030 <write_src@plt>
lea    0xeeb(%rip),%rdi
call   1030 <write_src@plt>
lea    0xeeb(%rip),%rdi
pop    %rax
jmp    1030 <write_src@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"{\0A\00"
@.str.1 = [18 x i8] c"imm_t b = POP();\0A\00"
@.str.2 = [18 x i8] c"imm_t a = POP();\0A\00"
@.str.3 = [12 x i8] c"PUSH(a|b);\0A\00"
@.str.4 = [3 x i8] c"}\0A\00"
define void @bitor_handler() {
%1 = call i32 @write_src(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @write_src(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @write_src(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @write_src(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @write_src(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"{\0A\00"
@.str.1 = [18 x i8] c"imm_t b = POP();\0A\00"
@.str.2 = [18 x i8] c"imm_t a = POP();\0A\00"
@.str.3 = [12 x i8] c"PUSH(a|b);\0A\00"
@.str.4 = [3 x i8] c"}\0A\00"
define void @bitor_handler() {
%1 = tail call i32 @write_src(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @write_src(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @write_src(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @write_src(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 @write_src(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
ret void
}
/* Variables and functions */
float fmod(float, float);
float call_fmod(float x, float y) { return fmod((float)x, (float)y); }


x86 assembly (clang, -O0):
<call_fmod>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1030 <fmod@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_fmod>:
jmp    1030 <fmod@plt>

LLVM IR (-O0):
define float @call_fmod(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = call float @fmod(float %5, float %6)
ret float %7
}

LLVM IR (-O2):
define float @call_fmod(float %0, float %1) {
%3 = tail call float @fmod(float %0, float %1)
ret float %3
}
void GLUE_MOVE_STACK(void *b, int amt) {
  ((unsigned char *)b)[0] = 0x81;
  if (amt < 0) {
    ((unsigned char *)b)[1] = 0xEC;
    *(int *)((char *)b + 2) = -amt;
  } else {
    ((unsigned char *)b)[1] = 0xc4;
    *(int *)((char *)b + 2) = amt;
  }
}


x86 assembly (clang, -O0):
<GLUE_MOVE_STACK>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x81,(%rax)
cmpl   $0x0,-0xc(%rbp)
jge    1135 <GLUE_MOVE_STACK+0x35>
mov    -0x8(%rbp),%rax
movb   $0xec,0x1(%rax)
xor    %ecx,%ecx
sub    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x2(%rax)
jmp    1147 <GLUE_MOVE_STACK+0x47>
mov    -0x8(%rbp),%rax
movb   $0xc4,0x1(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x2(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<GLUE_MOVE_STACK>:
movb   $0x81,(%rdi)
test   %esi,%esi
js     110f <GLUE_MOVE_STACK+0xf>
movb   $0xc4,0x1(%rdi)
mov    %esi,0x2(%rdi)
ret
movb   $0xec,0x1(%rdi)
neg    %esi
mov    %esi,0x2(%rdi)
ret

LLVM IR (-O0):
define void @GLUE_MOVE_STACK(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 = getelementptr inbounds i8, i8* %5, i64 0
store i8 -127, i8* %6
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 1
store i8 -20, i8* %11
%12 = load i32, i32* %4
%13 = sub nsw i32 0, %12
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i64 2
%16 = bitcast i8* %15 to i32*
store i32 %13, i32* %16
br label %24
17: ; preds = %2
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i64 1
store i8 -60, i8* %19
%20 = load i32, i32* %4
%21 = load i8*, i8** %3
%22 = getelementptr inbounds i8, i8* %21, i64 2
%23 = bitcast i8* %22 to i32*
store i32 %20, i32* %23
br label %24
24: ; preds = %17, %9
ret void
}

LLVM IR (-O2):
define void @GLUE_MOVE_STACK(i8* nocapture writeonly %0, i32 %1) {
store i8 -127, i8* %0
%3 = icmp slt i32 %1, 0
%4 = getelementptr inbounds i8, i8* %0, i64 1
br i1 %3, label %5, label %7
5: ; preds = %2
store i8 -20, i8* %4
%6 = sub nsw i32 0, %1
br label %8
7: ; preds = %2
store i8 -60, i8* %4
br label %8
8: ; preds = %7, %5
%9 = phi i32 [ %1, %7 ], [ %6, %5 ]
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = bitcast i8* %10 to i32*
store i32 %9, i32* %11
ret void
}
/* Type definitions */
struct ond {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int balance(struct ond **cur_ond_map) {
  printf("Sorry, not implemented ;(\n");
  return 0;
}


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

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

LLVM IR (-O0):
%struct.ond = type { i32 }
@.str = [27 x i8] c"Sorry, not implemented ;(\0A\00"
define i32 @balance(%struct.ond** %0) {
%2 = alloca %struct.ond**
store %struct.ond** %0, %struct.ond*** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.ond = type { i32 }
@str = [26 x i8] c"Sorry, not implemented ;(\00"
define i32 @balance(%struct.ond** nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int _strlen(char *);
int test_palindrome(char *, char *);
int is_palindrome(char *s) {
  int le = _strlen(s) - 1;
  return (test_palindrome(s, s + le));
}


x86 assembly (clang, -O0):
<is_palindrome>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <_strlen@plt>
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
add    %rax,%rsi
call   1040 <test_palindrome@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_palindrome>:
push   %rbx
mov    %rdi,%rbx
call   1030 <_strlen@plt>
cltq
lea    (%rax,%rbx,1),%rsi
add    $0xffffffffffffffff,%rsi
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <test_palindrome@plt>

LLVM IR (-O0):
define i32 @is_palindrome(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @_strlen(i8* %4)
%6 = sub nsw i32 %5, 1
store i32 %6, i32* %3
%7 = load i8*, i8** %2
%8 = load i8*, i8** %2
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = call i32 @test_palindrome(i8* %7, i8* %11)
ret i32 %12
}

LLVM IR (-O2):
define i32 @is_palindrome(i8* %0) {
%2 = tail call i32 @_strlen(i8* %0)
%3 = add nsw i32 %2, -1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = tail call i32 @test_palindrome(i8* %0, i8* %5)
ret i32 %6
}
/* Variables and functions */
size_t least_power_of_2_gt_in(size_t x, size_t size) {
  x &= -size;
  return x & -x;
}


x86 assembly (clang, -O0):
<least_power_of_2_gt_in>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
sub    -0x10(%rbp),%rax
and    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
sub    -0x8(%rbp),%rcx
and    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<least_power_of_2_gt_in>:
neg    %rsi
and    %rdi,%rsi
mov    %rsi,%rax
neg    %rax
and    %rsi,%rax
ret

LLVM IR (-O0):
define i64 @least_power_of_2_gt_in(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = sub i64 0, %5
%7 = load i64, i64* %3
%8 = and i64 %7, %6
store i64 %8, i64* %3
%9 = load i64, i64* %3
%10 = load i64, i64* %3
%11 = sub i64 0, %10
%12 = and i64 %9, %11
ret i64 %12
}

LLVM IR (-O2):
define i64 @least_power_of_2_gt_in(i64 %0, i64 %1) {
%3 = sub i64 0, %1
%4 = and i64 %3, %0
%5 = sub i64 0, %4
%6 = and i64 %4, %5
ret i64 %6
}
int sgn(int a) {
  if (a == 0)
    return 0;
  else if (a < 0)
    return -1;
  else
    return 1;
}


x86 assembly (clang, -O0):
<sgn>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    111d <sgn+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    113a <sgn+0x3a>
cmpl   $0x0,-0x8(%rbp)
jge    1133 <sgn+0x33>
movl   $0xffffffff,-0x4(%rbp)
jmp    113a <sgn+0x3a>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sgn>:
mov    %edi,%eax
sar    $0x1f,%eax
or     $0x1,%eax
test   %edi,%edi
cmove  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @sgn(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = icmp sgt i32 %0, -1
%4 = select i1 %3, i32 1, i32 -1
%5 = select i1 %2, i32 0, i32 %4
ret i32 %5
}
/* Type definitions */
typedef int gid_t;

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
gid_t __getgid(void) {
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<__getgid>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__getgid>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
define i32 @__getgid() {
%1 = load i32, i32* @ENOSYS
%2 = call i32 @__set_errno(i32 %1)
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
define i32 @__getgid() {
%1 = load i32, i32* @ENOSYS
%2 = tail call i32 @__set_errno(i32 %1)
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, unsigned long long);
int /*<<< orphan*/ stdout;
void ullsay(unsigned long long int i) {
  printf("%llu ", i);
  fflush(stdout);
}


x86 assembly (clang, -O0):
<ullsay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ullsay>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%llu \00"
@stdout = global i32 0
define void @ullsay(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 %3)
%5 = load i32, i32* @stdout
%6 = call i32 @fflush(i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%llu \00"
@stdout = global i32 0
define void @ullsay(i64 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 %0)
%3 = load i32, i32* @stdout
%4 = tail call i32 @fflush(i32 %3)
ret void
}
/* Type definitions */
struct pollfd {
  int dummy;
};

/* Variables and functions */
int poll(struct pollfd *, int, int);
int metautils_syscall_poll(struct pollfd *fds, int nfds, int timeout) {
  return poll(fds, nfds, timeout);
}


x86 assembly (clang, -O0):
<metautils_syscall_poll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%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 <poll@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<metautils_syscall_poll>:
jmp    1030 <poll@plt>

LLVM IR (-O0):
%struct.pollfd = type { i32 }
define i32 @metautils_syscall_poll(%struct.pollfd* %0, i32 %1, i32 %2) {
%4 = alloca %struct.pollfd*
%5 = alloca i32
%6 = alloca i32
store %struct.pollfd* %0, %struct.pollfd** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load %struct.pollfd*, %struct.pollfd** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @poll(%struct.pollfd* %7, i32 %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
%struct.pollfd = type { i32 }
define i32 @metautils_syscall_poll(%struct.pollfd* %0, i32 %1, i32 %2) {
%4 = tail call i32 @poll(%struct.pollfd* %0, i32 %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ abort();
main() {
  if (1 && 0 || 0)
    abort();
  if (0 && 1 || 0)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void disp_name(void *item_data) { printf(" %s\n", (char *)item_data); }


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

x86 assembly (clang, -O2):
<disp_name>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c" %s\0A\00"
define void @disp_name(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ checkCparams(int);
int /*<<< orphan*/ luaD_checkstack(int);
int /*<<< orphan*/ luaS_new(char *);
int /*<<< orphan*/ luaV_setglobal(int /*<<< orphan*/);
void lua_setglobal(char *name) {
  checkCparams(1);
  luaD_checkstack(2);
  luaV_setglobal(luaS_new(name));
}


x86 assembly (clang, -O0):
<lua_setglobal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%edi
call   1030 <checkCparams@plt>
mov    $0x2,%edi
call   1050 <luaD_checkstack@plt>
mov    -0x8(%rbp),%rdi
call   1060 <luaS_new@plt>
mov    %eax,%edi
call   1040 <luaV_setglobal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lua_setglobal>:
push   %rbx
mov    %rdi,%rbx
mov    $0x1,%edi
call   1030 <checkCparams@plt>
mov    $0x2,%edi
call   1050 <luaD_checkstack@plt>
mov    %rbx,%rdi
call   1060 <luaS_new@plt>
mov    %eax,%edi
pop    %rbx
jmp    1040 <luaV_setglobal@plt>

LLVM IR (-O0):
define void @lua_setglobal(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @checkCparams(i32 1)
%4 = call i32 @luaD_checkstack(i32 2)
%5 = load i8*, i8** %2
%6 = call i32 @luaS_new(i8* %5)
%7 = call i32 @luaV_setglobal(i32 %6)
ret void
}

LLVM IR (-O2):
define void @lua_setglobal(i8* %0) {
%2 = tail call i32 @checkCparams(i32 1)
%3 = tail call i32 @luaD_checkstack(i32 2)
%4 = tail call i32 @luaS_new(i8* %0)
%5 = tail call i32 @luaV_setglobal(i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned char);
int /*<<< orphan*/ testthis(unsigned char *);
main() {
  unsigned char x = 43;
  testthis(&x);
  printf("%d\n", x);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x2b,-0x1(%rbp)
lea    -0x1(%rbp),%rdi
call   1030 <testthis@plt>
lea    0xec4(%rip),%rdi
movzbl -0x1(%rbp),%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movb   $0x2b,0x7(%rsp)
lea    0x7(%rsp),%rdi
call   1030 <testthis@plt>
movzbl 0x7(%rsp),%esi
lea    0xec4(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i8
store i8 43, i8* %1
%2 = call i32 @testthis(i8* %1)
%3 = load i8, i8* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 zeroext %3)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i8
store i8 43, i8* %1
%2 = call i32 @testthis(i8* %1)
%3 = load i8, i8* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 zeroext %3)
ret i32 0
}
/* Variables and functions */
scalar_t__ strcmp(char *, void *);
int check_removedslice(size_t *idx, size_t *end, void *item, void *strings) {
  return strcmp(((char **)strings)[*idx + 2 * (size_t)(*idx >= 2)], item) != 0;
  (void)end;
}


x86 assembly (clang, -O0):
<check_removedslice>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rcx
mov    -0x8(%rbp),%rdx
cmpq   $0x2,(%rdx)
setae  %dl
and    $0x1,%dl
movzbl %dl,%edx
movslq %edx,%rdx
shl    $0x1,%rdx
add    %rdx,%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_removedslice>:
push   %rax
mov    (%rdi),%rax
xor    %esi,%esi
cmp    $0x2,%rax
setae  %sil
lea    (%rax,%rsi,2),%rax
mov    (%rcx,%rax,8),%rdi
mov    %rdx,%rsi
call   1030 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @check_removedslice(i64* %0, i64* %1, i8* %2, i8* %3) {
%5 = alloca i64*
%6 = alloca i64*
%7 = alloca i8*
%8 = alloca i8*
store i64* %0, i64** %5
store i64* %1, i64** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %8
%10 = bitcast i8* %9 to i8**
%11 = load i64*, i64** %5
%12 = load i64, i64* %11
%13 = load i64*, i64** %5
%14 = load i64, i64* %13
%15 = icmp uge i64 %14, 2
%16 = zext i1 %15 to i32
%17 = sext i32 %16 to i64
%18 = mul i64 2, %17
%19 = add i64 %12, %18
%20 = getelementptr inbounds i8*, i8** %10, i64 %19
%21 = load i8*, i8** %20
%22 = load i8*, i8** %7
%23 = call i64 @strcmp(i8* %21, i8* %22)
%24 = icmp ne i64 %23, 0
%25 = zext i1 %24 to i32
ret i32 %25
}

LLVM IR (-O2):
define i32 @check_removedslice(i64* nocapture %0, i64* nocapture readnone %1, i8* %2, i8* nocapture %3) {
%5 = bitcast i8* %3 to i8**
%6 = load i64, i64* %0
%7 = icmp ult i64 %6, 2
%8 = select i1 %7, i64 0, i64 2
%9 = add i64 %8, %6
%10 = getelementptr inbounds i8*, i8** %5, i64 %9
%11 = load i8*, i8** %10
%12 = tail call i64 @strcmp(i8* %11, i8* %2)
%13 = icmp ne i64 %12, 0
%14 = zext i1 %13 to i32
ret i32 %14
}
const char *t2s(const char ch) {
  switch (ch) {
  case 'f':
    return "file";
  case 'd':
    return "directory";
  case 'm':
    return "mountpoint";
  }
  return "unknown";
}


x86 assembly (clang, -O0):
<t2s>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x64,%eax
je     1151 <t2s+0x51>
jmp    111f <t2s+0x1f>
mov    -0x10(%rbp),%eax
sub    $0x66,%eax
je     1141 <t2s+0x41>
jmp    1130 <t2s+0x30>
mov    -0x10(%rbp),%eax
sub    $0x6d,%eax
je     1161 <t2s+0x61>
jmp    1171 <t2s+0x71>
lea    0xeb8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117c <t2s+0x7c>
lea    0xead(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117c <t2s+0x7c>
lea    0xea7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117c <t2s+0x7c>
lea    0xea2(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<t2s>:
cmp    $0x6d,%edi
je     1117 <t2s+0x17>
cmp    $0x66,%edi
je     111f <t2s+0x1f>
cmp    $0x64,%edi
jne    1127 <t2s+0x27>
lea    0xeef(%rip),%rax
ret
lea    0xef1(%rip),%rax
ret
lea    0xeda(%rip),%rax
ret
lea    0xeec(%rip),%rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"file\00"
@.str.1 = [10 x i8] c"directory\00"
@.str.2 = [11 x i8] c"mountpoint\00"
@.str.3 = [8 x i8] c"unknown\00"
define i8* @t2s(i8 signext %0) {
%2 = alloca i8*
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %9 [
i32 102, label %6
i32 100, label %7
i32 109, label %8
]
6: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %2
br label %10
7: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %10
8: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %10
9: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %10
10: ; preds = %9, %8, %7, %6
%11 = load i8*, i8** %2
ret i8* %11
}

LLVM IR (-O2):
@.str = [5 x i8] c"file\00"
@.str.1 = [10 x i8] c"directory\00"
@.str.2 = [11 x i8] c"mountpoint\00"
@.str.3 = [8 x i8] c"unknown\00"
define i8* @t2s(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %5 [
i32 102, label %6
i32 100, label %3
i32 109, label %4
]
3: ; preds = %1
br label %6
4: ; preds = %1
br label %6
5: ; preds = %1
br label %6
6: ; preds = %1, %5, %4, %3
%7 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), %5 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), %4 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), %3 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %7
}