xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ strncpy(char *, char *, int);
void str_copy_worker(char *dest, char *src, int n) {
  strncpy(dest, src, n);
  dest[n - 1] = '\0';
}


x86 assembly (clang, -O0):
<str_copy_worker>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_copy_worker>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rdi,%rbx
call   1030 <strncpy@plt>
movslq %ebp,%rax
movb   $0x0,-0x1(%rax,%rbx,1)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @str_copy_worker(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @strncpy(i8* %0, i8* %1, i32 %2)
%5 = add nsw i32 %2, -1
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 0, i8* %7
ret void
}
/* Variables and functions */
int f272(int *);
int f273(int *p) { return f272(p); }


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

x86 assembly (clang, -O2):
<f273>:
jmp    1030 <f272@plt>

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

LLVM IR (-O2):
define i32 @f273(i32* %0) {
%2 = tail call i32 @f272(i32* %0)
ret i32 %2
}
/* Type definitions */
typedef int uint8_t;
typedef int uint64_t;

/* Variables and functions */
uint8_t loc64to8(uint64_t number) {
  uint8_t exponent = 0;
  while (number > 9) {
    number /= 10;
    exponent++;
  }
  return ((uint8_t)number << 4) + (exponent & 15);
}


x86 assembly (clang, -O0):
<loc64to8>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x9,-0x4(%rbp)
jle    1134 <loc64to8+0x34>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <loc64to8+0xe>
mov    -0x4(%rbp),%eax
shl    $0x4,%eax
mov    -0x8(%rbp),%ecx
and    $0xf,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<loc64to8>:
mov    %edi,%eax
xor    %ecx,%ecx
cmp    $0xa,%edi
jl     1127 <loc64to8+0x27>
xor    %ecx,%ecx
mov    $0xcccccccd,%edx
mov    %eax,%esi
mov    %eax,%eax
imul   %rdx,%rax
shr    $0x23,%rax
add    $0x1,%ecx
cmp    $0x63,%esi
ja     1110 <loc64to8+0x10>
and    $0xf,%ecx
shl    $0x4,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @loc64to8(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %7, %1
%5 = load i32, i32* %2
%6 = icmp sgt i32 %5, 9
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = load i32, i32* %2
%9 = sdiv i32 %8, 10
store i32 %9, i32* %2
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
store i32 %11, i32* %3
br label %4
12: ; preds = %4
%13 = load i32, i32* %2
%14 = shl i32 %13, 4
%15 = load i32, i32* %3
%16 = and i32 %15, 15
%17 = add nsw i32 %14, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @loc64to8(i32 %0) {
%2 = icmp sgt i32 %0, 9
br i1 %2, label %3, label %11
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = udiv i32 %5, 10
%7 = add nuw nsw i32 %4, 1
%8 = icmp ugt i32 %5, 99
br i1 %8, label %3, label %9
9: ; preds = %3
%10 = and i32 %7, 15
br label %11
11: ; preds = %9, %1
%12 = phi i32 [ %0, %1 ], [ %6, %9 ]
%13 = phi i32 [ 0, %1 ], [ %10, %9 ]
%14 = shl i32 %12, 4
%15 = or i32 %13, %14
ret i32 %15
}
void __attribute__((weak)) test() {
  printf("%s:%d %s()\n",
         "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/fengbohello/practice/refs/heads/master/"
         "clang/attribute/weak_fun/libmain.c",
         29, __func__);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xeea(%rip),%rsi
mov    $0x1d,%edx
lea    0xf82(%rip),%rcx
mov    $0x0,%al
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
lea    0xee9(%rip),%rdi
lea    0xeee(%rip),%rsi
lea    0xf8b(%rip),%rcx
mov    $0x1d,%edx
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"%s:%d %s()\0A\00"
@.str.1 = [164 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fengbohello/practice/refs/heads/master/clang/attribute/weak_fun/libmain.c\00"
@__func__.test = [5 x i8] c"test\00"
define weak void @test() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([164 x i8], [164 x i8]* @.str.1, i64 0, i64 0), i32 29, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @__func__.test, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"%s:%d %s()\0A\00"
@.str.1 = [164 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fengbohello/practice/refs/heads/master/clang/attribute/weak_fun/libmain.c\00"
@__func__.test = [5 x i8] c"test\00"
define weak void @test() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([164 x i8], [164 x i8]* @.str.1, i64 0, i64 0), i32 29, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @__func__.test, i64 0, i64 0))
ret void
}
int frm_free_buf_ddr(struct frammap_buf_info *info) {}


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

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

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

LLVM IR (-O2):
%struct.frammap_buf_info = type opaque
define i32 @frm_free_buf_ddr(%struct.frammap_buf_info* nocapture readnone %0) {
ret i32 undef
}
int CrCbAdjustResolution(int res, int channel) {
  switch (channel) {
  case 1:
  case 2:
    return (res + 1) >> 1;
  default:
    return res;
  }
}


x86 assembly (clang, -O0):
<CrCbAdjustResolution>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
sub    $0x1,%eax
ja     112f <CrCbAdjustResolution+0x2f>
jmp    111e <CrCbAdjustResolution+0x1e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1135 <CrCbAdjustResolution+0x35>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CrCbAdjustResolution>:
add    $0xffffffff,%esi
lea    0x1(%rdi),%eax
sar    %eax
cmp    $0x2,%esi
cmovae %edi,%eax
ret

LLVM IR (-O0):
define i32 @CrCbAdjustResolution(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
switch i32 %6, label %11 [
i32 1, label %7
i32 2, label %7
]
7: ; preds = %2, %2
%8 = load i32, i32* %4
%9 = add nsw i32 %8, 1
%10 = ashr i32 %9, 1
store i32 %10, i32* %3
br label %13
11: ; preds = %2
%12 = load i32, i32* %4
store i32 %12, i32* %3
br label %13
13: ; preds = %11, %7
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @CrCbAdjustResolution(i32 %0, i32 %1) {
%3 = add i32 %1, -1
%4 = icmp ult i32 %3, 2
%5 = add nsw i32 %0, 1
%6 = ashr i32 %5, 1
%7 = select i1 %4, i32 %6, i32 %0
ret i32 %7
}
/* Variables and functions */
size_t modular_addition_size_t_unsafe(size_t, size_t, size_t);
size_t modular_addition_size_t(size_t x, size_t y, size_t m) {
  return modular_addition_size_t_unsafe(x % m, y % m, m);
}


x86 assembly (clang, -O0):
<modular_addition_size_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x18(%rbp)
mov    %rdx,%rdi
mov    -0x10(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x18(%rbp)
mov    %rdx,%rsi
mov    -0x18(%rbp),%rdx
call   1030 <modular_addition_size_t_unsafe@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<modular_addition_size_t>:
mov    %rdx,%rcx
mov    %rdi,%rax
mov    %rdi,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
je     112c <modular_addition_size_t+0x1c>
xor    %edx,%edx
div    %rcx
mov    %rdx,%rdi
jmp    1132 <modular_addition_size_t+0x22>
xor    %edx,%edx
div    %ecx
mov    %edx,%edi
mov    %rsi,%rax
or     %rcx,%rax
shr    $0x20,%rax
je     1148 <modular_addition_size_t+0x38>
mov    %rsi,%rax
xor    %edx,%edx
div    %rcx
jmp    114e <modular_addition_size_t+0x3e>
mov    %esi,%eax
xor    %edx,%edx
div    %ecx
mov    %rdx,%rsi
mov    %rcx,%rdx
jmp    1030 <modular_addition_size_t_unsafe@plt>

LLVM IR (-O0):
define i64 @modular_addition_size_t(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %4
%8 = load i64, i64* %6
%9 = urem i64 %7, %8
%10 = load i64, i64* %5
%11 = load i64, i64* %6
%12 = urem i64 %10, %11
%13 = load i64, i64* %6
%14 = call i64 @modular_addition_size_t_unsafe(i64 %9, i64 %12, i64 %13)
ret i64 %14
}

LLVM IR (-O2):
define i64 @modular_addition_size_t(i64 %0, i64 %1, i64 %2) {
%4 = urem i64 %0, %2
%5 = urem i64 %1, %2
%6 = tail call i64 @modular_addition_size_t_unsafe(i64 %4, i64 %5, i64 %2)
ret i64 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/ *);
int mutex_unlock(int /*<<< orphan*/ *);
int pthread_mutex_unlock(pthread_mutex_t *mutex) {
  assert(mutex);
  return mutex_unlock(mutex);
}


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

x86 assembly (clang, -O2):
<pthread_mutex_unlock>:
push   %rbx
mov    %rdi,%rbx
call   1040 <assert@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <mutex_unlock@plt>

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

LLVM IR (-O2):
define i32 @pthread_mutex_unlock(i32* %0) {
%2 = tail call i32 @assert(i32* %0)
%3 = tail call i32 @mutex_unlock(i32* %0)
ret i32 %3
}
/* Variables and functions */
int libshared();
int libstatic();
int main(void) { return libshared() + libstatic() == 42 ? 0 : 1; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <libshared@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <libstatic@plt>
mov    -0x8(%rbp),%edx
add    %eax,%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x2a,%edx
cmove  %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <libshared@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <libstatic@plt>
add    %ebx,%eax
xor    %ecx,%ecx
cmp    $0x2a,%eax
setne  %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @libshared()
%3 = call i32 (...) @libstatic()
%4 = add nsw i32 %2, %3
%5 = icmp eq i32 %4, 42
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 0, i32 1
ret i32 %7
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @libshared()
%2 = tail call i32 (...) @libstatic()
%3 = add nsw i32 %2, %1
%4 = icmp ne i32 %3, 42
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int DoVprintf(char *, char *);
int /*<<< orphan*/ Fail(char *, int, int);
int strlen(char *);
void DoStrTest(char *formatstr, char *param, char *checkstr) {
  int ret;
  ret = DoVprintf(formatstr, param);
  if (ret != strlen(checkstr)) {
    Fail("Expected vprintf to return %d, got %d.\n", strlen(checkstr), ret);
  }
}


x86 assembly (clang, -O0):
<DoStrTest>:
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),%rsi
call   1040 <DoVprintf@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
je     118a <DoStrTest+0x5a>
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%esi
mov    -0x1c(%rbp),%edx
lea    0xe7b(%rip),%rdi
call   1050 <Fail@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DoStrTest>:
push   %rbp
push   %rbx
push   %rax
mov    %rdx,%rbx
call   1040 <DoVprintf@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    %eax,%ebp
jne    1150 <DoStrTest+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0xea1(%rip),%rdi
mov    %eax,%esi
mov    %ebp,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <Fail@plt>

LLVM IR (-O0):
@.str = [40 x i8] c"Expected vprintf to return %d, got %d.\0A\00"
define void @DoStrTest(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = call i32 @DoVprintf(i8* %8, i8* %9)
store i32 %10, i32* %7
%11 = load i32, i32* %7
%12 = load i8*, i8** %6
%13 = call i32 @strlen(i8* %12)
%14 = icmp ne i32 %11, %13
br i1 %14, label %15, label %20
15: ; preds = %3
%16 = load i8*, i8** %6
%17 = call i32 @strlen(i8* %16)
%18 = load i32, i32* %7
%19 = call i32 @Fail(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %18)
br label %20
20: ; preds = %15, %3
ret void
}

LLVM IR (-O2):
@.str = [40 x i8] c"Expected vprintf to return %d, got %d.\0A\00"
define void @DoStrTest(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @DoVprintf(i8* %0, i8* %1)
%5 = tail call i32 @strlen(i8* %2)
%6 = icmp eq i32 %4, %5
br i1 %6, label %10, label %7
7: ; preds = %3
%8 = tail call i32 @strlen(i8* %2)
%9 = tail call i32 @Fail(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %4)
br label %10
10: ; preds = %7, %3
ret void
}
void tegra_twd_resume(struct tegra_twd_context *context) {}


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

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

LLVM IR (-O0):
%struct.tegra_twd_context = type opaque
define void @tegra_twd_resume(%struct.tegra_twd_context* %0) {
%2 = alloca %struct.tegra_twd_context*
store %struct.tegra_twd_context* %0, %struct.tegra_twd_context** %2
ret void
}

LLVM IR (-O2):
%struct.tegra_twd_context = type opaque
define void @tegra_twd_resume(%struct.tegra_twd_context* nocapture %0) {
ret void
}
int get_length(int n) {
  int len;
  int index;
  len = 0;
  if (n <= 0)
    len++;
  index = n;
  while (index != 0) {
    index /= 10;
    len++;
  }
  return (len);
}


x86 assembly (clang, -O0):
<get_length>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jg     1121 <get_length+0x21>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     114d <get_length+0x4d>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1127 <get_length+0x27>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_length>:
xor    %eax,%eax
test   %edi,%edi
setle  %al
je     1132 <get_length+0x32>
nopl   0x0(%rax)
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
add    $0x1,%eax
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <get_length+0x10>
ret

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

LLVM IR (-O2):
define i32 @get_length(i32 %0) {
%2 = icmp slt i32 %0, 1
%3 = zext i1 %2 to i32
%4 = icmp eq i32 %0, 0
br i1 %4, label %12, label %5
5: ; preds = %1, %5
%6 = phi i32 [ %8, %5 ], [ %0, %1 ]
%7 = phi i32 [ %9, %5 ], [ %3, %1 ]
%8 = sdiv i32 %6, 10
%9 = add nuw nsw i32 %7, 1
%10 = add i32 %6, 9
%11 = icmp ult i32 %10, 19
br i1 %11, label %12, label %5
12: ; preds = %5, %1
%13 = phi i32 [ %3, %1 ], [ %9, %5 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *prog) {
  fprintf(stderr, "usage: %s [-n seconds] [-hvV] <command>\n", prog);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [41 x i8] c"usage: %s [-n seconds] [-hvV] <command>\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [41 x i8] c"usage: %s [-n seconds] [-hvV] <command>\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
long long nbVector(int order) { return 1ll << order; }


x86 assembly (clang, -O0):
<nbVector>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nbVector>:
mov    %edi,%ecx
mov    $0x1,%eax
shl    %cl,%rax
ret

LLVM IR (-O0):
define i64 @nbVector(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = zext i32 %3 to i64
%5 = shl i64 1, %4
ret i64 %5
}

LLVM IR (-O2):
define i64 @nbVector(i32 %0) {
%2 = zext i32 %0 to i64
%3 = shl nuw i64 1, %2
ret i64 %3
}
int test_imm_BFuint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0xBF << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_BFuint64_midword_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, 16
%6 = and i64 %5, 191
%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_BFuint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 12517376
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
uint32_t PointerToOffset(void *base, void *pointer) {
  if (!pointer)
    return 0;
  return (uint32_t)(((uintptr_t)pointer) - (uintptr_t)base);
}


x86 assembly (clang, -O0):
<PointerToOffset>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1123 <PointerToOffset+0x23>
movl   $0x0,-0x4(%rbp)
jmp    1131 <PointerToOffset+0x31>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<PointerToOffset>:
mov    %esi,%ecx
sub    %edi,%ecx
xor    %eax,%eax
test   %rsi,%rsi
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define i32 @PointerToOffset(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %5
%7 = icmp ne i8* %6, null
br i1 %7, label %9, label %8
8: ; preds = %2
store i32 0, i32* %3
br label %16
9: ; preds = %2
%10 = load i8*, i8** %5
%11 = ptrtoint i8* %10 to i64
%12 = load i8*, i8** %4
%13 = ptrtoint i8* %12 to i64
%14 = sub i64 %11, %13
%15 = trunc i64 %14 to i32
store i32 %15, i32* %3
br label %16
16: ; preds = %9, %8
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @PointerToOffset(i8* %0, i8* %1) {
%3 = icmp eq i8* %1, null
%4 = ptrtoint i8* %1 to i64
%5 = ptrtoint i8* %0 to i64
%6 = sub i64 %4, %5
%7 = trunc i64 %6 to i32
%8 = select i1 %3, i32 0, i32 %7
ret i32 %8
}
/* Type definitions */
struct rlimit {
  scalar_t__ rlim_max;
  scalar_t__ rlim_cur;
};

/* Variables and functions */
int /*<<< orphan*/ RLIMIT_CORE;
int /*<<< orphan*/ setrlimit(int /*<<< orphan*/, struct rlimit *);
void disallow_core() {
  struct rlimit lim;
  lim.rlim_cur = lim.rlim_max = 0;
  setrlimit(RLIMIT_CORE, &lim);
}


x86 assembly (clang, -O0):
<disallow_core>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x8(%rbp)
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <setrlimit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<disallow_core>:
sub    $0x18,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1030 <setrlimit@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.rlimit = type { i64, i64 }
@RLIMIT_CORE = global i32 0
define void @disallow_core() {
%1 = alloca %struct.rlimit
%2 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %1, i32 0, i32 0
store i64 0, i64* %2
%3 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %1, i32 0, i32 1
store i64 0, i64* %3
%4 = load i32, i32* @RLIMIT_CORE
%5 = call i32 @setrlimit(i32 %4, %struct.rlimit* %1)
ret void
}

LLVM IR (-O2):
%struct.rlimit = type { i64, i64 }
@RLIMIT_CORE = global i32 0
define void @disallow_core() {
%1 = alloca %struct.rlimit
%2 = bitcast %struct.rlimit* %1 to i8*
%3 = bitcast %struct.rlimit* %1 to i8*
%4 = load i32, i32* @RLIMIT_CORE
%5 = call i32 @setrlimit(i32 %4, %struct.rlimit* %1)
ret void
}
void glCopyBufferSubData(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glCopyBufferSubData() {
ret void
}
double f4_cb_send_pre_double_double_double_double_int(
    double (*cb)(double, double, double, double, int)) {
  int r = 44;
  return cb(8.25, 9.25, 10.25, 11.25, r) + 1.0;
}


x86 assembly (clang, -O0):
<f4_cb_send_pre_double_double_double_double_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x2c,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%edi
movsd  0xee6(%rip),%xmm0
movsd  0xee6(%rip),%xmm1
movsd  0xee6(%rip),%xmm2
movsd  0xee6(%rip),%xmm3
call   *%rax
movsd  0xebc(%rip),%xmm1
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f4_cb_send_pre_double_double_double_double_int>:
push   %rax
mov    %rdi,%rax
movsd  0xef4(%rip),%xmm0
movsd  0xef4(%rip),%xmm1
movsd  0xef4(%rip),%xmm2
movsd  0xef4(%rip),%xmm3
mov    $0x2c,%edi
call   *%rax
addsd  0xeed(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @f4_cb_send_pre_double_double_double_double_int(double (double, double, double, double, i32)* %0) {
%2 = alloca double (double, double, double, double, i32)*
%3 = alloca i32
store double (double, double, double, double, i32)* %0, double (double, double, double, double, i32)** %2
store i32 44, i32* %3
%4 = load double (double, double, double, double, i32)*, double (double, double, double, double, i32)** %2
%5 = load i32, i32* %3
%6 = call double %4(double 8.250000e+00, double 9.250000e+00, double 1.025000e+01, double 1.125000e+01, i32 %5)
%7 = fadd double %6, 1.000000e+00
ret double %7
}

LLVM IR (-O2):
define double @f4_cb_send_pre_double_double_double_double_int(double (double, double, double, double, i32)* nocapture %0) {
%2 = tail call double %0(double 8.250000e+00, double 9.250000e+00, double 1.025000e+01, double 1.125000e+01, i32 44)
%3 = fadd double %2, 1.000000e+00
ret double %3
}
/* Type definitions */
typedef int /*<<< orphan*/ sqlite3_stmt;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
scalar_t__ SQLITE_OK;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ sqlite3_finalize(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
void free_sql_statement(sqlite3_stmt *stmt_to_free) {
  if ((sqlite3_finalize(stmt_to_free)) != SQLITE_OK) {
    fprintf(stderr, "ERROR: Freeing SQL Statement Memory Failed");
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<free_sql_statement>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <sqlite3_finalize@plt>
mov    0x2e9c(%rip),%rcx
cmp    (%rcx),%rax
je     1178 <free_sql_statement+0x48>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
lea    0xe9b(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e5f(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_sql_statement>:
push   %rax
call   1040 <sqlite3_finalize@plt>
mov    0x2eab(%rip),%rcx
cmp    (%rcx),%rax
jne    1144 <free_sql_statement+0x14>
pop    %rax
ret
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
lea    0xeac(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@SQLITE_OK = global i64 0
@stderr = global i32 0
@.str = [43 x i8] c"ERROR: Freeing SQL Statement Memory Failed\00"
@EXIT_FAILURE = global i32 0
define void @free_sql_statement(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i64 @sqlite3_finalize(i32* %3)
%5 = load i64, i64* @SQLITE_OK
%6 = icmp ne i64 %4, %5
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @EXIT_FAILURE
%11 = call i32 @exit(i32 %10)
unreachable
12: ; preds = %1
ret void
}

LLVM IR (-O2):
@SQLITE_OK = global i64 0
@stderr = global i32 0
@.str = [43 x i8] c"ERROR: Freeing SQL Statement Memory Failed\00"
@EXIT_FAILURE = global i32 0
define void @free_sql_statement(i32* %0) {
%2 = tail call i64 @sqlite3_finalize(i32* %0)
%3 = load i64, i64* @SQLITE_OK
%4 = icmp eq i64 %2, %3
br i1 %4, label %10, label %5
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ rbtree_exit(void *);
void rbtree_free(void *a) { rbtree_exit(a); }


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

x86 assembly (clang, -O2):
<rbtree_free>:
jmp    1030 <rbtree_exit@plt>

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

LLVM IR (-O2):
define void @rbtree_free(i8* %0) {
%2 = tail call i32 @rbtree_exit(i8* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, char *);
int variable(char *variable, char *value, void *data) {
  fprintf((FILE *)data, "%s=%s\n", variable, value);
  return 0;
}


x86 assembly (clang, -O0):
<variable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xec9(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<variable>:
push   %rax
mov    %rsi,%rcx
mov    %rdi,%rax
lea    0xee2(%rip),%rsi
mov    %rdx,%rdi
mov    %rax,%rdx
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%s=%s\0A\00"
define i32 @variable(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %6
%8 = bitcast i8* %7 to i32*
%9 = load i8*, i8** %4
%10 = load i8*, i8** %5
%11 = call i32 @fprintf(i32* %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s=%s\0A\00"
define i32 @variable(i8* %0, i8* %1, i8* nocapture %2) {
%4 = bitcast i8* %2 to i32*
%5 = tail call i32 @fprintf(i32* %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
ret i32 0
}
void openVoltages(unsigned short *acVloop, unsigned short *dcVloop,
                  unsigned short *acVring, unsigned short *dcVring,
                  unsigned short *acVtip, unsigned short *dcVtip) {
  unsigned short i, vtip, vloop, vring;
  unsigned long sumVtip = 0;
  unsigned long sumVring = 0;
  unsigned long sumVloop = 0;
}


x86 assembly (clang, -O0):
<openVoltages>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movq   $0x0,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x50(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @openVoltages(i16* %0, i16* %1, i16* %2, i16* %3, i16* %4, i16* %5) {
%7 = alloca i16*
%8 = alloca i16*
%9 = alloca i16*
%10 = alloca i16*
%11 = alloca i16*
%12 = alloca i16*
%13 = alloca i16
%14 = alloca i16
%15 = alloca i16
%16 = alloca i16
%17 = alloca i64
%18 = alloca i64
%19 = alloca i64
store i16* %0, i16** %7
store i16* %1, i16** %8
store i16* %2, i16** %9
store i16* %3, i16** %10
store i16* %4, i16** %11
store i16* %5, i16** %12
store i64 0, i64* %17
store i64 0, i64* %18
store i64 0, i64* %19
ret void
}

LLVM IR (-O2):
define void @openVoltages(i16* nocapture %0, i16* nocapture %1, i16* nocapture %2, i16* nocapture %3, i16* nocapture %4, i16* nocapture %5) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *makeMyString();
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char const *argv[]) {
  char *myString = makeMyString();
  printf("%s\n", myString);
  free(myString);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1050 <makeMyString@plt>
mov    %rax,%rbx
lea    0xebe(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i8* (...) @makeMyString()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = tail call i32 @free(i8* %3)
ret i32 0
}
/* Variables and functions */
int erasechar();
int md_erasechar() { return (erasechar()); }


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

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

LLVM IR (-O0):
define i32 @md_erasechar() {
%1 = call i32 (...) @erasechar()
ret i32 %1
}

LLVM IR (-O2):
define i32 @md_erasechar() {
%1 = tail call i32 (...) @erasechar()
ret i32 %1
}
void g_signal_override_class_closure() {}


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

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

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

LLVM IR (-O2):
define void @g_signal_override_class_closure() {
ret void
}
void g_date_clear() {}


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

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

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

LLVM IR (-O2):
define void @g_date_clear() {
ret void
}
char FastShortByteDiv(short x, char y) { return x / y; }


x86 assembly (clang, -O0):
<FastShortByteDiv>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %al,-0x3(%rbp)
movswl -0x2(%rbp),%eax
movsbl -0x3(%rbp),%ecx
cltd
idiv   %ecx
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FastShortByteDiv>:
mov    %edi,%eax
cltd
idiv   %esi
ret

LLVM IR (-O0):
define signext i8 @FastShortByteDiv(i16 signext %0, i8 signext %1) {
%3 = alloca i16
%4 = alloca i8
store i16 %0, i16* %3
store i8 %1, i8* %4
%5 = load i16, i16* %3
%6 = sext i16 %5 to i32
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
%9 = sdiv i32 %6, %8
%10 = trunc i32 %9 to i8
ret i8 %10
}

LLVM IR (-O2):
define signext i8 @FastShortByteDiv(i16 signext %0, i8 signext %1) {
%3 = sext i16 %0 to i32
%4 = sext i8 %1 to i32
%5 = sdiv i32 %3, %4
%6 = trunc i32 %5 to i8
ret i8 %6
}
/* Variables and functions */
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ print(char *);
int /*<<< orphan*/ write(char *);
void warning(char *message) {
  write("ERROR: ");
  print(message);
  char useless[256];
  gets(useless);
}


x86 assembly (clang, -O0):
<warning>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <write@plt>
mov    -0x8(%rbp),%rdi
call   1040 <print@plt>
lea    -0x110(%rbp),%rdi
call   1050 <gets@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<warning>:
push   %rbx
sub    $0x100,%rsp
mov    %rdi,%rbx
lea    0xebe(%rip),%rdi
call   1030 <write@plt>
mov    %rbx,%rdi
call   1040 <print@plt>
mov    %rsp,%rdi
call   1050 <gets@plt>
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"ERROR: \00"
define void @warning(i8* %0) {
%2 = alloca i8*
%3 = alloca [256 x i8]
store i8* %0, i8** %2
%4 = call i32 @write(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%5 = load i8*, i8** %2
%6 = call i32 @print(i8* %5)
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%8 = call i32 @gets(i8* %7)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"ERROR: \00"
define void @warning(i8* %0) {
%2 = alloca [256 x i8]
%3 = tail call i32 @write(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @print(i8* %0)
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%6 = call i32 @gets(i8* %5)
ret void
}
unsigned foo(unsigned int n) {
  unsigned x = 0;
  ;
  while (n > 10) {
    n -= 2;
    x++;
  }
  return x;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x4(%rbp)
jbe    112f <foo+0x2f>
mov    -0x4(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <foo+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
lea    -0xb(%rdi),%ecx
shr    %ecx
add    $0x1,%ecx
xor    %eax,%eax
cmp    $0xb,%edi
cmovae %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = icmp ugt i32 %0, 10
%3 = add i32 %0, -11
%4 = lshr i32 %3, 1
%5 = add nuw nsw i32 %4, 1
%6 = select i1 %2, i32 %5, i32 0
ret i32 %6
}
A0AX1(r0, r1, x0, x1, p0, p1) float r0, r1;
float *p0, *p1;
{ (*((float *)10000000)) = (((float *)11111111)[x1]); }


x86 assembly (clang, -O0):
<A0AX1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm1,-0x30(%rbp)
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
cvtsd2ss %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm0
movss  %xmm1,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movslq -0x14(%rbp),%rcx
mov    $0xa98ac7,%eax
movss  (%rax,%rcx,4),%xmm0
mov    $0x989680,%eax
movss  %xmm0,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<A0AX1>:
movslq %esi,%rax
movss  0xa98ac7(,%rax,4),%xmm0
movss  %xmm0,0x989680
ret

LLVM IR (-O0):
define i32 @A0AX1(double %0, double %1, i32 %2, i32 %3, float* %4, float* %5) {
%7 = alloca i32
%8 = alloca float
%9 = alloca float
%10 = alloca i32
%11 = alloca i32
%12 = alloca float*
%13 = alloca float*
%14 = fptrunc double %0 to float
%15 = fptrunc double %1 to float
store float %14, float* %8
store float %15, float* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store float* %4, float** %12
store float* %5, float** %13
%16 = load i32, i32* %11
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds float, float* inttoptr (i64 11111111 to float*), i64 %17
%19 = load float, float* %18
store float %19, float* inttoptr (i64 10000000 to float*)
%20 = load i32, i32* %7
ret i32 %20
}

LLVM IR (-O2):
define i32 @A0AX1(double %0, double %1, i32 %2, i32 %3, float* nocapture readnone %4, float* nocapture readnone %5) {
%7 = sext i32 %3 to i64
%8 = getelementptr inbounds float, float* inttoptr (i64 11111111 to float*), i64 %7
%9 = load float, float* %8
store float %9, float* inttoptr (i64 10000000 to float*)
ret i32 undef
}
/* Variables and functions */
double floor(double);
double rev180(double ang) {
  return ang - 360.0 * floor(ang * (1.0 / 360.0) + 0.5);
}


x86 assembly (clang, -O0):
<rev180>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xed4(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xed0(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1030 <floor@plt>
movsd  -0x10(%rbp),%xmm1
movsd  0xeaa(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rev180>:
push   %rax
movapd %xmm0,%xmm1
movsd  %xmm0,(%rsp)
movsd  0xede(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xeda(%rip),%xmm0
call   1030 <floor@plt>
mulsd  0xed5(%rip),%xmm0
addsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @rev180(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = call double @llvm.fmuladd.f64(double %4, double 0x3F66C16C16C16C17, double 5.000000e-01)
%6 = call double @llvm.floor.f64(double %5)
%7 = call double @llvm.fmuladd.f64(double -3.600000e+02, double %6, double %3)
ret double %7
}

LLVM IR (-O2):
define double @rev180(double %0) {
%2 = tail call double @llvm.fmuladd.f64(double %0, double 0x3F66C16C16C16C17, double 5.000000e-01)
%3 = tail call double @llvm.floor.f64(double %2)
%4 = tail call double @llvm.fmuladd.f64(double %3, double -3.600000e+02, double %0)
ret double %4
}
int test_imm_63int8_mem(signed char *val) {
  return ((*val) & (-0x63 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_63int8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, -99
%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_63int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -99
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int uint32_t;
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
void USBIntEnableEndpoint(uint32_t ui32Base, uint32_t ui32Flags) {
  ASSERT(ui32Base == 0x40050000);
  (*((volatile uint16_t *)(ui32Base + 0x00000006))) |=
      ui32Flags & (0x0000FFFE | 0x0000FFFE | 0x00000001);
  (*((volatile uint16_t *)(ui32Base + 0x00000008))) |=
      ((ui32Flags & (0xFFFE0000 | 0xFFFE0000)) >> 16);
}


x86 assembly (clang, -O0):
<USBIntEnableEndpoint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x40050000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x8(%rbp),%edx
and    $0xffff,%edx
mov    -0x4(%rbp),%eax
add    $0x6,%eax
cltq
mov    (%rax),%ecx
or     %edx,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%edx
and    $0xfffe0000,%edx
shr    $0x10,%edx
mov    -0x4(%rbp),%eax
add    $0x8,%eax
cltq
mov    (%rax),%ecx
or     %edx,%ecx
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBIntEnableEndpoint>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
cmp    $0x40050000,%ebp
sete   %dil
call   1030 <ASSERT@plt>
movzwl %bx,%eax
movslq %ebp,%rcx
or     %eax,0x6(%rcx)
shr    $0x10,%ebx
and    $0xfffffffe,%ebx
or     %ebx,0x8(%rcx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @USBIntEnableEndpoint(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 = icmp eq i32 %5, 1074069504
%7 = zext i1 %6 to i32
%8 = call i32 @ASSERT(i32 %7)
%9 = load i32, i32* %4
%10 = and i32 %9, 65535
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 6
%13 = sext i32 %12 to i64
%14 = inttoptr i64 %13 to i32*
%15 = load volatile i32, i32* %14
%16 = or i32 %15, %10
store volatile i32 %16, i32* %14
%17 = load i32, i32* %4
%18 = and i32 %17, -131072
%19 = lshr i32 %18, 16
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 8
%22 = sext i32 %21 to i64
%23 = inttoptr i64 %22 to i32*
%24 = load volatile i32, i32* %23
%25 = or i32 %24, %19
store volatile i32 %25, i32* %23
ret void
}

LLVM IR (-O2):
define void @USBIntEnableEndpoint(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 1074069504
%4 = zext i1 %3 to i32
%5 = tail call i32 @ASSERT(i32 %4)
%6 = and i32 %1, 65535
%7 = add nsw i32 %0, 6
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
%10 = load volatile i32, i32* %9
%11 = or i32 %10, %6
store volatile i32 %11, i32* %9
%12 = lshr i32 %1, 16
%13 = and i32 %12, 65534
%14 = add nsw i32 %0, 8
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i32*
%17 = load volatile i32, i32* %16
%18 = or i32 %17, %13
store volatile i32 %18, i32* %16
ret void
}
void _allocate_global_memory(ptr, size, filename, linenumber) void **ptr;
int size;
char *filename;
int linenumber;
{ __cause_ex1("notimplemented", filename, linenumber); }


x86 assembly (clang, -O0):
<_allocate_global_memory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <__cause_ex1@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_allocate_global_memory>:
lea    0xee9(%rip),%rdi
mov    %rdx,%rsi
mov    %ecx,%edx
xor    %eax,%eax
jmp    1030 <__cause_ex1@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"notimplemented\00"
define void @_allocate_global_memory(i8** %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i8** %0, i8*** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i8*, i8** %7
%10 = load i32, i32* %8
%11 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @__cause_ex1 to i32 (i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %9, i32 %10)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"notimplemented\00"
define void @_allocate_global_memory(i8** nocapture readnone %0, i32 %1, i8* %2, i32 %3) {
%5 = tail call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @__cause_ex1 to i32 (i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %2, i32 %3)
ret void
}
void zlRotatex(signed long x) {}


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

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

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

LLVM IR (-O2):
define void @zlRotatex(i64 %0) {
ret void
}
/* Variables and functions */
int fgetc(void *);
int dumb_stdfile_getc(void *f) { return fgetc(f); }


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

x86 assembly (clang, -O2):
<dumb_stdfile_getc>:
jmp    1030 <fgetc@plt>

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

LLVM IR (-O2):
define i32 @dumb_stdfile_getc(i8* nocapture %0) {
%2 = tail call i32 @fgetc(i8* %0)
ret i32 %2
}