xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ svcPanic();
int fork() { svcPanic(); }


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

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

LLVM IR (-O0):
define i32 @fork() {
%1 = alloca i32
%2 = call i32 (...) @svcPanic()
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @fork() {
%1 = tail call i32 (...) @svcPanic()
ret i32 undef
}
float tdFade(float f) {
  float ft3 = f * f * f;
  return ft3 * 10 - ft3 * f * 15 + 6 * ft3 * f * f;
}


x86 assembly (clang, -O0):
<tdFade>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  0xed4(%rip),%xmm2
mulss  %xmm2,%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xeb7(%rip),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  0xea3(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  -0x4(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<tdFade>:
movaps %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
movaps %xmm1,%xmm2
mulss  %xmm0,%xmm2
mulss  0xee6(%rip),%xmm2
movss  0xee2(%rip),%xmm3
mulss  %xmm1,%xmm3
mulss  0xeda(%rip),%xmm1
addss  %xmm2,%xmm3
mulss  %xmm0,%xmm1
mulss  %xmm1,%xmm0
addss  %xmm3,%xmm0
ret

LLVM IR (-O0):
define float @tdFade(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
%5 = load float, float* %2
%6 = fmul float %4, %5
%7 = load float, float* %2
%8 = fmul float %6, %7
store float %8, float* %3
%9 = load float, float* %3
%10 = load float, float* %3
%11 = load float, float* %2
%12 = fmul float %10, %11
%13 = fmul float %12, 1.500000e+01
%14 = fneg float %13
%15 = call float @llvm.fmuladd.f32(float %9, float 1.000000e+01, float %14)
%16 = load float, float* %3
%17 = fmul float 6.000000e+00, %16
%18 = load float, float* %2
%19 = fmul float %17, %18
%20 = load float, float* %2
%21 = call float @llvm.fmuladd.f32(float %19, float %20, float %15)
ret float %21
}

LLVM IR (-O2):
define float @tdFade(float %0) {
%2 = fmul float %0, %0
%3 = fmul float %2, %0
%4 = fmul float %3, %0
%5 = fmul float %4, -1.500000e+01
%6 = tail call float @llvm.fmuladd.f32(float %3, float 1.000000e+01, float %5)
%7 = fmul float %3, 6.000000e+00
%8 = fmul float %7, %0
%9 = tail call float @llvm.fmuladd.f32(float %8, float %0, float %6)
ret float %9
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ islower(int);
void t_islower_0x6c() {
  Assert_real((islower(108)),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_islower.c",
              545, ("islower should be 1 for l"));
}


x86 assembly (clang, -O0):
<t_islower_0x6c>:
push   %rbp
mov    %rsp,%rbp
mov    $0x6c,%edi
call   1030 <islower@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x221,%edx
lea    0xf65(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_islower_0x6c>:
push   %rax
mov    $0x6c,%edi
call   1030 <islower@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0x221,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_islower.c\00"
@.str.1 = [26 x i8] c"islower should be 1 for l\00"
define void @t_islower_0x6c() {
%1 = call i32 @islower(i32 108)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 545, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_islower.c\00"
@.str.1 = [26 x i8] c"islower should be 1 for l\00"
define void @t_islower_0x6c() {
%1 = tail call i32 @islower(i32 108)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 545, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int test_imm_73int16_reg(short val) {
  return ((val) & (-0x73 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_73int16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0xffffff8d,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_73int16_reg(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, -115
%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_73int16_reg(i16 signext %0) {
%2 = and i16 %0, -115
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ __VERIFIER_error();
void __VERIFIER_assert(int cond) {
  if (!(cond)) {
  ERROR:
    __VERIFIER_error();
  }
  return;
}


x86 assembly (clang, -O0):
<__VERIFIER_assert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1131 <__VERIFIER_assert+0x21>
jmp    112a <__VERIFIER_assert+0x1a>
mov    $0x0,%al
call   1030 <__VERIFIER_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__VERIFIER_assert>:
test   %edi,%edi
je     1115 <__VERIFIER_assert+0x5>
ret
xor    %eax,%eax
jmp    1030 <__VERIFIER_error@plt>

LLVM IR (-O0):
define void @__VERIFIER_assert(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 %8, label %5
5: ; preds = %1
br label %6
6: ; preds = %5
%7 = call i32 (...) @__VERIFIER_error()
br label %8
8: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
define void @__VERIFIER_assert(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @__VERIFIER_error()
br label %5
5: ; preds = %3, %1
ret void
}
int Strlen(int *c) {
  int n = 0;
  while (*c != '\0') {
    c++;
    n++;
  }
  return (n);
}


x86 assembly (clang, -O0):
<Strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
je     1136 <Strlen+0x36>
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <Strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Strlen>:
cmpl   $0x0,(%rdi)
je     111c <Strlen+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpl   $0x0,0x4(%rdi,%rax,4)
lea    0x1(%rax),%rax
jne    1110 <Strlen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @Strlen(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp eq i32 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 0, %1 ]
%6 = phi i32* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i32, i32* %6, i64 1
%8 = add nuw nsw i32 %5, 1
%9 = load i32, i32* %7
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
char *dirname(char *);
int /*<<< orphan*/ err(int /*<<< orphan*/, char *);
char *strdup(char const *);
int /*<<< orphan*/ xfree(char *);
char *xdirname(const char *path) {
  char *path_copy, *dir, *s;
  path_copy = strdup(path);
  dir = dirname(path_copy);
  if (dir == NULL) {
    err(EXIT_FAILURE, "xdirname");
  }
  s = strdup(dir);
  xfree(path_copy);
  return (s);
}


x86 assembly (clang, -O0):
<xdirname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <strdup@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <dirname@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1186 <xdirname+0x46>
mov    0x2e68(%rip),%rax
mov    (%rax),%edi
lea    0xe7f(%rip),%rsi
call   1050 <err@plt>
mov    -0x18(%rbp),%rdi
call   1060 <strdup@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <xfree@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdirname>:
push   %r14
push   %rbx
push   %rax
call   1060 <strdup@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1040 <dirname@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1171 <xdirname+0x31>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
lea    0xe94(%rip),%rsi
call   1050 <err@plt>
mov    %rbx,%rdi
call   1060 <strdup@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <xfree@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@.str = [9 x i8] c"xdirname\00"
define i8* @xdirname(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i8* @strdup(i8* %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = call i8* @dirname(i8* %8)
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %15
12: ; preds = %1
%13 = load i32, i32* @EXIT_FAILURE
%14 = call i32 @err(i32 %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %12, %1
%16 = load i8*, i8** %4
%17 = call i8* @strdup(i8* %16)
store i8* %17, i8** %5
%18 = load i8*, i8** %3
%19 = call i32 @xfree(i8* %18)
%20 = load i8*, i8** %5
ret i8* %20
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str = [9 x i8] c"xdirname\00"
define noalias i8* @xdirname(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = tail call i8* @dirname(i8* %2)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @err(i32 %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %5, %1
%9 = tail call i8* @strdup(i8* %3)
%10 = tail call i32 @xfree(i8* %2)
ret i8* %9
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, int);
void fprint_xrl_data_to_direct(FILE *stream, uint8_t direct, uint8_t data) {
  fprintf(stream,
          "XRL   "
          "0x%02X"
          ", #"
          "0x%02X"
          "               ",
          direct, data);
}


x86 assembly (clang, -O0):
<fprint_xrl_data_to_direct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xecd(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fprint_xrl_data_to_direct>:
mov    %edx,%ecx
mov    %esi,%edx
lea    0xee5(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"XRL 0x%02X,x%02X \00"
define void @fprint_xrl_data_to_direct(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [37 x i8] c"XRL 0x%02X,x%02X \00"
define void @fprint_xrl_data_to_direct(i32* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
ret void
}
/* Variables and functions */
int foo(int, int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, const char *argv[]) {
  int res = foo(3, 4);
  printf("3 + (2*4) = %d\n", res);
  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    $0x3,%edi
mov    $0x4,%esi
call   1040 <foo@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3,%edi
mov    $0x4,%esi
call   1040 <foo@plt>
lea    0xec9(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [16 x i8] c"3 + (2*4) = %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @foo(i32 3, i32 4)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, unsigned char);
void fprint_xch_atRi(FILE *stream, unsigned char i) {
  fprintf(stream, "XCH   A, @R%X                    ", i);
}


x86 assembly (clang, -O0):
<fprint_xch_atRi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed3(%rip),%rsi
movzbl -0x9(%rbp),%edx
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fprint_xch_atRi>:
mov    %esi,%edx
lea    0xee7(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"XCH A, @R%X \00"
define void @fprint_xch_atRi(i32* %0, i8 zeroext %1) {
%3 = alloca i32*
%4 = alloca i8
store i32* %0, i32** %3
store i8 %1, i8* %4
%5 = load i32*, i32** %3
%6 = load i8, i8* %4
%7 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8 zeroext %6)
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"XCH A, @R%X \00"
define void @fprint_xch_atRi(i32* nocapture %0, i8 zeroext %1) {
%3 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8 zeroext %1)
ret void
}
unsigned mem_sz2(unsigned mem_sz, unsigned n_mem, unsigned period, unsigned i) {
  return (n_mem * (mem_sz - 1) + i % n_mem) >= period ? mem_sz - 1 : mem_sz;
}


x86 assembly (clang, -O0):
<mem_sz2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
imul   %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
xor    %edx,%edx
divl   -0x8(%rbp)
mov    -0x14(%rbp),%eax
add    %edx,%eax
cmp    -0xc(%rbp),%eax
jb     1143 <mem_sz2+0x43>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1149 <mem_sz2+0x49>
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_sz2>:
mov    %ecx,%eax
mov    %edx,%r8d
lea    -0x1(%rdi),%ecx
mov    %ecx,%r9d
imul   %esi,%r9d
xor    %edx,%edx
div    %esi
add    %r9d,%edx
cmp    %r8d,%edx
cmovb  %edi,%ecx
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @mem_sz2(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %6
%10 = load i32, i32* %5
%11 = sub i32 %10, 1
%12 = mul i32 %9, %11
%13 = load i32, i32* %8
%14 = load i32, i32* %6
%15 = urem i32 %13, %14
%16 = add i32 %12, %15
%17 = load i32, i32* %7
%18 = icmp uge i32 %16, %17
br i1 %18, label %19, label %22
19: ; preds = %4
%20 = load i32, i32* %5
%21 = sub i32 %20, 1
br label %24
22: ; preds = %4
%23 = load i32, i32* %5
br label %24
24: ; preds = %22, %19
%25 = phi i32 [ %21, %19 ], [ %23, %22 ]
ret i32 %25
}

LLVM IR (-O2):
define i32 @mem_sz2(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = add i32 %0, -1
%6 = mul i32 %5, %1
%7 = urem i32 %3, %1
%8 = add i32 %7, %6
%9 = icmp ult i32 %8, %2
%10 = select i1 %9, i32 %0, i32 %5
ret i32 %10
}
/* Variables and functions */
int listen(int, int);
int aqlisten(int sockfd, int backlog) { return listen(sockfd, backlog); }


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

x86 assembly (clang, -O2):
<aqlisten>:
jmp    1030 <listen@plt>

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

LLVM IR (-O2):
define i32 @aqlisten(i32 %0, i32 %1) {
%3 = tail call i32 @listen(i32 %0, i32 %1)
ret i32 %3
}
char *truncate_whitespace(char *string, int len) {
  char *truncate = string;
  for (int i = 0; i < len; i++) {
    if (string[i] == ' ') {
      string[i] = '\0';
      break;
    }
  }
  return truncate;
}


x86 assembly (clang, -O0):
<truncate_whitespace>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115f <truncate_whitespace+0x5f>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jne    114c <truncate_whitespace+0x4c>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    115f <truncate_whitespace+0x5f>
jmp    1151 <truncate_whitespace+0x51>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    111a <truncate_whitespace+0x1a>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<truncate_whitespace>:
mov    %rdi,%rax
test   %esi,%esi
jle    111f <truncate_whitespace+0x1f>
mov    %esi,%ecx
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
cmpb   $0x20,(%rax,%rdx,1)
je     1120 <truncate_whitespace+0x20>
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    1110 <truncate_whitespace+0x10>
ret
movb   $0x0,(%rax,%rdx,1)
ret

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

LLVM IR (-O2):
define i8* @truncate_whitespace(i8* returned %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %17
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %14
%7 = phi i64 [ 0, %4 ], [ %15, %14 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 32
br i1 %10, label %11, label %14
11: ; preds = %6
%12 = and i64 %7, 4294967295
%13 = getelementptr inbounds i8, i8* %0, i64 %12
store i8 0, i8* %13
br label %17
14: ; preds = %6
%15 = add nuw nsw i64 %7, 1
%16 = icmp eq i64 %15, %5
br i1 %16, label %17, label %6
17: ; preds = %14, %2, %11
ret i8* %0
}
/* Variables and functions */
size_t strlen(char const *);
size_t n_strlen(const char *string) {
  if (string == NULL) {
    return 0;
  } else {
    return strlen(string);
  }
}


x86 assembly (clang, -O0):
<n_strlen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1134 <n_strlen+0x24>
movq   $0x0,-0x8(%rbp)
jmp    1141 <n_strlen+0x31>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i64 @n_strlen(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i64 @strlen(i8* %0)
br label %5
5: ; preds = %1, %3
%6 = phi i64 [ %4, %3 ], [ 0, %1 ]
ret i64 %6
}
/* Variables and functions */
int RAND_MAX;
int /*<<< orphan*/ handle_exception();
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  int num;
  srand(time(NULL));
  num = rand();
  if (num < (RAND_MAX / 10)) {
    handle_exception();
  }
  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)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    $0x0,%al
call   1060 <rand@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    0x2e6b(%rip),%rax
mov    (%rax),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jge    119b <main+0x5b>
mov    $0x0,%al
call   1050 <handle_exception@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
xor    %eax,%eax
call   1060 <rand@plt>
mov    0x2e8b(%rip),%rcx
movslq (%rcx),%rcx
imul   $0x66666667,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
cmp    %ecx,%eax
jge    117f <main+0x3f>
xor    %eax,%eax
call   1050 <handle_exception@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@RAND_MAX = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @time(i32* null)
%8 = call i32 @srand(i32 %7)
%9 = call i32 (...) @rand()
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = load i32, i32* @RAND_MAX
%12 = sdiv i32 %11, 10
%13 = icmp slt i32 %10, %12
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 (...) @handle_exception()
br label %16
16: ; preds = %14, %2
ret i32 0
}

LLVM IR (-O2):
@RAND_MAX = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = tail call i32 (...) @rand()
%6 = load i32, i32* @RAND_MAX
%7 = sdiv i32 %6, 10
%8 = icmp slt i32 %5, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = tail call i32 (...) @handle_exception()
br label %11
11: ; preds = %9, %2
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ db(int);
void fmulp() {
  db(0xDE);
  db(0xC9);
}


x86 assembly (clang, -O0):
<fmulp>:
push   %rbp
mov    %rsp,%rbp
mov    $0xde,%edi
call   1030 <db@plt>
mov    $0xc9,%edi
call   1030 <db@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmulp>:
push   %rax
mov    $0xde,%edi
call   1030 <db@plt>
mov    $0xc9,%edi
pop    %rax
jmp    1030 <db@plt>

LLVM IR (-O0):
define void @fmulp() {
%1 = call i32 @db(i32 222)
%2 = call i32 @db(i32 201)
ret void
}

LLVM IR (-O2):
define void @fmulp() {
%1 = tail call i32 @db(i32 222)
%2 = tail call i32 @db(i32 201)
ret void
}
void ReverseGPIOP$1$In$clr(void) { HplMcs51GeneralIOC$P13$clr(); }


x86 assembly (clang, -O0):
<ReverseGPIOP$1$In$clr>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <HplMcs51GeneralIOC$P13$clr@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReverseGPIOP$1$In$clr>:
xor    %eax,%eax
jmp    1030 <HplMcs51GeneralIOC$P13$clr@plt>

LLVM IR (-O0):
define void @"ReverseGPIOP$1$In$clr"() {
%1 = call i32 (...) @"HplMcs51GeneralIOC$P13$clr"()
ret void
}

LLVM IR (-O2):
define void @"ReverseGPIOP$1$In$clr"() {
%1 = tail call i32 (...) @"HplMcs51GeneralIOC$P13$clr"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Msp430TimerCapComP__4__Control__clearPendingInterrupt();
void GpioCaptureC__0__Msp430TimerControl__clearPendingInterrupt(void) {
  Msp430TimerCapComP__4__Control__clearPendingInterrupt();
}


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

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

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

LLVM IR (-O2):
define void @GpioCaptureC__0__Msp430TimerControl__clearPendingInterrupt() {
%1 = tail call i32 (...) @Msp430TimerCapComP__4__Control__clearPendingInterrupt()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ database_directory(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
void database_name(char account[], char filename[]) {
  char directory[1024];
  database_directory(directory);
  sprintf(filename, "%s/%s.sqlite3", directory, account);
}


x86 assembly (clang, -O0):
<database_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x410(%rbp),%rdi
call   1030 <database_directory@plt>
mov    -0x10(%rbp),%rdi
lea    -0x410(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xeab(%rip),%rsi
call   1040 <sprintf@plt>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<database_name>:
push   %r15
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsp,%r15
mov    %r15,%rdi
call   1030 <database_directory@plt>
lea    0xebc(%rip),%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
call   1040 <sprintf@plt>
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [14 x i8] c"%s/%s.sqlite3\00"
define void @database_name(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [1024 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%7 = call i32 @database_directory(i8* %6)
%8 = load i8*, i8** %4
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%10 = load i8*, i8** %3
%11 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %10)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"%s/%s.sqlite3\00"
define void @database_name(i8* %0, i8* nocapture writeonly %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = call i32 @database_directory(i8* %4)
%6 = call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
int main() {
  free(NULL);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @free(i32* null)
ret i32 0
}
void mt_lbprof_update_state(int cpu, int rq_cnt) {}


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

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

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

LLVM IR (-O2):
define void @mt_lbprof_update_state(i32 %0, i32 %1) {
ret void
}
unsigned int FindRoot(unsigned int *set, unsigned int node) {
  if (set[node] == node)
    return node;
  else
    return FindRoot(set, set[node]);
}


x86 assembly (clang, -O0):
<FindRoot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    (%rax,%rcx,4),%eax
cmp    -0x14(%rbp),%eax
jne    113d <FindRoot+0x2d>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1153 <FindRoot+0x43>
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    (%rax,%rcx,4),%esi
call   1030 <FindRoot@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FindRoot>:
mov    %esi,%eax
mov    %esi,%ecx
mov    (%rdi,%rcx,4),%esi
cmp    %eax,%esi
jne    1100 <FindRoot>
ret

LLVM IR (-O0):
define i32 @FindRoot(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** %4
%7 = load i32, i32* %5
%8 = zext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* %6, i64 %8
%10 = load i32, i32* %9
%11 = load i32, i32* %5
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = load i32, i32* %5
store i32 %14, i32* %3
br label %23
15: ; preds = %2
%16 = load i32*, i32** %4
%17 = load i32*, i32** %4
%18 = load i32, i32* %5
%19 = zext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %17, i64 %19
%21 = load i32, i32* %20
%22 = call i32 @FindRoot(i32* %16, i32 %21)
store i32 %22, i32* %3
br label %23
23: ; preds = %15, %13
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @FindRoot(i32* nocapture %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i32 [ %1, %2 ], [ %7, %3 ]
%5 = zext i32 %4 to i64
%6 = getelementptr inbounds i32, i32* %0, i64 %5
%7 = load i32, i32* %6
%8 = icmp eq i32 %7, %4
br i1 %8, label %9, label %3
9: ; preds = %3
ret i32 %4
}
/* Variables and functions */
int i2c_smbus_read_word_data(int, int);
int ci20I2CReadReg16(int fd, int reg) {
  return i2c_smbus_read_word_data(fd, reg);
}


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

x86 assembly (clang, -O2):
<ci20I2CReadReg16>:
jmp    1030 <i2c_smbus_read_word_data@plt>

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

LLVM IR (-O2):
define i32 @ci20I2CReadReg16(i32 %0, i32 %1) {
%3 = tail call i32 @i2c_smbus_read_word_data(i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
double fmin(double, double);
double min(double left, double right) { return fmin(left, right); }


x86 assembly (clang, -O0):
<min>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm3
movsd  -0x10(%rbp),%xmm2
movaps %xmm2,%xmm4
movaps %xmm3,%xmm0
cmpunordsd %xmm0,%xmm0
movaps %xmm0,%xmm1
pand   %xmm4,%xmm1
minsd  %xmm3,%xmm2
pandn  %xmm2,%xmm0
por    %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<min>:
movapd %xmm0,%xmm2
cmpunordsd %xmm0,%xmm2
movapd %xmm2,%xmm3
andpd  %xmm1,%xmm3
minsd  %xmm0,%xmm1
andnpd %xmm1,%xmm2
orpd   %xmm3,%xmm2
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @min(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = call double @llvm.minnum.f64(double %5, double %6)
ret double %7
}

LLVM IR (-O2):
define double @min(double %0, double %1) {
%3 = tail call double @llvm.minnum.f64(double %0, double %1)
ret double %3
}
/* Type definitions */
struct lexer {
  int dummy;
};

/* Variables and functions */
int lexer_read_escaped_until(struct lexer *, char *);
int lexer_read_literal_unquoted(struct lexer *lx) {
  return lexer_read_escaped_until(lx, "\\\"'$#\n\t \032");
}


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

x86 assembly (clang, -O2):
<lexer_read_literal_unquoted>:
lea    0xee9(%rip),%rsi
jmp    1030 <lexer_read_escaped_until@plt>

LLVM IR (-O0):
%struct.lexer = type { i32 }
@.str = [10 x i8] c"\\\22'$#\0A\09 \1A\00"
define i32 @lexer_read_literal_unquoted(%struct.lexer* %0) {
%2 = alloca %struct.lexer*
store %struct.lexer* %0, %struct.lexer** %2
%3 = load %struct.lexer*, %struct.lexer** %2
%4 = call i32 @lexer_read_escaped_until(%struct.lexer* %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret i32 %4
}

LLVM IR (-O2):
%struct.lexer = type { i32 }
@.str = [10 x i8] c"\\\22'$#\0A\09 \1A\00"
define i32 @lexer_read_literal_unquoted(%struct.lexer* %0) {
%2 = tail call i32 @lexer_read_escaped_until(%struct.lexer* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ pthread_exit(void *);
int pthread_self();
void *thr_fn2(void *arg) {
  printf("thread 2: ID is %d\n", pthread_self());
  pthread_exit((void *)0);
}


x86 assembly (clang, -O0):
<thr_fn2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <pthread_self@plt>
mov    %eax,%esi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thr_fn2>:
push   %rax
xor    %eax,%eax
call   1050 <pthread_self@plt>
lea    0xec1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %edi,%edi
pop    %rax
jmp    1040 <pthread_exit@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"thread 2: ID is %d\0A\00"
define i8* @thr_fn2(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = call i32 (...) @pthread_self()
%5 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 @pthread_exit(i8* null)
%7 = load i8*, i8** %2
ret i8* %7
}

LLVM IR (-O2):
@.str = [20 x i8] c"thread 2: ID is %d\0A\00"
define noalias i8* @thr_fn2(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @pthread_self()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = tail call i32 @pthread_exit(i8* null)
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ error(char *);
void addHighPriorityTickee(void (*tickee)(void), unsigned periodms) {
  error("ticker unsupported in this VM");
}


x86 assembly (clang, -O0):
<addHighPriorityTickee>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addHighPriorityTickee>:
lea    0xee9(%rip),%rdi
jmp    1030 <error@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"ticker unsupported in this VM\00"
define void @addHighPriorityTickee(void ()* %0, i32 %1) {
%3 = alloca void ()*
%4 = alloca i32
store void ()* %0, void ()** %3
store i32 %1, i32* %4
%5 = call i32 @error(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"ticker unsupported in this VM\00"
define void @addHighPriorityTickee(void ()* nocapture readnone %0, i32 %1) {
%3 = tail call i32 @error(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int random_get(int);
int random_in_range_percent(int base, float percent) {
  float percentage;
  int variance;
  percentage = percent / 100.0;
  variance = (int)(percentage * base);
  variance = random_get(variance * 2) - variance;
  return base + variance;
}


x86 assembly (clang, -O0):
<random_in_range_percent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xecf(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtsi2ssl -0x4(%rbp),%xmm1
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
shl    $0x1,%edi
call   1030 <random_get@plt>
sub    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_in_range_percent>:
push   %r14
push   %rbx
push   %rax
divss  0xee4(%rip),%xmm0
mov    %edi,%ebx
cvtsi2ss %edi,%xmm1
mulss  %xmm0,%xmm1
cvttss2si %xmm1,%r14d
lea    (%r14,%r14,1),%edi
call   1030 <random_get@plt>
sub    %r14d,%ebx
add    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @random_in_range_percent(i32 %0, float %1) {
%3 = alloca i32
%4 = alloca float
%5 = alloca float
%6 = alloca i32
store i32 %0, i32* %3
store float %1, float* %4
%7 = load float, float* %4
%8 = fpext float %7 to double
%9 = fdiv double %8, 1.000000e+02
%10 = fptrunc double %9 to float
store float %10, float* %5
%11 = load float, float* %5
%12 = load i32, i32* %3
%13 = sitofp i32 %12 to float
%14 = fmul float %11, %13
%15 = fptosi float %14 to i32
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = mul nsw i32 %16, 2
%18 = call i32 @random_get(i32 %17)
%19 = load i32, i32* %6
%20 = sub nsw i32 %18, %19
store i32 %20, i32* %6
%21 = load i32, i32* %3
%22 = load i32, i32* %6
%23 = add nsw i32 %21, %22
ret i32 %23
}

LLVM IR (-O2):
define i32 @random_in_range_percent(i32 %0, float %1) {
%3 = fdiv float %1, 1.000000e+02
%4 = sitofp i32 %0 to float
%5 = fmul float %3, %4
%6 = fptosi float %5 to i32
%7 = shl nsw i32 %6, 1
%8 = tail call i32 @random_get(i32 %7)
%9 = sub i32 %0, %6
%10 = add i32 %9, %8
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void printint(void *data) { printf("%d", *(int *)(data)); }


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

x86 assembly (clang, -O2):
<printint>:
mov    (%rdi),%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @printint(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}
char *addr() {
  char a;
  return &a;
}


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

x86 assembly (clang, -O2):
<addr>:
lea    -0x1(%rsp),%rax
ret

LLVM IR (-O0):
define i8* @addr() {
%1 = alloca i8
ret i8* %1
}

LLVM IR (-O2):
define noalias i8* @addr() {
%1 = alloca i8
ret i8* %1
}
/* Type definitions */
struct sysinfo {
  int totalram;
  int mem_unit;
};

/* Variables and functions */
int /*<<< orphan*/ sysinfo(struct sysinfo *);
long long get_mem_size_sysinfo(void) {
  long long mem_size = 0;
  struct sysinfo system_info;
  sysinfo(&system_info);
  mem_size = (system_info.totalram * system_info.mem_unit) / (1024 * 1024);
  return mem_size;
}


x86 assembly (clang, -O0):
<get_mem_size_sysinfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <sysinfo@plt>
mov    -0x10(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    $0x100000,%ecx
cltd
idiv   %ecx
cltq
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_mem_size_sysinfo>:
push   %rax
mov    %rsp,%rdi
call   1030 <sysinfo@plt>
mov    0x4(%rsp),%eax
imul   (%rsp),%eax
lea    0xfffff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
sar    $0x14,%ecx
movslq %ecx,%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.sysinfo = type { i32, i32 }
define i64 @get_mem_size_sysinfo() {
%1 = alloca i64
%2 = alloca %struct.sysinfo
store i64 0, i64* %1
%3 = call i32 @sysinfo(%struct.sysinfo* %2)
%4 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %2, i32 0, i32 0
%5 = load i32, i32* %4
%6 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %2, i32 0, i32 1
%7 = load i32, i32* %6
%8 = mul nsw i32 %5, %7
%9 = sdiv i32 %8, 1048576
%10 = sext i32 %9 to i64
store i64 %10, i64* %1
%11 = load i64, i64* %1
ret i64 %11
}

LLVM IR (-O2):
%struct.sysinfo = type { i32, i32 }
define i64 @get_mem_size_sysinfo() {
%1 = alloca %struct.sysinfo
%2 = bitcast %struct.sysinfo* %1 to i8*
%3 = call i32 @sysinfo(%struct.sysinfo* %1)
%4 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i64 0, i32 1
%7 = load i32, i32* %6
%8 = mul nsw i32 %7, %5
%9 = sdiv i32 %8, 1048576
%10 = sext i32 %9 to i64
ret i64 %10
}
/* Variables and functions */
int /*<<< orphan*/ set_environment(char *, char *);
void environ_set_environment(char *environment, char *datum) {
  set_environment(environment, datum);
}


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

x86 assembly (clang, -O2):
<environ_set_environment>:
jmp    1030 <set_environment@plt>

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

LLVM IR (-O2):
define void @environ_set_environment(i8* %0, i8* %1) {
%3 = tail call i32 @set_environment(i8* %0, i8* %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
void f_fpr_tracking(float a, float b, float c, float d, float e, float f,
                    float g, float h, uint8_t i) {}


x86 assembly (clang, -O0):
<f_fpr_tracking>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  %xmm4,-0x14(%rbp)
movss  %xmm5,-0x18(%rbp)
movss  %xmm6,-0x1c(%rbp)
movss  %xmm7,-0x20(%rbp)
mov    %edi,-0x24(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @f_fpr_tracking(float %0, float %1, float %2, float %3, float %4, float %5, float %6, float %7, i32 %8) {
ret void
}
int test_imm_1Fuint32_mem(unsigned int *val) {
  return ((*val) & (0x1F << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_1Fuint32_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, 31
%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_1Fuint32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 31
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ quit();
int quit_cmd(void) {
  quit();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @quit_cmd() {
%1 = call i32 (...) @quit()
ret i32 0
}

LLVM IR (-O2):
define i32 @quit_cmd() {
%1 = tail call i32 (...) @quit()
ret i32 0
}