xunge/DecIR huggingface dataset:
void testConstant() {
  switch (3) {
  case 1 ... 5:
    clang_analyzer_warnIfReached();
    break;
  default:
    clang_analyzer_warnIfReached();
    break;
  }
}


x86 assembly (clang, -O0):
<testConstant>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
test   %al,%al
jne    112f <testConstant+0x1f>
jmp    1123 <testConstant+0x13>
mov    $0x0,%al
call   1030 <clang_analyzer_warnIfReached@plt>
jmp    1136 <testConstant+0x26>
mov    $0x0,%al
call   1030 <clang_analyzer_warnIfReached@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @testConstant() {
switch i32 3, label %3 [
i32 1, label %1
i32 2, label %1
i32 3, label %1
i32 4, label %1
i32 5, label %1
]
1: ; preds = %0, %0, %0, %0, %0
%2 = call i32 (...) @clang_analyzer_warnIfReached()
br label %5
3: ; preds = %0
%4 = call i32 (...) @clang_analyzer_warnIfReached()
br label %5
5: ; preds = %3, %1
ret void
}

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

/* Variables and functions */
int /*<<< orphan*/ SIG_BLOCK;
int sigprocmask(int /*<<< orphan*/, int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int sigblock(int mask) {
  int n;
  union {
    int the_mask;
    sigset_t the_sigset;
  } in, out;
  in.the_mask = mask;
  n = sigprocmask(SIG_BLOCK, &in.the_sigset, &out.the_sigset);
  if (n)
    return n;
  return out.the_mask;
}


x86 assembly (clang, -O0):
<sigblock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1030 <sigprocmask@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     114f <sigblock+0x3f>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1155 <sigblock+0x45>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigblock>:
sub    $0x18,%rsp
mov    %edi,0x10(%rsp)
mov    0x2ec1(%rip),%rax
mov    (%rax),%edi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1030 <sigprocmask@plt>
test   %eax,%eax
jne    1138 <sigblock+0x28>
mov    0x8(%rsp),%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%union.anon = type { i32 }
@SIG_BLOCK = global i32 0
define i32 @sigblock(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca %union.anon
%6 = alloca %union.anon
store i32 %0, i32* %3
%7 = load i32, i32* %3
%8 = bitcast %union.anon* %5 to i32*
store i32 %7, i32* %8
%9 = load i32, i32* @SIG_BLOCK
%10 = bitcast %union.anon* %5 to i32*
%11 = bitcast %union.anon* %6 to i32*
%12 = call i32 @sigprocmask(i32 %9, i32* %10, i32* %11)
store i32 %12, i32* %4
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %1
%16 = load i32, i32* %4
store i32 %16, i32* %2
br label %20
17: ; preds = %1
%18 = bitcast %union.anon* %6 to i32*
%19 = load i32, i32* %18
store i32 %19, i32* %2
br label %20
20: ; preds = %17, %15
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
%union.anon = type { i32 }
@SIG_BLOCK = global i32 0
define i32 @sigblock(i32 %0) {
%2 = alloca %union.anon
%3 = alloca %union.anon
%4 = bitcast %union.anon* %2 to i8*
%5 = bitcast %union.anon* %3 to i8*
%6 = getelementptr inbounds %union.anon, %union.anon* %2, i64 0, i32 0
store i32 %0, i32* %6
%7 = load i32, i32* @SIG_BLOCK
%8 = getelementptr inbounds %union.anon, %union.anon* %3, i64 0, i32 0
%9 = call i32 @sigprocmask(i32 %7, i32* %6, i32* %8)
%10 = icmp eq i32 %9, 0
%11 = load i32, i32* %8
%12 = select i1 %10, i32 %11, i32 %9
ret i32 %12
}
/* Variables and functions */
int util_safeio_get_fd_min(int, int, int /*<<< orphan*/);
int util_safeio_get_fd(int fd) { return util_safeio_get_fd_min(fd, 1000, 0); }


x86 assembly (clang, -O0):
<util_safeio_get_fd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x3e8,%esi
xor    %edx,%edx
call   1030 <util_safeio_get_fd_min@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<util_safeio_get_fd>:
mov    $0x3e8,%esi
xor    %edx,%edx
jmp    1030 <util_safeio_get_fd_min@plt>

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

LLVM IR (-O2):
define i32 @util_safeio_get_fd(i32 %0) {
%2 = tail call i32 @util_safeio_get_fd_min(i32 %0, i32 1000, i32 0)
ret i32 %2
}
int test_imm_53int32_mem(int *val) {
  return ((*val) & (0x53 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_53int32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 83
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void hide_csr() { printf("%c[?25l", 0x1B); }


x86 assembly (clang, -O0):
<hide_csr>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x1b,%esi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<hide_csr>:
lea    0xee9(%rip),%rdi
mov    $0x1b,%esi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"%c[?25l\00"
define void @hide_csr() {
%1 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 27)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"%c[?25l\00"
define void @hide_csr() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 27)
ret void
}
/* Type definitions */
typedef int uint64_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
uint32_t myrand(uint64_t *seed) {
  *seed = *seed * 1103515245 + 12345;
  return (uint32_t)(*seed >> 32);
}


x86 assembly (clang, -O0):
<myrand>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x41c64e6d,(%rax),%ecx
add    $0x3039,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    $0x20,%ecx
sar    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<myrand>:
imul   $0x41c64e6d,(%rdi),%eax
add    $0x3039,%eax
mov    %eax,(%rdi)
ret

LLVM IR (-O0):
define i32 @myrand(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = mul nsw i32 %4, 1103515245
%6 = add nsw i32 %5, 12345
%7 = load i32*, i32** %2
store i32 %6, i32* %7
%8 = load i32*, i32** %2
%9 = load i32, i32* %8
%10 = ashr i32 %9, 32
ret i32 %10
}

LLVM IR (-O2):
define i32 @myrand(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = mul nsw i32 %2, 1103515245
%4 = add nsw i32 %3, 12345
store i32 %4, i32* %0
ret i32 poison
}
int f(int x, int y) { return 1 / 0; }


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

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

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

LLVM IR (-O2):
define i32 @f(i32 %0, i32 %1) {
ret i32 poison
}
__attribute__((always_)) int __atomic_inc(volatile int *ptr) {
  return __sync_fetch_and_add(ptr, 1);
}


x86 assembly (clang, -O0):
<__atomic_inc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
mov    $0x1,%eax
lock xadd %eax,(%rcx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<__atomic_inc>:
mov    $0x1,%eax
lock xadd %eax,(%rdi)
ret

LLVM IR (-O0):
define i32 @__atomic_inc(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = atomicrmw add i32* %3, i32 1 seq_cst
ret i32 %4
}

LLVM IR (-O2):
define i32 @__atomic_inc(i32* nocapture %0) {
%2 = atomicrmw add i32* %0, i32 1 seq_cst
ret i32 %2
}
void ABGRToAR30Row_Any_SSSE3() {}


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

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

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

LLVM IR (-O2):
define void @ABGRToAR30Row_Any_SSSE3() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void destroyPacket(char *packet) {
  if (packet != NULL)
    free(packet);
}


x86 assembly (clang, -O0):
<destroyPacket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <destroyPacket+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @destroyPacket(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
void __mp_pushdelstack(char *s, char *t, unsigned long u) {}


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

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

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

LLVM IR (-O2):
define void @__mp_pushdelstack(i8* nocapture %0, i8* nocapture %1, i64 %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void bzero(void *dst, size_t length) { memset(dst, 0, length); }


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

x86 assembly (clang, -O2):
<bzero>:
mov    %rsi,%rdx
xor    %esi,%esi
jmp    1030 <memset@plt>

LLVM IR (-O0):
define void @bzero(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i32 @memset(i8* %5, i32 0, i64 %6)
ret void
}

LLVM IR (-O2):
define void @bzero(i8* %0, i64 %1) {
%3 = tail call i32 @memset(i8* %0, i32 0, i64 %1)
ret void
}
double obd_convert_2F(int a, int b) { return (double)(100 * a) / 255.0f; }


x86 assembly (clang, -O0):
<obd_convert_2F>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
imul   $0x64,-0x4(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xee6(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<obd_convert_2F>:
imul   $0x64,%edi,%eax
cvtsi2sd %eax,%xmm0
divsd  0xef1(%rip),%xmm0
ret

LLVM IR (-O0):
define double @obd_convert_2F(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 = mul nsw i32 100, %5
%7 = sitofp i32 %6 to double
%8 = fdiv double %7, 2.550000e+02
ret double %8
}

LLVM IR (-O2):
define double @obd_convert_2F(i32 %0, i32 %1) {
%3 = mul nsw i32 %0, 100
%4 = sitofp i32 %3 to double
%5 = fdiv double %4, 2.550000e+02
ret double %5
}
void av_samples_copy() {}


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

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

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

LLVM IR (-O2):
define void @av_samples_copy() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ std_err(char *);
usage() {
  std_err("Usage: ln file1 [file2]\n");
  exit(1);
}


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

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

LLVM IR (-O0):
@.str = [25 x i8] c"Usage: ln file1 [file2]\0A\00"
define i32 @usage() {
%1 = call i32 @std_err(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [25 x i8] c"Usage: ln file1 [file2]\0A\00"
define i32 @usage() {
%1 = tail call i32 @std_err(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
int fct_pddlwrap() { return 1; }


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

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

LLVM IR (-O0):
define i32 @fct_pddlwrap() {
ret i32 1
}

LLVM IR (-O2):
define i32 @fct_pddlwrap() {
ret i32 1
}
int gsl_TouchNear(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @gsl_TouchNear() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int readlines(char **, int);
int /*<<< orphan*/ writelines(char **, int);
int main(void) {
  char lines[5000][1000];
  int nlines;
  if ((nlines = readlines(lines, 5000)) >= 0) {
    writelines(lines, nlines);
  } else {
    printf("Too much lines.\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4c4b60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x4c4b50(%rbp),%rdi
mov    $0x1388,%esi
call   1050 <readlines@plt>
mov    %eax,-0x4c4b54(%rbp)
cmp    $0x0,%eax
jl     1179 <main+0x49>
lea    -0x4c4b50(%rbp),%rdi
mov    -0x4c4b54(%rbp),%esi
call   1040 <writelines@plt>
jmp    1185 <main+0x55>
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x4c4b60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x4c4b48,%rsp
mov    %rsp,%rdi
mov    $0x1388,%esi
call   1050 <readlines@plt>
test   %eax,%eax
js     1154 <main+0x24>
mov    %rsp,%rdi
mov    %eax,%esi
call   1040 <writelines@plt>
jmp    1160 <main+0x30>
lea    0xea5(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x4c4b48,%rsp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Too much lines.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5000 x [1000 x i8]]
%3 = alloca i32
store i32 0, i32* %1
%4 = getelementptr inbounds [5000 x [1000 x i8]], [5000 x [1000 x i8]]* %2, i64 0, i64 0
%5 = bitcast [1000 x i8]* %4 to i8**
%6 = call i32 @readlines(i8** %5, i32 5000)
store i32 %6, i32* %3
%7 = icmp sge i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %0
%9 = getelementptr inbounds [5000 x [1000 x i8]], [5000 x [1000 x i8]]* %2, i64 0, i64 0
%10 = bitcast [1000 x i8]* %9 to i8**
%11 = load i32, i32* %3
%12 = call i32 @writelines(i8** %10, i32 %11)
br label %15
13: ; preds = %0
%14 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %8
ret i32 0
}

LLVM IR (-O2):
@str = [16 x i8] c"Too much lines.\00"
define i32 @main() {
%1 = alloca [5000 x [1000 x i8]]
%2 = getelementptr inbounds [5000 x [1000 x i8]], [5000 x [1000 x i8]]* %1, i64 0, i64 0, i64 0
%3 = bitcast [5000 x [1000 x i8]]* %1 to i8**
%4 = call i32 @readlines(i8** %3, i32 5000)
%5 = icmp sgt i32 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @writelines(i8** %3, i32 %4)
br label %10
8: ; preds = %0
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
br label %10
10: ; preds = %8, %6
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ strlen_test1();
int main() {
  strlen_test1();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @strlen_test1()
ret i32 0
}
double Vfunc(double x, double nu) { return 1. / nu * x * (1. - x); }


x86 assembly (clang, -O0):
<Vfunc>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  0xeea(%rip),%xmm0
divsd  -0x10(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xed8(%rip),%xmm1
subsd  -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Vfunc>:
movsd  0xef8(%rip),%xmm2
movapd %xmm2,%xmm3
divsd  %xmm1,%xmm3
mulsd  %xmm0,%xmm3
subsd  %xmm0,%xmm2
mulsd  %xmm3,%xmm2
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @Vfunc(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = fdiv double 1.000000e+00, %5
%7 = load double, double* %3
%8 = fmul double %6, %7
%9 = load double, double* %3
%10 = fsub double 1.000000e+00, %9
%11 = fmul double %8, %10
ret double %11
}

LLVM IR (-O2):
define double @Vfunc(double %0, double %1) {
%3 = fdiv double 1.000000e+00, %1
%4 = fmul double %3, %0
%5 = fsub double 1.000000e+00, %0
%6 = fmul double %5, %4
ret double %6
}
/* Variables and functions */
scalar_t__ ispunct(char const);
int PunctCount(const char *str) {
  int ct = 0;
  while (*str) {
    if (ispunct(*str))
      ct++;
    str++;
  }
  return ct;
}


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

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

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

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


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

x86 assembly (clang, -O2):
<atoi>:
jmp    1030 <atol@plt>

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

LLVM IR (-O2):
define i32 @atoi(i8* nocapture %0) {
%2 = tail call i32 @atol(i8* %0)
ret i32 %2
}
/* Type definitions */
struct stat {
  unsigned long st_ino;
};

/* Variables and functions */
int fstat(int, struct stat *);
int /*<<< orphan*/ perror(char *);
unsigned long int get_inode(int fd) {
  struct stat buf;
  int ret;
  ret = fstat(fd, &buf);
  if (ret < 0) {
    perror("fstat");
    return -1;
  }
  return buf.st_ino;
}


x86 assembly (clang, -O0):
<get_inode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
lea    -0x18(%rbp),%rsi
call   1040 <fstat@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    115d <get_inode+0x3d>
lea    0xeb5(%rip),%rdi
call   1030 <perror@plt>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    1165 <get_inode+0x45>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_inode>:
push   %rax
mov    %rsp,%rsi
call   1040 <fstat@plt>
test   %eax,%eax
js     1133 <get_inode+0x13>
mov    (%rsp),%rax
pop    %rcx
ret
lea    0xec6(%rip),%rdi
call   1030 <perror@plt>
mov    $0xffffffffffffffff,%rax
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.stat = type { i64 }
@.str = [6 x i8] c"fstat\00"
define i64 @get_inode(i32 %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @fstat(i32 %0, %struct.stat* %2)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %11
8: ; preds = %1
%9 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%10 = load i64, i64* %9
br label %11
11: ; preds = %8, %6
%12 = phi i64 [ -1, %6 ], [ %10, %8 ]
ret i64 %12
}
/* Variables and functions */
int /*<<< orphan*/ mrl_hash_v(unsigned int, unsigned char *,
                              unsigned char const *, size_t,
                              int /*<<< orphan*/ *, int /*<<< orphan*/);
void mrl_hash(unsigned int hash_alg, unsigned char *digest,
              const unsigned char *buffer, size_t length) {
  mrl_hash_v(hash_alg, digest, buffer, length, NULL, 0);
}


x86 assembly (clang, -O0):
<mrl_hash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%r8d
xor    %r9d,%r9d
call   1030 <mrl_hash_v@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mrl_hash>:
xor    %r8d,%r8d
xor    %r9d,%r9d
jmp    1030 <mrl_hash_v@plt>

LLVM IR (-O0):
define void @mrl_hash(i32 %0, i8* %1, i8* %2, i64 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%9 = load i32, i32* %5
%10 = load i8*, i8** %6
%11 = load i8*, i8** %7
%12 = load i64, i64* %8
%13 = call i32 @mrl_hash_v(i32 %9, i8* %10, i8* %11, i64 %12, i32* null, i32 0)
ret void
}

LLVM IR (-O2):
define void @mrl_hash(i32 %0, i8* %1, i8* %2, i64 %3) {
%5 = tail call i32 @mrl_hash_v(i32 %0, i8* %1, i8* %2, i64 %3, i32* null, i32 0)
ret void
}
int foo(int *x, int *y) { return *x %= (*x) + (*y); }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rax
add    (%rax),%esi
mov    -0x8(%rbp),%rcx
mov    (%rcx),%eax
cltd
idiv   %esi
mov    %edx,%eax
mov    %eax,(%rcx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
add    %eax,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    %edx,(%rdi)
ret

LLVM IR (-O0):
define i32 @foo(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* %5
%7 = load i32*, i32** %4
%8 = load i32, i32* %7
%9 = add nsw i32 %6, %8
%10 = load i32*, i32** %3
%11 = load i32, i32* %10
%12 = srem i32 %11, %9
store i32 %12, i32* %10
ret i32 %12
}

LLVM IR (-O2):
define i32 @foo(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = add nsw i32 %4, %3
%6 = srem i32 %3, %5
store i32 %6, i32* %0
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ free(char const *);
void rf_string_free(const char *m) { free(m); }


x86 assembly (clang, -O0):
<rf_string_free>:
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):
<rf_string_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @rf_string_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
unsigned char inportb(unsigned short port) {
  char value;
  __asm__("inb %w1, %b0" : "=a"(value) : "d"(port));
  return value;
}


x86 assembly (clang, -O0):
<inportb>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%dx
in     (%dx),%al
mov    %al,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inportb>:
mov    %edi,%edx
in     (%dx),%al
ret

LLVM IR (-O0):
define zeroext i8 @inportb(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i8
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = call i8 asm "inb ${1:w}, ${0:b}", "={ax},{dx},~{dirflag},~{fpsr},~{flags}"(i16 %4)
store i8 %5, i8* %3
%6 = load i8, i8* %3
ret i8 %6
}

LLVM IR (-O2):
define zeroext i8 @inportb(i16 zeroext %0) {
%2 = tail call i8 asm "inb ${1:w}, ${0:b}", "={ax},{dx},~{dirflag},~{fpsr},~{flags}"(i16 %0)
ret i8 %2
}
int client_checkaccess(char *rpcprog, struct sockaddr_in *sin, int checkport) {
  return 1;
}


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

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

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

LLVM IR (-O2):
%struct.sockaddr_in = type opaque
define i32 @client_checkaccess(i8* nocapture readnone %0, %struct.sockaddr_in* nocapture readnone %1, i32 %2) {
ret i32 1
}
int main() {
  int val = 5;
  int *pval = &val;
  int *b;
  int *c;
  int *e;
  e = b = c = pval;
  return *e;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    %rax,-0x18(%rbp)
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 5
}
/* Variables and functions */
int chdir(char *);
int wfile_set_wd(char *path) {
  int status;
  status = chdir(path);
  return (status);
}


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

x86 assembly (clang, -O2):
<wfile_set_wd>:
jmp    1030 <chdir@plt>

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

LLVM IR (-O2):
define i32 @wfile_set_wd(i8* %0) {
%2 = tail call i32 @chdir(i8* %0)
ret i32 %2
}
/* Variables and functions */
size_t align(size_t, size_t);
void *size_or_die(size_t);
void *allot_or_die(size_t n, size_t unit_sz, size_t log_lot) {
  return size_or_die(align(n, log_lot) * unit_sz);
}


x86 assembly (clang, -O0):
<allot_or_die>:
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    -0x18(%rbp),%rsi
call   1030 <align@plt>
mov    %rax,%rdi
imul   -0x10(%rbp),%rdi
call   1040 <size_or_die@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<allot_or_die>:
push   %rbx
mov    %rsi,%rbx
mov    %rdx,%rsi
call   1030 <align@plt>
imul   %rax,%rbx
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <size_or_die@plt>

LLVM IR (-O0):
define i8* @allot_or_die(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 = call i64 @align(i64 %7, i64 %8)
%10 = load i64, i64* %5
%11 = mul i64 %9, %10
%12 = call i8* @size_or_die(i64 %11)
ret i8* %12
}

LLVM IR (-O2):
define i8* @allot_or_die(i64 %0, i64 %1, i64 %2) {
%4 = tail call i64 @align(i64 %0, i64 %2)
%5 = mul i64 %4, %1
%6 = tail call i8* @size_or_die(i64 %5)
ret i8* %6
}
int do_976() { return 976; }


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

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

LLVM IR (-O0):
define i32 @do_976() {
ret i32 976
}

LLVM IR (-O2):
define i32 @do_976() {
ret i32 976
}
/* Variables and functions */
int /*<<< orphan*/ EatIt();
int /*<<< orphan*/ Error(char *);
void IllegalOperand() {
  Error("Illegal operand");
  EatIt();
}


x86 assembly (clang, -O0):
<IllegalOperand>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <Error@plt>
mov    $0x0,%al
call   1040 <EatIt@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<IllegalOperand>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <Error@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <EatIt@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"Illegal operand\00"
define void @IllegalOperand() {
%1 = call i32 @Error(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @EatIt()
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"Illegal operand\00"
define void @IllegalOperand() {
%1 = tail call i32 @Error(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @EatIt()
ret void
}
/* Variables and functions */
double lea406(double, int);
double apparentmoon(double jd, int ignorenutation) {
  return lea406(jd, ignorenutation);
}


x86 assembly (clang, -O0):
<apparentmoon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%edi
call   1030 <lea406@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<apparentmoon>:
jmp    1030 <lea406@plt>

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

LLVM IR (-O2):
define double @apparentmoon(double %0, i32 %1) {
%3 = tail call double @lea406(double %0, i32 %1)
ret double %3
}
char *mygetpwnam(name)
char *name;
{ return (char *)getpwnam(name); }


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

x86 assembly (clang, -O2):
<mygetpwnam>:
push   %rax
xor    %eax,%eax
call   1030 <getpwnam@plt>
cltq
pop    %rcx
ret

LLVM IR (-O0):
define i8* @mygetpwnam(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @getpwnam to i32 (i8*, ...)*)(i8* %3)
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i8*
ret i8* %6
}

LLVM IR (-O2):
define i8* @mygetpwnam(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @getpwnam to i32 (i8*, ...)*)(i8* %0)
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ bar();
int /*<<< orphan*/ t4();
void foo(void) {
  bar();
  t4();
}


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

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

LLVM IR (-O0):
define void @foo() {
%1 = call i32 (...) @bar()
%2 = call i32 (...) @t4()
ret void
}

LLVM IR (-O2):
define void @foo() {
%1 = tail call i32 (...) @bar()
%2 = tail call i32 (...) @t4()
ret void
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int32_t numdivis(int32_t f) {
  int32_t count = 1;
  for (int32_t i = 1; i * i < f; count += (f % i++ == 0))
    ;
  return 2 * count;
}


x86 assembly (clang, -O0):
<numdivis>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1151 <numdivis+0x51>
jmp    112a <numdivis+0x2a>
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
cltd
idiv   %ecx
cmp    $0x0,%edx
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1115 <numdivis+0x15>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<numdivis>:
mov    $0x2,%ecx
cmp    $0x2,%edi
jl     113e <numdivis+0x3e>
mov    %edi,%r8d
mov    $0x1,%ecx
mov    $0x2,%esi
nopw   0x0(%rax,%rax,1)
lea    -0x1(%rsi),%edi
mov    %r8d,%eax
cltd
idiv   %edi
cmp    $0x1,%edx
adc    $0x0,%ecx
mov    %esi,%eax
imul   %esi,%eax
add    $0x1,%esi
cmp    %r8d,%eax
jl     1120 <numdivis+0x20>
add    %ecx,%ecx
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @numdivis(i32 %0) {
%2 = icmp sgt i32 %0, 1
br i1 %2, label %7, label %5
3: ; preds = %7
%4 = shl nuw i32 %14, 1
br label %5
5: ; preds = %3, %1
%6 = phi i32 [ 2, %1 ], [ %4, %3 ]
ret i32 %6
7: ; preds = %1, %7
%8 = phi i32 [ %10, %7 ], [ 1, %1 ]
%9 = phi i32 [ %14, %7 ], [ 1, %1 ]
%10 = add nuw nsw i32 %8, 1
%11 = srem i32 %0, %8
%12 = icmp eq i32 %11, 0
%13 = zext i1 %12 to i32
%14 = add nuw nsw i32 %9, %13
%15 = mul nsw i32 %10, %10
%16 = icmp slt i32 %15, %0
br i1 %16, label %7, label %3
}
float _celsius_to_fahrenheit(float input) { return input * 9.0 / 5.0 + 32; }


x86 assembly (clang, -O0):
<_celsius_to_fahrenheit>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xef6(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xee2(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xece(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<_celsius_to_fahrenheit>:
cvtss2sd %xmm0,%xmm0
mulsd  0xef4(%rip),%xmm0
divsd  0xef4(%rip),%xmm0
addsd  0xef4(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @_celsius_to_fahrenheit(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = fmul double %4, 9.000000e+00
%6 = fdiv double %5, 5.000000e+00
%7 = fadd double %6, 3.200000e+01
%8 = fptrunc double %7 to float
ret float %8
}

LLVM IR (-O2):
define float @_celsius_to_fahrenheit(float %0) {
%2 = fpext float %0 to double
%3 = fmul double %2, 9.000000e+00
%4 = fdiv double %3, 5.000000e+00
%5 = fadd double %4, 3.200000e+01
%6 = fptrunc double %5 to float
ret float %6
}
char *strcpy(s1, s2)
char *s1, *s2;
{
  char *temp;
  temp = s1;
  while (*s1++ = *s2++)
    ;
  return temp;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     1143 <strcpy+0x43>
jmp    1114 <strcpy+0x14>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rsi,%rcx,1),%edx
mov    %dl,(%rax,%rcx,1)
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <strcpy+0x10>
ret

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

LLVM IR (-O2):
define i8* @strcpy(i8* returned writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %1, %2 ], [ %6, %3 ]
%5 = phi i8* [ %0, %2 ], [ %8, %3 ]
%6 = getelementptr inbounds i8, i8* %4, i64 1
%7 = load i8, i8* %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %7, i8* %5
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret i8* %0
}
void prepare_seismogram_fields_(long *Mesh_pointer, int *nrec_local, double *nu,
                                double *hxir, double *hetar, double *hgammar) {}


x86 assembly (clang, -O0):
<prepare_seismogram_fields_>:
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)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @prepare_seismogram_fields_(i64* %0, i32* %1, double* %2, double* %3, double* %4, double* %5) {
%7 = alloca i64*
%8 = alloca i32*
%9 = alloca double*
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
store i64* %0, i64** %7
store i32* %1, i32** %8
store double* %2, double** %9
store double* %3, double** %10
store double* %4, double** %11
store double* %5, double** %12
ret void
}

LLVM IR (-O2):
define void @prepare_seismogram_fields_(i64* nocapture %0, i32* nocapture %1, double* nocapture %2, double* nocapture %3, double* nocapture %4, double* nocapture %5) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert_equals(char *, char const *, int /*<<< orphan*/,
                                 char const *);
char *calc_sum(char const *, unsigned int);
int /*<<< orphan*/ rhash_get_name(unsigned int);
void test_str(const char *message, const char *expected_hash,
              unsigned hash_id) {
  char *obtained = calc_sum(message, hash_id);
  assert_equals(obtained, expected_hash, rhash_get_name(hash_id), message);
}


x86 assembly (clang, -O0):
<test_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <calc_sum@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <rhash_get_name@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
mov    -0x8(%rbp),%rcx
call   1040 <assert_equals@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_str>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %edx,%esi
call   1030 <calc_sum@plt>
mov    %rax,%r12
mov    %ebx,%edi
call   1050 <rhash_get_name@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %eax,%edx
mov    %r15,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <assert_equals@plt>

LLVM IR (-O0):
define void @test_str(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %6
%10 = call i8* @calc_sum(i8* %8, i32 %9)
store i8* %10, i8** %7
%11 = load i8*, i8** %7
%12 = load i8*, i8** %5
%13 = load i32, i32* %6
%14 = call i32 @rhash_get_name(i32 %13)
%15 = load i8*, i8** %4
%16 = call i32 @assert_equals(i8* %11, i8* %12, i32 %14, i8* %15)
ret void
}

LLVM IR (-O2):
define void @test_str(i8* %0, i8* %1, i32 %2) {
%4 = tail call i8* @calc_sum(i8* %0, i32 %2)
%5 = tail call i32 @rhash_get_name(i32 %2)
%6 = tail call i32 @assert_equals(i8* %4, i8* %1, i32 %5, i8* %0)
ret void
}
double divide(int keep) { return keep ? (1.0 / (6.0 + divide(--keep))) : 0; }


x86 assembly (clang, -O0):
<divide>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1155 <divide+0x45>
mov    -0x4(%rbp),%edi
add    $0xffffffff,%edi
mov    %edi,-0x4(%rbp)
call   1030 <divide@plt>
movsd  0xecd(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  0xeb9(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1162 <divide+0x52>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1162 <divide+0x52>
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<divide>:
test   %edi,%edi
je     113a <divide+0x2a>
push   %rax
add    $0xffffffff,%edi
call   1030 <divide@plt>
movapd %xmm0,%xmm1
addsd  0xed7(%rip),%xmm1
movsd  0xed7(%rip),%xmm0
divsd  %xmm1,%xmm0
add    $0x8,%rsp
ret
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @divide(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = load i32, i32* %2
%7 = add nsw i32 %6, -1
store i32 %7, i32* %2
%8 = call double @divide(i32 %7)
%9 = fadd double 6.000000e+00, %8
%10 = fdiv double 1.000000e+00, %9
br label %12
11: ; preds = %1
br label %12
12: ; preds = %11, %5
%13 = phi double [ %10, %5 ], [ 0.000000e+00, %11 ]
ret double %13
}

LLVM IR (-O2):
define double @divide(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1, %5
%4 = phi double [ %9, %5 ], [ 0.000000e+00, %1 ]
ret double %4
5: ; preds = %1
%6 = add nsw i32 %0, -1
%7 = tail call double @divide(i32 %6)
%8 = fadd double %7, 6.000000e+00
%9 = fdiv double 1.000000e+00, %8
br label %3
}
OP(ed, c8) {}


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

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

LLVM IR (-O0):
define i32 @OP(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* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
ret i32 undef
}
int Operand_br8_decode(unsigned int *valp) {
  *valp = *valp << 3;
  return 0;
}


x86 assembly (clang, -O0):
<Operand_br8_decode>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
shl    $0x3,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Operand_br8_decode>:
shll   $0x3,(%rdi)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @Operand_br8_decode(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = shl i32 %2, 3
store i32 %3, i32* %0
ret i32 0
}