xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) { printf("hello, world\n"); }


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"hello, world\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [13 x i8] c"hello, world\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ vp8_variance(unsigned char *, int, unsigned char *, int, int,
                                int, unsigned int *, int *);
unsigned int vp8_mse16x16_c(unsigned char *src_ptr, int source_stride,
                            unsigned char *ref_ptr, int recon_stride,
                            unsigned int *sse) {
  unsigned int var;
  int avg;
  vp8_variance(src_ptr, source_stride, ref_ptr, recon_stride, 16, 16, &var,
               &avg);
  *sse = var;
  return var;
}


x86 assembly (clang, -O0):
<vp8_mse16x16_c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    $0x10,%r9d
lea    -0x2c(%rbp),%r10
lea    -0x30(%rbp),%rax
mov    %r9d,%r8d
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1030 <vp8_variance@plt>
mov    -0x2c(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x2c(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vp8_mse16x16_c>:
push   %rbx
sub    $0x10,%rsp
mov    %r8,%rbx
lea    0xc(%rsp),%rax
lea    0x8(%rsp),%r10
mov    $0x10,%r8d
mov    $0x10,%r9d
push   %rax
push   %r10
call   1030 <vp8_variance@plt>
add    $0x10,%rsp
mov    0x8(%rsp),%eax
mov    %eax,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @vp8_mse16x16_c(i8* %0, i32 %1, i8* %2, i32 %3, i32* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i32* %4, i32** %10
%13 = load i8*, i8** %6
%14 = load i32, i32* %7
%15 = load i8*, i8** %8
%16 = load i32, i32* %9
%17 = call i32 @vp8_variance(i8* %13, i32 %14, i8* %15, i32 %16, i32 16, i32 16, i32* %11, i32* %12)
%18 = load i32, i32* %11
%19 = load i32*, i32** %10
store i32 %18, i32* %19
%20 = load i32, i32* %11
ret i32 %20
}

LLVM IR (-O2):
define i32 @vp8_mse16x16_c(i8* %0, i32 %1, i8* %2, i32 %3, i32* nocapture writeonly %4) {
%6 = alloca i32
%7 = alloca i32
%8 = bitcast i32* %6 to i8*
%9 = bitcast i32* %7 to i8*
%10 = call i32 @vp8_variance(i8* %0, i32 %1, i8* %2, i32 %3, i32 16, i32 16, i32* %6, i32* %7)
%11 = load i32, i32* %6
store i32 %11, i32* %4
ret i32 %11
}
/* Variables and functions */
int memcmp(void const *, void const *, int);
int key_compare(const void *key1, int key1_len, const void *key2,
                int key2_len) {
  if (key1_len != key2_len)
    return -1;
  return memcmp(key1, key2, key1_len);
}


x86 assembly (clang, -O0):
<key_compare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x24(%rbp),%eax
je     113e <key_compare+0x2e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1151 <key_compare+0x41>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <memcmp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<key_compare>:
cmp    %ecx,%esi
jne    1120 <key_compare+0x10>
mov    %esi,%eax
mov    %rdx,%rsi
mov    %eax,%edx
jmp    1030 <memcmp@plt>
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @key_compare(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = icmp eq i32 %1, %3
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = tail call i32 @memcmp(i8* %0, i8* %2, i32 %1)
br label %8
8: ; preds = %4, %6
%9 = phi i32 [ %7, %6 ], [ -1, %4 ]
ret i32 %9
}
/* Type definitions */
typedef void EVP_MD_CTX;

/* Variables and functions */
int EVP_DigestInit_ex(void *, int /*<<< orphan*/, int /*<<< orphan*/ *);
void *EVP_MD_CTX_create();
int /*<<< orphan*/ EVP_sha256();
void *SHA256_init() {
  EVP_MD_CTX *pctx;
  pctx = EVP_MD_CTX_create();
  if (EVP_DigestInit_ex(pctx, EVP_sha256(), NULL) != 1)
    return pctx;
  return pctx;
}


x86 assembly (clang, -O0):
<SHA256_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1050 <EVP_MD_CTX_create@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1040 <EVP_sha256@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <EVP_DigestInit_ex@plt>
cmp    $0x1,%eax
je     1177 <SHA256_init+0x47>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    117f <SHA256_init+0x4f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SHA256_init>:
push   %rbx
xor    %eax,%eax
call   1050 <EVP_MD_CTX_create@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <EVP_sha256@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %edx,%edx
call   1030 <EVP_DigestInit_ex@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @SHA256_init() {
%1 = tail call i8* (...) @EVP_MD_CTX_create()
%2 = tail call i32 (...) @EVP_sha256()
%3 = tail call i32 @EVP_DigestInit_ex(i8* %1, i32 %2, i32* null)
ret i8* %1
}
double ceil(double x) { return 0; }


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

x86 assembly (clang, -O2):
<ceil>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @ceil(double %0) {
%2 = alloca double
store double %0, double* %2
ret double 0.000000e+00
}

LLVM IR (-O2):
define double @ceil(double %0) {
ret double 0.000000e+00
}
/* Type definitions */
typedef scalar_t__ wint_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ ungetc(char, int /*<<< orphan*/ *);
wint_t ungetwc(wint_t wc, FILE *stream) { return ungetc((char)wc, stream); }


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

x86 assembly (clang, -O2):
<ungetwc>:
movsbl %dil,%edi
jmp    1030 <ungetc@plt>

LLVM IR (-O0):
define i64 @ungetwc(i64 %0, i32* %1) {
%3 = alloca i64
%4 = alloca i32*
store i64 %0, i64* %3
store i32* %1, i32** %4
%5 = load i64, i64* %3
%6 = trunc i64 %5 to i8
%7 = load i32*, i32** %4
%8 = call i64 @ungetc(i8 signext %6, i32* %7)
ret i64 %8
}

LLVM IR (-O2):
define i64 @ungetwc(i64 %0, i32* nocapture %1) {
%3 = trunc i64 %0 to i8
%4 = tail call i64 @ungetc(i8 signext %3, i32* %1)
ret i64 %4
}
/* Variables and functions */
float sqrtf(float);
float distance(float x1, float y1, float x2, float y2) {
  return sqrtf((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}


x86 assembly (clang, -O0):
<distance>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  -0x4(%rbp),%xmm2
subss  -0xc(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
subss  -0x10(%rbp),%xmm1
movss  -0x8(%rbp),%xmm3
subss  -0x10(%rbp),%xmm3
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <sqrtf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<distance>:
subss  %xmm2,%xmm0
subss  %xmm3,%xmm1
mulss  %xmm1,%xmm1
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1131 <distance+0x21>
sqrtss %xmm0,%xmm0
ret
jmp    1030 <sqrtf@plt>

LLVM IR (-O0):
define float @distance(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%9 = load float, float* %5
%10 = load float, float* %7
%11 = fsub float %9, %10
%12 = load float, float* %5
%13 = load float, float* %7
%14 = fsub float %12, %13
%15 = load float, float* %6
%16 = load float, float* %8
%17 = fsub float %15, %16
%18 = load float, float* %6
%19 = load float, float* %8
%20 = fsub float %18, %19
%21 = fmul float %17, %20
%22 = call float @llvm.fmuladd.f32(float %11, float %14, float %21)
%23 = call float @sqrtf(float %22)
ret float %23
}

LLVM IR (-O2):
define float @distance(float %0, float %1, float %2, float %3) {
%5 = fsub float %0, %2
%6 = fsub float %1, %3
%7 = fmul float %6, %6
%8 = tail call float @llvm.fmuladd.f32(float %5, float %5, float %7)
%9 = tail call float @sqrtf(float %8)
ret float %9
}
int is_right_paren(char c) { return c == ')'; }


x86 assembly (clang, -O0):
<is_right_paren>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x29,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_right_paren>:
xor    %eax,%eax
cmp    $0x29,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @is_right_paren(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 41
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @is_right_paren(i8 signext %0) {
%2 = icmp eq i8 %0, 41
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int i2c_send_byte_2(int, int, char);
int LCD_AQM_wrcmd(char cmd) { return i2c_send_byte_2(0x3E, 0x00, cmd); }


x86 assembly (clang, -O0):
<LCD_AQM_wrcmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x3e,%edi
xor    %esi,%esi
movsbl -0x1(%rbp),%edx
call   1030 <i2c_send_byte_2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LCD_AQM_wrcmd>:
mov    %edi,%edx
mov    $0x3e,%edi
xor    %esi,%esi
jmp    1030 <i2c_send_byte_2@plt>

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

LLVM IR (-O2):
define i32 @LCD_AQM_wrcmd(i8 signext %0) {
%2 = tail call i32 @i2c_send_byte_2(i32 62, i32 0, i8 signext %0)
ret i32 %2
}
bug(int *p) { *p = 0xDEADBEEF; }


x86 assembly (clang, -O0):
<bug>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0xdeadbeef,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bug>:
movl   $0xdeadbeef,(%rdi)
ret

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

LLVM IR (-O2):
define i32 @bug(i32* nocapture writeonly %0) {
store i32 -559038737, i32* %0
ret i32 undef
}
/* Variables and functions */
scalar_t__ testchar(char);
int typechange(char ch, char next) {
  if ((testchar(ch) == testchar(next)))
    return 0;
  else
    return -1;
}


x86 assembly (clang, -O0):
<typechange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x5(%rbp)
mov    %al,-0x6(%rbp)
movsbl -0x5(%rbp),%edi
call   1030 <testchar@plt>
mov    %rax,-0x10(%rbp)
movsbl -0x6(%rbp),%edi
call   1030 <testchar@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
jne    1156 <typechange+0x46>
movl   $0x0,-0x4(%rbp)
jmp    115d <typechange+0x4d>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<typechange>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
call   1030 <testchar@plt>
mov    %rax,%rbx
mov    %ebp,%edi
call   1030 <testchar@plt>
xor    %ecx,%ecx
cmp    %rax,%rbx
setne  %cl
neg    %ecx
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @typechange(i8 signext %0, i8 signext %1) {
%3 = tail call i64 @testchar(i8 signext %0)
%4 = tail call i64 @testchar(i8 signext %1)
%5 = icmp ne i64 %3, %4
%6 = sext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ test4();
int main(void) {
  test4();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test4()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
int /*<<< orphan*/ scanf(char *, unsigned int *);
int main(void) {
  unsigned int i;
  scanf("%d", &i);
  printf("%u\n", i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%u\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ print_perl_unsupported_msg();
int perl_generate_script_unsupported(const char *outfile
                                     __attribute__((unused))) {
  print_perl_unsupported_msg();
  return -1;
}


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

x86 assembly (clang, -O2):
<perl_generate_script_unsupported>:
push   %rax
xor    %eax,%eax
call   1030 <print_perl_unsupported_msg@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @perl_generate_script_unsupported(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @print_perl_unsupported_msg()
ret i32 -1
}
/* Type definitions */
typedef int /*<<< orphan*/ int8_t;

/* Variables and functions */
int8_t ld_i8_be(const void *x) { return ((int8_t *)x)[0]; }


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

x86 assembly (clang, -O2):
<ld_i8_be>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @ld_i8_be(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = getelementptr inbounds i32, i32* %4, i64 0
%6 = load i32, i32* %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @ld_i8_be(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ __coverity_panic__();
void _assert_int_equal(const unsigned long long a, const unsigned long long b,
                       const char *const file, const int line) {
  __coverity_panic__();
}


x86 assembly (clang, -O0):
<_assert_int_equal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    $0x0,%al
call   1030 <__coverity_panic__@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @_assert_int_equal(i64 %0, i64 %1, i8* %2, i32 %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32
store i64 %0, i64* %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = call i32 (...) @__coverity_panic__()
ret void
}

LLVM IR (-O2):
define void @_assert_int_equal(i64 %0, i64 %1, i8* nocapture readnone %2, i32 %3) {
%5 = tail call i32 (...) @__coverity_panic__()
ret void
}
/* Type definitions */
typedef union sigval {
  int dummy;
} sigval;

/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void notify_func(union sigval sigval) { puts("notify_func"); }


x86 assembly (clang, -O0):
<notify_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
lea    0xede(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%union.sigval = type { i32 }
@.str = [12 x i8] c"notify_func\00"
define void @notify_func(i32 %0) {
%2 = alloca %union.sigval
%3 = getelementptr inbounds %union.sigval, %union.sigval* %2, i32 0, i32 0
store i32 %0, i32* %3
%4 = call i32 @puts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"notify_func\00"
define void @notify_func(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret void
}
int MAMain() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @MAMain() {
ret i32 0
}
unsigned long __ffs(unsigned long word) {
  int p = 0;
  for (; p < 8 * sizeof(word); ++p) {
    if (word & 1) {
      break;
    }
    word >>= 1;
  }
  return p;
}


x86 assembly (clang, -O0):
<__ffs>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movslq -0xc(%rbp),%rax
cmp    $0x40,%rax
jae    114e <__ffs+0x4e>
mov    -0x8(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     1134 <__ffs+0x34>
jmp    114e <__ffs+0x4e>
mov    -0x8(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <__ffs+0xf>
movslq -0xc(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__ffs>:
xor    %eax,%eax
test   $0x1,%dil
jne    112c <__ffs+0x2c>
nopl   0x0(%rax,%rax,1)
mov    %eax,%ecx
add    $0x1,%rax
cmp    $0x3e,%ecx
ja     112c <__ffs+0x2c>
mov    %rdi,%rcx
shr    %rcx
and    $0x2,%edi
test   %rdi,%rdi
mov    %rcx,%rdi
je     1110 <__ffs+0x10>
ret

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

LLVM IR (-O2):
define i64 @__ffs(i64 %0) {
%2 = and i64 %0, 1
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %15
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 0, %1 ]
%6 = phi i64 [ %7, %4 ], [ %0, %1 ]
%7 = lshr i64 %6, 1
%8 = add nuw nsw i32 %5, 1
%9 = icmp ult i32 %5, 63
%10 = and i64 %6, 2
%11 = icmp eq i64 %10, 0
%12 = select i1 %9, i1 %11, i1 false
br i1 %12, label %4, label %13
13: ; preds = %4
%14 = zext i32 %8 to i64
br label %15
15: ; preds = %13, %1
%16 = phi i64 [ 0, %1 ], [ %14, %13 ]
ret i64 %16
}
OP(ed, af) { illegal_2(); }


x86 assembly (clang, -O0):
<OP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <illegal_2@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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 = call i32 (...) @illegal_2()
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @illegal_2()
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pthread_create(int /*<<< orphan*/ *, int /*<<< orphan*/ *, void *, void *);
void backend_run_func_on(int core_id, void *cfunc, void *arg) {
  pthread_t pthread;
  int r = pthread_create(&pthread, NULL, cfunc, arg);
  if (r != 0) {
    printf("pthread_create failed\n");
  }
}


x86 assembly (clang, -O0):
<backend_run_func_on>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    -0x1c(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <pthread_create@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     1161 <backend_run_func_on+0x41>
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<backend_run_func_on>:
push   %rax
mov    %rdx,%rcx
mov    %rsi,%rdx
lea    0x4(%rsp),%rdi
xor    %esi,%esi
call   1040 <pthread_create@plt>
test   %eax,%eax
je     1143 <backend_run_func_on+0x23>
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [23 x i8] c"pthread_create failed\0A\00"
define void @backend_run_func_on(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = call i32 @pthread_create(i32* %7, i32* null, i8* %9, i8* %10)
store i32 %11, i32* %8
%12 = load i32, i32* %8
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %3
%15 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %14, %3
ret void
}

LLVM IR (-O2):
@str = [22 x i8] c"pthread_create failed\00"
define void @backend_run_func_on(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = call i32 @pthread_create(i32* %4, i32* null, i8* %1, i8* %2)
%7 = icmp eq i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %3
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
br label %10
10: ; preds = %8, %3
ret void
}
int host_request_exec_args(char *buffer, int max_buffer_size) {
  int ret;
  memset(buffer, 0, max_buffer_size);
  __asm__ __volatile__(".byte 0x0f, 0x3f\n"
                       ".byte 0x00, "
                       "0x20"
                       "\n"
                       ".byte "
                       "0x01"
                       ", 0x00\n"
                       ".byte 0x00, 0x00, 0x00\n"
                       ".byte 0x00\n"
                       : "=a"(ret)
                       : "a"(buffer), "b"(max_buffer_size));
  return ret;
}


x86 assembly (clang, -O0):
<host_request_exec_args>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x18,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ebx
(bad)
add    %ah,(%rax)
add    %eax,(%rax)
add    %al,(%rax)
add    %al,(%rax)
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<host_request_exec_args>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
movslq %esi,%rbx
xor    %esi,%esi
mov    %rbx,%rdx
call   1030 <memset@plt>
mov    %r14,%rax
(bad)
add    %ah,(%rax)
add    %eax,(%rax)
add    %al,(%rax)
add    %al,(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @host_request_exec_args(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = load i8*, i8** %3
%10 = load i32, i32* %4
%11 = call i32 asm sideeffect ".byte 0x0f, 0x3f\0A.byte 0x00, 0x20\0A.byte 0x01, 0x00\0A.byte 0x00, 0x00, 0x00\0A.byte 0x00\0A", "={ax},{ax},{bx},~{dirflag},~{fpsr},~{flags}"(i8* %9, i32 %10)
store i32 %11, i32* %5
%12 = load i32, i32* %5
ret i32 %12
}

LLVM IR (-O2):
define i32 @host_request_exec_args(i8* %0, i32 %1) {
%3 = sext i32 %1 to i64
tail call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 %3, i1 false)
%4 = tail call i32 asm sideeffect ".byte 0x0f, 0x3f\0A.byte 0x00, 0x20\0A.byte 0x01, 0x00\0A.byte 0x00, 0x00, 0x00\0A.byte 0x00\0A", "={ax},{ax},{bx},~{dirflag},~{fpsr},~{flags}"(i8* %0, i32 %1)
ret i32 %4
}
void rk_headset_report(int state) {}


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

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

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

LLVM IR (-O2):
define void @rk_headset_report(i32 %0) {
ret void
}
/* Variables and functions */
scalar_t__ is_blank(char const);
size_t nonblank_end(const char *str, size_t begin, size_t end) {
  while (begin < end && is_blank(str[end - 1])) {
    --end;
  }
  return (end);
}


x86 assembly (clang, -O0):
<nonblank_end>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
cmp    -0x18(%rbp),%rcx
mov    %al,-0x19(%rbp)
jae    1156 <nonblank_end+0x46>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <is_blank@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1166 <nonblank_end+0x56>
jmp    1177 <nonblank_end+0x67>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
jmp    1124 <nonblank_end+0x14>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nonblank_end>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r12
mov    %rsi,%r15
mov    %rdi,%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rbx
cmp    %r15,%r12
jbe    114c <nonblank_end+0x3c>
lea    -0x1(%rbx),%r12
movsbl -0x1(%r14,%rbx,1),%edi
call   1030 <is_blank@plt>
test   %rax,%rax
jne    1130 <nonblank_end+0x20>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @nonblank_end(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
br label %7
7: ; preds = %21, %3
%8 = load i64, i64* %5
%9 = load i64, i64* %6
%10 = icmp ult i64 %8, %9
br i1 %10, label %11, label %19
11: ; preds = %7
%12 = load i8*, i8** %4
%13 = load i64, i64* %6
%14 = sub i64 %13, 1
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = call i64 @is_blank(i8 signext %16)
%18 = icmp ne i64 %17, 0
br label %19
19: ; preds = %11, %7
%20 = phi i1 [ false, %7 ], [ %18, %11 ]
br i1 %20, label %21, label %24
21: ; preds = %19
%22 = load i64, i64* %6
%23 = add i64 %22, -1
store i64 %23, i64* %6
br label %7
24: ; preds = %19
%25 = load i64, i64* %6
ret i64 %25
}

LLVM IR (-O2):
define i64 @nonblank_end(i8* nocapture %0, i64 %1, i64 %2) {
br label %4
4: ; preds = %7, %3
%5 = phi i64 [ %2, %3 ], [ %8, %7 ]
%6 = icmp ugt i64 %5, %1
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = add i64 %5, -1
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = tail call i64 @is_blank(i8 signext %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %7
ret i64 %5
}
const char *LZ4_versionString(void) { return "1.7.5"; }


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"1.7.5\00"
define i8* @LZ4_versionString() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [6 x i8] c"1.7.5\00"
define i8* @LZ4_versionString() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}
int prog_q84abs(int A) {
  short S;
  if (A < 0)
    S = -A;
  else
    S = A;
  return S;
}


x86 assembly (clang, -O0):
<prog_q84abs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    111f <prog_q84abs+0x1f>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %ax,-0x6(%rbp)
jmp    1126 <prog_q84abs+0x26>
mov    -0x4(%rbp),%eax
mov    %ax,-0x6(%rbp)
movswl -0x6(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<prog_q84abs>:
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
cwtl
ret

LLVM IR (-O0):
define i32 @prog_q84abs(i32 %0) {
%2 = alloca i32
%3 = alloca i16
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %2
%8 = sub nsw i32 0, %7
%9 = trunc i32 %8 to i16
store i16 %9, i16* %3
br label %13
10: ; preds = %1
%11 = load i32, i32* %2
%12 = trunc i32 %11 to i16
store i16 %12, i16* %3
br label %13
13: ; preds = %10, %6
%14 = load i16, i16* %3
%15 = sext i16 %14 to i32
ret i32 %15
}

LLVM IR (-O2):
define i32 @prog_q84abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
%3 = shl i32 %2, 16
%4 = ashr exact i32 %3, 16
ret i32 %4
}
int clamp255(int i) { return ((i < 0) ? 0 : ((i > 255) ? 255 : i)); }


x86 assembly (clang, -O0):
<clamp255>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    111b <clamp255+0x1b>
xor    %eax,%eax
mov    %eax,-0x8(%rbp)
jmp    1141 <clamp255+0x41>
cmpl   $0xff,-0x4(%rbp)
jle    1135 <clamp255+0x35>
mov    $0xff,%eax
mov    %eax,-0xc(%rbp)
jmp    113b <clamp255+0x3b>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clamp255>:
cmp    $0xff,%edi
mov    $0xff,%ecx
cmovl  %edi,%ecx
xor    %eax,%eax
test   %ecx,%ecx
cmovns %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @clamp255(i32 %0) {
%2 = icmp slt i32 %0, 255
%3 = select i1 %2, i32 %0, i32 255
%4 = icmp sgt i32 %3, 0
%5 = select i1 %4, i32 %3, i32 0
ret i32 %5
}
int matches_leading(char *partial_line, char *pattern) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @matches_leading(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
/* Type definitions */
struct vicpdevice {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct vicpdevice *);
void deinitvicpdevice(struct vicpdevice *ws) { free(ws); }


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

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

LLVM IR (-O2):
%struct.vicpdevice = type { i32 }
define void @deinitvicpdevice(%struct.vicpdevice* nocapture %0) {
%2 = tail call i32 @free(%struct.vicpdevice* %0)
ret void
}
/* Variables and functions */
int RAND_MAX;
int rand();
int random_below(int max) {
  int i;
  int j;
  i = RAND_MAX / max;
  do {
    j = rand() / i;
  } while (j >= max);
  return j;
}


x86 assembly (clang, -O0):
<random_below>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ec6(%rip),%rax
mov    (%rax),%eax
cltd
idivl  -0x4(%rbp)
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
cltd
idivl  -0x8(%rbp)
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    112b <random_below+0x1b>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_below>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    0x2ecc(%rip),%rax
mov    (%rax),%eax
cltd
idiv   %edi
mov    %eax,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1030 <rand@plt>
cltd
idiv   %ebp
cmp    %ebx,%eax
jge    1130 <random_below+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@RAND_MAX = global i32 0
define i32 @random_below(i32 %0) {
%2 = load i32, i32* @RAND_MAX
%3 = sdiv i32 %2, %0
br label %4
4: ; preds = %4, %1
%5 = tail call i32 (...) @rand()
%6 = sdiv i32 %5, %3
%7 = icmp slt i32 %6, %0
br i1 %7, label %8, label %4
8: ; preds = %4
ret i32 %6
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct stat *);
void stat_free(struct stat *s) { free(s); }


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

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

LLVM IR (-O2):
%struct.stat = type { i32 }
define void @stat_free(%struct.stat* nocapture %0) {
%2 = tail call i32 @free(%struct.stat* %0)
ret void
}
/* Variables and functions */
#define FP_INFINITE 132
#define FP_NAN 131
#define FP_NORMAL 130
#define FP_SUBNORMAL 129
#define FP_ZERO 128
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int fpclassify(double);
int isfinite(double x) {
  switch (fpclassify(x)) {
  case FP_INFINITE:
  case FP_NAN:
    return 0;
  case FP_NORMAL:
  case FP_SUBNORMAL:
  case FP_ZERO:
    return 1;
  }
  assert(0);
  return -1;
}


x86 assembly (clang, -O0):
<isfinite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <fpclassify@plt>
mov    %eax,%ecx
mov    %ecx,%eax
add    $0xffffff80,%eax
mov    %ecx,-0x14(%rbp)
sub    $0x3,%eax
jb     1171 <isfinite+0x51>
jmp    114f <isfinite+0x2f>
mov    -0x14(%rbp),%eax
add    $0xffffff7d,%eax
sub    $0x1,%eax
ja     117d <isfinite+0x5d>
jmp    1165 <isfinite+0x45>
movl   $0x0,-0x4(%rbp)
jmp    118b <isfinite+0x6b>
movl   $0x1,-0x4(%rbp)
jmp    118b <isfinite+0x6b>
xor    %edi,%edi
call   1030 <assert@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isfinite>:
push   %rax
call   1040 <fpclassify@plt>
add    $0xffffff80,%eax
cmp    $0x5,%eax
jae    113c <isfinite+0x1c>
cltq
lea    0xec9(%rip),%rcx
mov    (%rcx,%rax,4),%eax
pop    %rcx
ret
xor    %edi,%edi
call   1030 <assert@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @isfinite(double %0) {
%2 = alloca i32
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = call i32 @fpclassify(double %4)
switch i32 %5, label %8 [
i32 132, label %6
i32 131, label %6
i32 130, label %7
i32 129, label %7
i32 128, label %7
]
6: ; preds = %1, %1
store i32 0, i32* %2
br label %10
7: ; preds = %1, %1, %1
store i32 1, i32* %2
br label %10
8: ; preds = %1
%9 = call i32 @assert(i32 0)
store i32 -1, i32* %2
br label %10
10: ; preds = %8, %7, %6
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
@switch.table.isfinite = [5 x i32] [i32 1, i32 1, i32 1, i32 0, i32 0]
define i32 @isfinite(double %0) {
%2 = tail call i32 @fpclassify(double %0)
%3 = add i32 %2, -128
%4 = icmp ult i32 %3, 5
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @assert(i32 0)
br label %11
7: ; preds = %1
%8 = sext i32 %3 to i64
%9 = getelementptr inbounds [5 x i32], [5 x i32]* @switch.table.isfinite, i64 0, i64 %8
%10 = load i32, i32* %9
br label %11
11: ; preds = %7, %5
%12 = phi i32 [ -1, %5 ], [ %10, %7 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
frobp(int argc, char **argv) {
  char *foo;
  puts(foo);
}


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

x86 assembly (clang, -O2):
<frobp>:
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
define i32 @frobp(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) undef)
ret i32 undef
}
/* Variables and functions */
float truncf(float);
float rintf(float x) { return truncf(x); }


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

x86 assembly (clang, -O2):
<rintf>:
jmp    1030 <truncf@plt>

LLVM IR (-O0):
define float @rintf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @llvm.trunc.f32(float %3)
ret float %4
}

LLVM IR (-O2):
define float @rintf(float %0) {
%2 = tail call float @llvm.trunc.f32(float %0)
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ UI_DEV_DESTROY;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ close(int);
int ioctl(int, int /*<<< orphan*/);
void uinput_close(int fd) {
  int rc;
  rc = ioctl(fd, UI_DEV_DESTROY);
  assert(!rc);
  close(fd);
}


x86 assembly (clang, -O0):
<uinput_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ea3(%rip),%rax
mov    (%rax),%esi
call   1030 <ioctl@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x4(%rbp),%edi
call   1040 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uinput_close>:
push   %rbx
mov    %edi,%ebx
mov    0x2eae(%rip),%rax
mov    (%rax),%esi
call   1030 <ioctl@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <close@plt>

LLVM IR (-O0):
@UI_DEV_DESTROY = global i32 0
define void @uinput_close(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* @UI_DEV_DESTROY
%6 = call i32 @ioctl(i32 %4, i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = load i32, i32* %2
%13 = call i32 @close(i32 %12)
ret void
}

LLVM IR (-O2):
@UI_DEV_DESTROY = global i32 0
define void @uinput_close(i32 %0) {
%2 = load i32, i32* @UI_DEV_DESTROY
%3 = tail call i32 @ioctl(i32 %0, i32 %2)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = tail call i32 @close(i32 %0)
ret void
}
main(argc, argv) int argc;
char *argv[];
{
  if (argc == 1) {
    rebuildall();
    exit(0);
  } else if (argc == 2) {
    rebuild(argv[1]);
    exit(0);
  } else {
    printf("Usage: %s <BoardName>\n", argv[0]);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    116e <main+0x2e>
mov    $0x0,%al
call   1060 <rebuildall@plt>
xor    %edi,%edi
call   1050 <exit@plt>
cmpl   $0x2,-0x8(%rbp)
jne    118e <main+0x4e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    $0x0,%al
call   1040 <rebuild@plt>
xor    %edi,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
je     1159 <main+0x19>
cmp    $0x1,%edi
jne    116b <main+0x2b>
xor    %eax,%eax
call   1060 <rebuildall@plt>
xor    %edi,%edi
call   1050 <exit@plt>
mov    0x8(%rsi),%rdi
xor    %eax,%eax
call   1040 <rebuild@plt>
xor    %edi,%edi
call   1050 <exit@plt>
mov    (%rsi),%rsi
lea    0xe8b(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"Usage: %s <BoardName>\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 (...) @rebuildall()
unreachable
10: ; preds = %2
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 2
br i1 %12, label %13, label %18
13: ; preds = %10
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 (i8*, ...) bitcast (i32 (...)* @rebuild to i32 (i8*, ...)*)(i8* %16)
unreachable
18: ; preds = %10
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %21)
unreachable
}

LLVM IR (-O2):
@.str = [23 x i8] c"Usage: %s <BoardName>\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %9 [
i32 1, label %3
i32 2, label %5
]
3: ; preds = %2
%4 = tail call i32 (...) @rebuildall()
tail call void @exit(i32 0)
unreachable
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i32 (i8*, ...) bitcast (i32 (...)* @rebuild to i32 (i8*, ...)*)(i8* %7)
tail call void @exit(i32 0)
unreachable
9: ; preds = %2
%10 = load i8*, i8** %1
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %10)
tail call void @exit(i32 1)
unreachable
}
/* Variables and functions */
int SrcLinear(short *, short *, double, int *, int);
int resample_simple(double factor, short *in_buf, short *out_buf,
                    int buffer_size) {
  int num;
  int time;
  time = (10 << 15);
  num = SrcLinear(in_buf, out_buf, factor, &time, buffer_size);
  return num;
}


x86 assembly (clang, -O0):
<resample_simple>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x50000,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
movsd  -0x8(%rbp),%xmm0
mov    -0x1c(%rbp),%ecx
lea    -0x24(%rbp),%rdx
call   1030 <SrcLinear@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<resample_simple>:
push   %rax
mov    %edx,%ecx
movl   $0x50000,0x4(%rsp)
lea    0x4(%rsp),%rdx
call   1030 <SrcLinear@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @resample_simple(double %0, i16* %1, i16* %2, i32 %3) {
%5 = alloca double
%6 = alloca i16*
%7 = alloca i16*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store double %0, double* %5
store i16* %1, i16** %6
store i16* %2, i16** %7
store i32 %3, i32* %8
store i32 327680, i32* %10
%11 = load i16*, i16** %6
%12 = load i16*, i16** %7
%13 = load double, double* %5
%14 = load i32, i32* %8
%15 = call i32 @SrcLinear(i16* %11, i16* %12, double %13, i32* %10, i32 %14)
store i32 %15, i32* %9
%16 = load i32, i32* %9
ret i32 %16
}

LLVM IR (-O2):
define i32 @resample_simple(double %0, i16* %1, i16* %2, i32 %3) {
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
store i32 327680, i32* %5
%7 = call i32 @SrcLinear(i16* %1, i16* %2, double %0, i32* %5, i32 %3)
ret i32 %7
}