xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void die(void) {
  perror("Whoops!");
  exit(1);
}


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"Whoops!\00"
define void @die() {
%1 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [8 x i8] c"Whoops!\00"
define void @die() {
%1 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ print_hex(int);
void main(void) {
  int j;
  j = 5;
  print_hex(j & 4);
  j = j | 19;
  print_hex(j);
  print_hex(j ^ 37);
  print_hex(~j);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x5,-0x4(%rbp)
mov    -0x4(%rbp),%edi
and    $0x4,%edi
call   1030 <print_hex@plt>
mov    -0x4(%rbp),%eax
or     $0x13,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <print_hex@plt>
mov    -0x4(%rbp),%edi
xor    $0x25,%edi
call   1030 <print_hex@plt>
mov    -0x4(%rbp),%edi
xor    $0xffffffff,%edi
call   1030 <print_hex@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x4,%edi
call   1030 <print_hex@plt>
mov    $0x17,%edi
call   1030 <print_hex@plt>
mov    $0x32,%edi
call   1030 <print_hex@plt>
mov    $0xffffffe8,%edi
pop    %rax
jmp    1030 <print_hex@plt>

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
store i32 5, i32* %1
%2 = load i32, i32* %1
%3 = and i32 %2, 4
%4 = call i32 @print_hex(i32 %3)
%5 = load i32, i32* %1
%6 = or i32 %5, 19
store i32 %6, i32* %1
%7 = load i32, i32* %1
%8 = call i32 @print_hex(i32 %7)
%9 = load i32, i32* %1
%10 = xor i32 %9, 37
%11 = call i32 @print_hex(i32 %10)
%12 = load i32, i32* %1
%13 = xor i32 %12, -1
%14 = call i32 @print_hex(i32 %13)
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 @print_hex(i32 4)
%2 = tail call i32 @print_hex(i32 23)
%3 = tail call i32 @print_hex(i32 50)
%4 = tail call i32 @print_hex(i32 -24)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ backC(unsigned int, unsigned int);
void back_mm(unsigned int speed, unsigned int distance_mm) {
  backC(speed, distance_mm * 4);
}


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

x86 assembly (clang, -O2):
<back_mm>:
shl    $0x2,%esi
jmp    1030 <backC@plt>

LLVM IR (-O0):
define void @back_mm(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = mul i32 %6, 4
%8 = call i32 @backC(i32 %5, i32 %7)
ret void
}

LLVM IR (-O2):
define void @back_mm(i32 %0, i32 %1) {
%3 = shl i32 %1, 2
%4 = tail call i32 @backC(i32 %0, i32 %3)
ret void
}
void *join(void *left, void *right) {
  ((long *)left)[-2] += ((long *)right)[-2] + 8;
  return left;
}


x86 assembly (clang, -O0):
<join>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x10(%rax),%rcx
add    $0x8,%rcx
mov    -0x8(%rbp),%rax
add    -0x10(%rax),%rcx
mov    %rcx,-0x10(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<join>:
mov    %rdi,%rax
mov    -0x10(%rsi),%rcx
mov    -0x10(%rdi),%rdx
add    %rdx,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rdi)
ret

LLVM IR (-O0):
define i8* @join(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = bitcast i8* %5 to i64*
%7 = getelementptr inbounds i64, i64* %6, i64 -2
%8 = load i64, i64* %7
%9 = add nsw i64 %8, 8
%10 = load i8*, i8** %3
%11 = bitcast i8* %10 to i64*
%12 = getelementptr inbounds i64, i64* %11, i64 -2
%13 = load i64, i64* %12
%14 = add nsw i64 %13, %9
store i64 %14, i64* %12
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
define i8* @join(i8* returned %0, i8* nocapture %1) {
%3 = getelementptr inbounds i8, i8* %1, i64 -16
%4 = bitcast i8* %3 to i64*
%5 = load i64, i64* %4
%6 = add nsw i64 %5, 8
%7 = getelementptr inbounds i8, i8* %0, i64 -16
%8 = bitcast i8* %7 to i64*
%9 = load i64, i64* %8
%10 = add nsw i64 %6, %9
store i64 %10, i64* %8
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ asin(double);
long double sinl(int /*<<< orphan*/);
long double sinasin(double x) { return (sinl(asin(x))); }


x86 assembly (clang, -O0):
<sinasin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <asin@plt>
mov    %eax,%edi
call   1030 <sinl@plt>
fld    %st(0)
fstp   %st(0)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sinasin>:
push   %rax
call   1040 <asin@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <sinl@plt>

LLVM IR (-O0):
define x86_fp80 @sinasin(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @asin(double %3)
%5 = call x86_fp80 @sinl(i32 %4)
ret x86_fp80 %5
}

LLVM IR (-O2):
define x86_fp80 @sinasin(double %0) {
%2 = tail call i32 @asin(double %0)
%3 = tail call x86_fp80 @sinl(i32 %2)
ret x86_fp80 %3
}
void ll_free_nothing(void *ud, void *ptr) {}


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

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

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

LLVM IR (-O2):
define void @ll_free_nothing(i8* nocapture %0, i8* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fs_logger(char *);
int /*<<< orphan*/ mkdir_attr(char *, int, int /*<<< orphan*/,
                              int /*<<< orphan*/);
void empty_dev_shm(void) {
  mkdir_attr("/dev/shm", 01777, 0, 0);
  fs_logger("mkdir /dev/shm");
  fs_logger("create /dev/shm");
}


x86 assembly (clang, -O0):
<empty_dev_shm>:
push   %rbp
mov    %rsp,%rbp
lea    0xeeb(%rip),%rdi
mov    $0x3ff,%esi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1040 <mkdir_attr@plt>
lea    0xec0(%rip),%rdi
call   1030 <fs_logger@plt>
lea    0xec3(%rip),%rdi
call   1030 <fs_logger@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<empty_dev_shm>:
push   %rax
lea    0xeee(%rip),%rdi
mov    $0x3ff,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1040 <mkdir_attr@plt>
lea    0xec3(%rip),%rdi
call   1030 <fs_logger@plt>
lea    0xec6(%rip),%rdi
pop    %rax
jmp    1030 <fs_logger@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"/dev/shm\00"
@.str.1 = [15 x i8] c"mkdir /dev/shm\00"
@.str.2 = [16 x i8] c"create /dev/shm\00"
define void @empty_dev_shm() {
%1 = call i32 @mkdir_attr(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 1023, i32 0, i32 0)
%2 = call i32 @fs_logger(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @fs_logger(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"/dev/shm\00"
@.str.1 = [15 x i8] c"mkdir /dev/shm\00"
@.str.2 = [16 x i8] c"create /dev/shm\00"
define void @empty_dev_shm() {
%1 = tail call i32 @mkdir_attr(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 1023, i32 0, i32 0)
%2 = tail call i32 @fs_logger(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @fs_logger(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

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


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

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

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

LLVM IR (-O2):
define void @sequence_show_stats(i32* nocapture %0) {
ret void
}
long long bit08() { return 0x0000000000000100LL; }


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

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

LLVM IR (-O0):
define i64 @bit08() {
ret i64 256
}

LLVM IR (-O2):
define i64 @bit08() {
ret i64 256
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
unsigned int setbits(unsigned int, int, int, unsigned int);
int main(int argc, char *argv[]) {
  unsigned int x = 0xFFFFFFFF;
  unsigned int y = 0x00FF0052;
  x = setbits(x, 7, 4, y);
  printf("x = %x\n", x);
  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)
movl   $0xffffffff,-0x14(%rbp)
movl   $0xff0052,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%ecx
mov    $0x7,%esi
mov    $0x4,%edx
call   1040 <setbits@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xffffffff,%edi
mov    $0x7,%esi
mov    $0x4,%edx
mov    $0xff0052,%ecx
call   1040 <setbits@plt>
lea    0xebf(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"x = %x\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -1, i32* %6
store i32 16711762, i32* %7
%8 = load i32, i32* %6
%9 = load i32, i32* %7
%10 = call i32 @setbits(i32 %8, i32 7, i32 4, i32 %9)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"x = %x\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @setbits(i32 -1, i32 7, i32 4, i32 16711762)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
int clflush(void *buffer, unsigned long long size) {
  unsigned long long addr, passes, linesize;
  addr = (unsigned long long)buffer;
  linesize = 64;
  __asm__ __volatile__("mfence;" ::);
  for (passes = (size / linesize); passes > 0; passes--) {
    __asm__ __volatile__("clflush (%%rax);" ::"a"(addr));
    addr += linesize;
  }
  __asm__ __volatile__("mfence;" ::);
  return 0;
}


x86 assembly (clang, -O0):
<clflush>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movq   $0x40,-0x28(%rbp)
mfence
mov    -0x10(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x28(%rbp)
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jbe    115e <clflush+0x5e>
mov    -0x18(%rbp),%rax
clflush (%rax)
mov    -0x28(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
jmp    112f <clflush+0x2f>
mfence
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clflush>:
mfence
cmp    $0x40,%rsi
jb     111d <clflush+0x1d>
mov    %rdi,%rax
shr    $0x6,%rsi
clflush (%rax)
add    $0x40,%rax
add    $0xffffffffffffffff,%rsi
jne    1110 <clflush+0x10>
mfence
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @clflush(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%8 = load i8*, i8** %3
%9 = ptrtoint i8* %8 to i64
store i64 %9, i64* %5
store i64 64, i64* %7
%10 = load i64, i64* %4
%11 = load i64, i64* %7
%12 = udiv i64 %10, %11
store i64 %12, i64* %6
br label %13
13: ; preds = %21, %2
%14 = load i64, i64* %6
%15 = icmp ugt i64 %14, 0
br i1 %15, label %16, label %24
16: ; preds = %13
%17 = load i64, i64* %5
%18 = load i64, i64* %7
%19 = load i64, i64* %5
%20 = add i64 %19, %18
store i64 %20, i64* %5
br label %21
21: ; preds = %16
%22 = load i64, i64* %6
%23 = add i64 %22, -1
store i64 %23, i64* %6
br label %13
24: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
define i32 @clflush(i8* %0, i64 %1) {
tail call void asm sideeffect "mfence;", "~{dirflag},~{fpsr},~{flags}"()
%3 = icmp ult i64 %1, 64
br i1 %3, label %13, label %4
4: ; preds = %2
%5 = lshr i64 %1, 6
%6 = ptrtoint i8* %0 to i64
br label %7
7: ; preds = %4, %7
%8 = phi i64 [ %10, %7 ], [ %6, %4 ]
%9 = phi i64 [ %11, %7 ], [ %5, %4 ]
tail call void asm sideeffect "clflush (%rax);", "{ax},~{dirflag},~{fpsr},~{flags}"(i64 %8)
%10 = add i64 %8, 64
%11 = add nsw i64 %9, -1
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %7
13: ; preds = %7, %2
tail call void asm sideeffect "mfence;", "~{dirflag},~{fpsr},~{flags}"()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ ft_memdel(void **);
int free_line(char **line, int ret) {
  if (*line)
    ft_memdel((void **)line);
  return (ret);
}


x86 assembly (clang, -O0):
<free_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1136 <free_line+0x26>
mov    -0x8(%rbp),%rdi
call   1030 <ft_memdel@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_line>:
push   %rbx
mov    %esi,%ebx
cmpq   $0x0,(%rdi)
je     111e <free_line+0xe>
call   1030 <ft_memdel@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @free_line(i8** %0, i32 returned %1) {
%3 = load i8*, i8** %0
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @ft_memdel(i8** %0)
br label %7
7: ; preds = %5, %2
ret i32 %1
}
/* Type definitions */
struct wl_touch {
  int dummy;
};
struct wl_proxy {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ wl_proxy_destroy(struct wl_proxy *);
void wl_touch_destroy(struct wl_touch *wl_touch) {
  wl_proxy_destroy((struct wl_proxy *)wl_touch);
}


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

x86 assembly (clang, -O2):
<wl_touch_destroy>:
jmp    1030 <wl_proxy_destroy@plt>

LLVM IR (-O0):
%struct.wl_touch = type { i32 }
%struct.wl_proxy = type { i32 }
define void @wl_touch_destroy(%struct.wl_touch* %0) {
%2 = alloca %struct.wl_touch*
store %struct.wl_touch* %0, %struct.wl_touch** %2
%3 = load %struct.wl_touch*, %struct.wl_touch** %2
%4 = bitcast %struct.wl_touch* %3 to %struct.wl_proxy*
%5 = call i32 @wl_proxy_destroy(%struct.wl_proxy* %4)
ret void
}

LLVM IR (-O2):
%struct.wl_touch = type { i32 }
%struct.wl_proxy = type { i32 }
define void @wl_touch_destroy(%struct.wl_touch* %0) {
%2 = bitcast %struct.wl_touch* %0 to %struct.wl_proxy*
%3 = tail call i32 @wl_proxy_destroy(%struct.wl_proxy* %2)
ret void
}
/* Variables and functions */
void *tf(void *arg) { return NULL; }


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

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

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

LLVM IR (-O2):
define noalias i8* @tf(i8* nocapture readnone %0) {
ret i8* null
}
void __attribute__((preserve_all)) typedef_fun_boo(int x) {}


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

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

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

LLVM IR (-O2):
define preserve_allcc void @typedef_fun_boo(i32 %0) {
ret void
}
/* Variables and functions */
unsigned int _cdio_ceil2block(unsigned int, int);
unsigned _cdio_ofs_add(unsigned offset, unsigned length, int blocksize) {
  if (blocksize - (offset % blocksize) < length)
    offset = _cdio_ceil2block(offset, blocksize);
  offset += length;
  return offset;
}


x86 assembly (clang, -O0):
<_cdio_ofs_add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
xor    %edx,%edx
divl   -0xc(%rbp)
mov    -0x10(%rbp),%eax
sub    %edx,%eax
cmp    -0x8(%rbp),%eax
jae    114b <_cdio_ofs_add+0x3b>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <_cdio_ceil2block@plt>
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_cdio_ofs_add>:
push   %rbx
mov    %edx,%ecx
mov    %esi,%ebx
mov    %edi,%eax
xor    %edx,%edx
div    %ecx
mov    %ecx,%eax
sub    %edx,%eax
cmp    %esi,%eax
jae    112c <_cdio_ofs_add+0x1c>
mov    %ecx,%esi
call   1030 <_cdio_ceil2block@plt>
mov    %eax,%edi
add    %ebx,%edi
mov    %edi,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @_cdio_ofs_add(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* %6
%8 = load i32, i32* %4
%9 = load i32, i32* %6
%10 = urem i32 %8, %9
%11 = sub i32 %7, %10
%12 = load i32, i32* %5
%13 = icmp ult i32 %11, %12
br i1 %13, label %14, label %18
14: ; preds = %3
%15 = load i32, i32* %4
%16 = load i32, i32* %6
%17 = call i32 @_cdio_ceil2block(i32 %15, i32 %16)
store i32 %17, i32* %4
br label %18
18: ; preds = %14, %3
%19 = load i32, i32* %5
%20 = load i32, i32* %4
%21 = add i32 %20, %19
store i32 %21, i32* %4
%22 = load i32, i32* %4
ret i32 %22
}

LLVM IR (-O2):
define i32 @_cdio_ofs_add(i32 %0, i32 %1, i32 %2) {
%4 = urem i32 %0, %2
%5 = sub i32 %2, %4
%6 = icmp ult i32 %5, %1
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 @_cdio_ceil2block(i32 %0, i32 %2)
br label %9
9: ; preds = %7, %3
%10 = phi i32 [ %8, %7 ], [ %0, %3 ]
%11 = add i32 %10, %1
ret i32 %11
}
void test_isxdigit_macro(void) {
  int i, j;
  for (i = -127; i < 256;)
    j = i, printf("%s: %d -> %d\n", __FUNCTION__, j, isxdigit(i++) ? 1 : 0);
}


x86 assembly (clang, -O0):
<test_isxdigit_macro>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xffffff81,-0x4(%rbp)
cmpl   $0x100,-0x4(%rbp)
jge    1184 <test_isxdigit_macro+0x64>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
call   1040 <isxdigit@plt>
mov    -0xc(%rbp),%edx
mov    %eax,%esi
xor    %ecx,%ecx
mov    $0x1,%eax
cmp    $0x0,%esi
cmovne %eax,%ecx
lea    0xe8f(%rip),%rdi
lea    0xe96(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    112f <test_isxdigit_macro+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_isxdigit_macro>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0xffffff81,%ebx
lea    0xecd(%rip),%r14
lea    0xed4(%rip),%r15
nopw   0x0(%rax,%rax,1)
lea    0x1(%rbx),%ebp
mov    %ebx,%edi
call   1040 <isxdigit@plt>
xor    %ecx,%ecx
test   %eax,%eax
setne  %cl
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebp,%ebx
cmp    $0x100,%ebp
jne    1140 <test_isxdigit_macro+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"%s: %d -> %d\0A\00"
@__FUNCTION__.test_isxdigit_macro = [20 x i8] c"test_isxdigit_macro\00"
define void @test_isxdigit_macro() {
%1 = alloca i32
%2 = alloca i32
store i32 -127, i32* %1
br label %3
3: ; preds = %6, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 256
br i1 %5, label %6, label %16
6: ; preds = %3
%7 = load i32, i32* %1
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = load i32, i32* %1
%10 = add nsw i32 %9, 1
store i32 %10, i32* %1
%11 = call i32 @isxdigit(i32 %9)
%12 = icmp ne i32 %11, 0
%13 = zext i1 %12 to i64
%14 = select i1 %12, i32 1, i32 0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @__FUNCTION__.test_isxdigit_macro, i64 0, i64 0), i32 %8, i32 %14)
br label %3
16: ; preds = %3
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"%s: %d -> %d\0A\00"
@__FUNCTION__.test_isxdigit_macro = [20 x i8] c"test_isxdigit_macro\00"
define void @test_isxdigit_macro() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ -127, %0 ], [ %3, %1 ]
%3 = add nsw i32 %2, 1
%4 = tail call i32 @isxdigit(i32 %2)
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i32
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @__FUNCTION__.test_isxdigit_macro, i64 0, i64 0), i32 %2, i32 %6)
%8 = icmp eq i32 %3, 256
br i1 %8, label %9, label %1
9: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char, int, double);
int main(int argc, char *argv[]) {
  printf("character: %c\ninteger: %d\nfloating point: %f\n", '}', 34, 3.14);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xedb(%rip),%rdi
mov    $0x7d,%esi
mov    $0x22,%edx
movsd  0xec1(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef0(%rip),%rdi
movsd  0xee0(%rip),%xmm0
mov    $0x7d,%esi
mov    $0x22,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [46 x i8] c"character: %c\0Ainteger: %d\0Afloating point: %f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8 signext 125, i32 34, double 3.140000e+00)
ret i32 0
}

LLVM IR (-O2):
@.str = [46 x i8] c"character: %c\0Ainteger: %d\0Afloating point: %f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8 signext 125, i32 34, double 3.140000e+00)
ret i32 0
}
int peek(int descr) {
  asm volatile("movl %0, %%ebx" ::"m"(descr) : "%ebx");
  return syscall(9);
}


x86 assembly (clang, -O0):
<peek>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
push   %rax
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%ebx
mov    $0x9,%edi
mov    $0x0,%al
call   1030 <syscall@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<peek>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,0xc(%rsp)
mov    0xc(%rsp),%ebx
mov    $0x9,%edi
xor    %eax,%eax
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @peek(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (i32, ...) bitcast (i32 (...)* @syscall to i32 (i32, ...)*)(i32 9)
ret i32 %3
}

LLVM IR (-O2):
define i32 @peek(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (i32, ...) bitcast (i32 (...)* @syscall to i32 (i32, ...)*)(i32 9)
ret i32 %3
}
void __attribute__((always_)) shim_mfence(void) { __sync_synchronize(); }


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

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

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

LLVM IR (-O2):
define void @shim_mfence() {
fence seq_cst
ret void
}
/* Variables and functions */
void const *W_CacheLumpNum(int);
const void *W_LockLumpNum(int lump) { return W_CacheLumpNum(lump); }


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

x86 assembly (clang, -O2):
<W_LockLumpNum>:
jmp    1030 <W_CacheLumpNum@plt>

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

LLVM IR (-O2):
define i8* @W_LockLumpNum(i32 %0) {
%2 = tail call i8* @W_CacheLumpNum(i32 %0)
ret i8* %2
}
int test_imm_39uint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0x39 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_39uint64_highword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
shr    $0x20,%rdx
and    $0x39,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_39uint64_highword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 32
%6 = and i64 %5, 57
%7 = icmp ne i64 %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_39uint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 244813135872
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int cairo_code_draw_envOutLabel_get_width() { return 86; }


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

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

LLVM IR (-O0):
define i32 @cairo_code_draw_envOutLabel_get_width() {
ret i32 86
}

LLVM IR (-O2):
define i32 @cairo_code_draw_envOutLabel_get_width() {
ret i32 86
}
/* Variables and functions */
int /*<<< orphan*/ Menu();
void main() { Menu(); }


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

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

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

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @Menu()
ret void
}
void bar(void) { asm("bar_label: .globl bar_label"); }


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

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

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

LLVM IR (-O2):
define void @bar() {
tail call void asm sideeffect "bar_label: .globl bar_label", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
void dfn_ad(d) double d;
{}


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

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

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

LLVM IR (-O2):
define void @dfn_ad(double %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ io_printf(char *);
int /*<<< orphan*/ itoa(char *, int, int);
void io_print_o(int i) {
  char num[16];
  itoa(num, i, 8);
  io_printf(num);
}


x86 assembly (clang, -O0):
<io_print_o>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    $0x8,%edx
call   1040 <itoa@plt>
lea    -0x20(%rbp),%rdi
call   1030 <io_printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_print_o>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%esi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x8,%edx
call   1040 <itoa@plt>
mov    %rbx,%rdi
call   1030 <io_printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @io_print_o(i32 %0) {
%2 = alloca i32
%3 = alloca [16 x i8]
store i32 %0, i32* %2
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* %2
%6 = call i32 @itoa(i8* %4, i32 %5, i32 8)
%7 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%8 = call i32 @io_printf(i8* %7)
ret void
}

LLVM IR (-O2):
define void @io_print_o(i32 %0) {
%2 = alloca [16 x i8]
%3 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%4 = call i32 @itoa(i8* %3, i32 %0, i32 8)
%5 = call i32 @io_printf(i8* %3)
ret void
}
/* Variables and functions */
int add_obstacle(long *);
int add_Obs(long obs[2 * 10 + 1]) { return (add_obstacle(obs)); }


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

x86 assembly (clang, -O2):
<add_Obs>:
jmp    1030 <add_obstacle@plt>

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

LLVM IR (-O2):
define i32 @add_Obs(i64* %0) {
%2 = tail call i32 @add_obstacle(i64* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ LOG_ERR;
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, char *);
void log_syslog_error(char *msg) { syslog(LOG_ERR, "%s", msg); }


x86 assembly (clang, -O0):
<log_syslog_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <syslog@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_syslog_error>:
mov    %rdi,%rdx
mov    0x2ebe(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <syslog@plt>

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

LLVM IR (-O2):
@LOG_ERR = global i32 0
@.str = [3 x i8] c"%s\00"
define void @log_syslog_error(i8* %0) {
%2 = load i32, i32* @LOG_ERR
%3 = tail call i32 @syslog(i32 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int strlen(char *);
int main() { assert(strlen("asd") == 4); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <strlen@plt>
cmp    $0x4,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <strlen@plt>
xor    %edi,%edi
cmp    $0x4,%eax
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"asd\00"
define i32 @main() {
%1 = call i32 @strlen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 4
%3 = zext i1 %2 to i32
%4 = call i32 @assert(i32 %3)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"asd\00"
define i32 @main() {
%1 = tail call i32 @strlen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 4
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
ret i32 0
}
/* Type definitions */
struct h264_cabac_context {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct h264_cabac_context *);
void h264_cabac_destroy(struct h264_cabac_context *cabac) { free(cabac); }


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

x86 assembly (clang, -O2):
<h264_cabac_destroy>:
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.h264_cabac_context = type { i32 }
define void @h264_cabac_destroy(%struct.h264_cabac_context* %0) {
%2 = alloca %struct.h264_cabac_context*
store %struct.h264_cabac_context* %0, %struct.h264_cabac_context** %2
%3 = load %struct.h264_cabac_context*, %struct.h264_cabac_context** %2
%4 = call i32 @free(%struct.h264_cabac_context* %3)
ret void
}

LLVM IR (-O2):
%struct.h264_cabac_context = type { i32 }
define void @h264_cabac_destroy(%struct.h264_cabac_context* nocapture %0) {
%2 = tail call i32 @free(%struct.h264_cabac_context* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  char *name;
  double salary, vs, total;
  scanf("%s", &name);
  scanf("%lf%lf", &salary, &vs);
  total = vs * .15;
  printf("TOTAL = R$ %.2lf\n", total + salary);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xec3(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
movsd  0xea1(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xedd(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xecd(%rip),%rdi
lea    0x8(%rsp),%rsi
mov    %rsp,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
movsd  (%rsp),%xmm0
mulsd  0xea6(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [7 x i8] c"%lf%lf\00"
@.str.2 = [18 x i8] c"TOTAL = R$ %.2lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca double
%4 = alloca double
%5 = alloca double
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %2)
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double* %3, double* %4)
%8 = load double, double* %4
%9 = fmul double %8, 1.500000e-01
store double %9, double* %5
%10 = load double, double* %5
%11 = load double, double* %3
%12 = fadd double %10, %11
%13 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), double %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [7 x i8] c"%lf%lf\00"
@.str.2 = [18 x i8] c"TOTAL = R$ %.2lf\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca double
%3 = alloca double
%4 = bitcast i8** %1 to i8*
%5 = bitcast double* %2 to i8*
%6 = bitcast double* %3 to i8*
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %1)
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double* %2, double* %3)
%9 = load double, double* %3
%10 = fmul double %9, 1.500000e-01
%11 = load double, double* %2
%12 = fadd double %10, %11
%13 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), double %12)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ eoutput(int, char *, char const *);
void iml_warning(const char *message) { eoutput(-1, "Warning", message); }


x86 assembly (clang, -O0):
<iml_warning>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
mov    $0xffffffff,%edi
lea    0xed4(%rip),%rsi
call   1030 <eoutput@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iml_warning>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rsi
mov    $0xffffffff,%edi
jmp    1030 <eoutput@plt>

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

LLVM IR (-O2):
@.str = [8 x i8] c"Warning\00"
define void @iml_warning(i8* %0) {
%2 = tail call i32 @eoutput(i32 -1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
struct dirent {
  char *d_name;
};

/* Variables and functions */
int dirs_filter_hidden(const struct dirent *file) {
  if (file->d_name[0] == '.') {
    return 0;
  } else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<dirs_filter_hidden>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    1127 <dirs_filter_hidden+0x27>
movl   $0x0,-0x4(%rbp)
jmp    112e <dirs_filter_hidden+0x2e>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dirs_filter_hidden>:
mov    (%rdi),%rcx
xor    %eax,%eax
cmpb   $0x2e,(%rcx)
setne  %al
ret

LLVM IR (-O0):
%struct.dirent = type { i8* }
define i32 @dirs_filter_hidden(%struct.dirent* %0) {
%2 = alloca i32
%3 = alloca %struct.dirent*
store %struct.dirent* %0, %struct.dirent** %3
%4 = load %struct.dirent*, %struct.dirent** %3
%5 = getelementptr inbounds %struct.dirent, %struct.dirent* %4, i32 0, i32 0
%6 = load i8*, i8** %5
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 46
br i1 %10, label %11, label %12
11: ; preds = %1
store i32 0, i32* %2
br label %13
12: ; preds = %1
store i32 1, i32* %2
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
%struct.dirent = type { i8* }
define i32 @dirs_filter_hidden(%struct.dirent* nocapture %0) {
%2 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 0
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = icmp ne i8 %4, 46
%6 = zext i1 %5 to i32
ret i32 %6
}
double power(double a, int n) {
  if (n == 0)
    return 1;
  if (n == 1)
    return a;
  double t = power(a, n / 2);
  return t * t * power(a, n % 2);
}


x86 assembly (clang, -O0):
<power>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    113c <power+0x2c>
movsd  0xece(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11a8 <power+0x98>
cmpl   $0x1,-0x14(%rbp)
jne    1155 <power+0x45>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11a8 <power+0x98>
movsd  -0x10(%rbp),%xmm0
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <power@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
call   1030 <power@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<power>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
test   %edi,%edi
je     115b <power+0x4b>
mov    %edi,%ebx
cmp    $0x1,%edi
je     1163 <power+0x53>
mov    %ebx,%ebp
shr    $0x1f,%ebp
add    %ebx,%ebp
mov    %ebp,%edi
sar    %edi
movsd  %xmm0,0x8(%rsp)
call   1030 <power@plt>
mulsd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
and    $0xfffffffe,%ebp
sub    %ebp,%ebx
movsd  0x8(%rsp),%xmm0
mov    %ebx,%edi
call   1030 <power@plt>
mulsd  0x10(%rsp),%xmm0
jmp    1163 <power+0x53>
movsd  0xe9d(%rip),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @power(double %0, i32 %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca double
store double %0, double* %4
store i32 %1, i32* %5
%7 = load i32, i32* %5
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %2
store double 1.000000e+00, double* %3
br label %28
10: ; preds = %2
%11 = load i32, i32* %5
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = load double, double* %4
store double %14, double* %3
br label %28
15: ; preds = %10
%16 = load double, double* %4
%17 = load i32, i32* %5
%18 = sdiv i32 %17, 2
%19 = call double @power(double %16, i32 %18)
store double %19, double* %6
%20 = load double, double* %6
%21 = load double, double* %6
%22 = fmul double %20, %21
%23 = load double, double* %4
%24 = load i32, i32* %5
%25 = srem i32 %24, 2
%26 = call double @power(double %23, i32 %25)
%27 = fmul double %22, %26
store double %27, double* %3
br label %28
28: ; preds = %15, %13, %9
%29 = load double, double* %3
ret double %29
}

LLVM IR (-O2):
define double @power(double %0, i32 %1) {
switch i32 %1, label %6 [
i32 0, label %4
i32 1, label %3
]
3: ; preds = %2
br label %4
4: ; preds = %3, %2, %6
%5 = phi double [ %12, %6 ], [ %0, %3 ], [ 1.000000e+00, %2 ]
ret double %5
6: ; preds = %2
%7 = sdiv i32 %1, 2
%8 = tail call double @power(double %0, i32 %7)
%9 = fmul double %8, %8
%10 = srem i32 %1, 2
%11 = tail call double @power(double %0, i32 %10)
%12 = fmul double %9, %11
br label %4
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ do_regular_work();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ get_ticket();
int /*<<< orphan*/ release_ticket();
int /*<<< orphan*/ setup();
int /*<<< orphan*/ shut_down();
int main(void) {
  setup();
  if (get_ticket() != 0)
    exit(EXIT_FAILURE);
  do_regular_work();
  release_ticket();
  shut_down();
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1080 <setup@plt>
mov    $0x0,%al
call   1030 <get_ticket@plt>
cmp    $0x0,%rax
je     1195 <main+0x35>
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    $0x0,%al
call   1050 <do_regular_work@plt>
mov    $0x0,%al
call   1040 <release_ticket@plt>
mov    $0x0,%al
call   1070 <shut_down@plt>
mov    0x2e27(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1080 <setup@plt>
xor    %eax,%eax
call   1030 <get_ticket@plt>
test   %rax,%rax
jne    1194 <main+0x34>
xor    %eax,%eax
call   1050 <do_regular_work@plt>
xor    %eax,%eax
call   1040 <release_ticket@plt>
xor    %eax,%eax
call   1070 <shut_down@plt>
mov    0x2e48(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret
mov    0x2e45(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @setup()
%3 = call i64 (...) @get_ticket()
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = load i32, i32* @EXIT_FAILURE
%7 = call i32 @exit(i32 %6)
unreachable
8: ; preds = %0
%9 = call i32 (...) @do_regular_work()
%10 = call i32 (...) @release_ticket()
%11 = call i32 (...) @shut_down()
%12 = load i32, i32* @EXIT_SUCCESS
ret i32 %12
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @setup()
%2 = tail call i64 (...) @get_ticket()
%3 = icmp eq i64 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %0
%5 = load i32, i32* @EXIT_FAILURE
%6 = tail call i32 @exit(i32 %5)
unreachable
7: ; preds = %0
%8 = tail call i32 (...) @do_regular_work()
%9 = tail call i32 (...) @release_ticket()
%10 = tail call i32 (...) @shut_down()
%11 = load i32, i32* @EXIT_SUCCESS
ret i32 %11
}
int transport_write(int sockfd, char *buf, int len) {
  int n;
  assert(sockfd);
  assert(buf);
  assert(len);
  n = write(sockfd, buf, len);
  if (n < 0)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<transport_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1040 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1040 <assert@plt>
mov    -0x14(%rbp),%edi
mov    $0x0,%al
call   1040 <assert@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    $0x0,%al
call   1030 <write@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    117b <transport_write+0x5b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1182 <transport_write+0x62>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<transport_write>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <assert@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <assert@plt>
mov    %r14d,%edi
xor    %eax,%eax
call   1040 <assert@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14d,%edx
xor    %eax,%eax
call   1030 <write@plt>
sar    $0x1f,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @transport_write(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %0)
%5 = tail call i32 (i8*, ...) bitcast (i32 (...)* @assert to i32 (i8*, ...)*)(i8* %1)
%6 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %2)
%7 = tail call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 %0, i8* %1, i32 %2)
%8 = ashr i32 %7, 31
ret i32 %8
}
/* Variables and functions */
int strcmp(char *, char *);
int qdirentcmp(char **d1, char **d2) { return strcmp(*d1, *d2); }


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

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

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

LLVM IR (-O2):
define i32 @qdirentcmp(i8** nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %0
%4 = load i8*, i8** %1
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %3, i8* dereferenceable(1) %4)
ret i32 %5
}
int t16() {
  int a, b;
  asm("nop;" : "=%c"(a) : "r"(b));
  return 0;
}


x86 assembly (clang, -O0):
<t16>:
push   %rbp
mov    %rsp,%rbp
mov    -0x8(%rbp),%eax
nop
mov    %ecx,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @t16() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* %2
%4 = call i32 asm "nop;", "=%{cx},r,~{dirflag},~{fpsr},~{flags}"(i32 %3)
store i32 %4, i32* %1
ret i32 0
}

LLVM IR (-O2):
define i32 @t16() {
%1 = tail call i32 asm "nop;", "=%{cx},r,~{dirflag},~{fpsr},~{flags}"(i32 undef)
ret i32 0
}