xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t no_rnd_avg64(uint64_t a, uint64_t b) {
  return (a & b) + (((a ^ b) & ~((0x01) * 0x0001000100010001UL)) >> 1);
}


x86 assembly (clang, -O0):
<no_rnd_avg64>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    -0x8(%rbp),%eax
cltq
mov    -0x4(%rbp),%ecx
xor    -0x8(%rbp),%ecx
movslq %ecx,%rcx
movabs $0xfffefffefffefffe,%rdx
ff fe ff
and    %rdx,%rcx
shr    $0x1,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<no_rnd_avg64>:
mov    %esi,%eax
and    %edi,%eax
xor    %edi,%esi
shr    %esi
and    $0x7fff7fff,%esi
add    %esi,%eax
ret

LLVM IR (-O0):
define i32 @no_rnd_avg64(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 = and i32 %5, %6
%8 = sext i32 %7 to i64
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = xor i32 %9, %10
%12 = sext i32 %11 to i64
%13 = and i64 %12, -281479271743490
%14 = lshr i64 %13, 1
%15 = add i64 %8, %14
%16 = trunc i64 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @no_rnd_avg64(i32 %0, i32 %1) {
%3 = and i32 %1, %0
%4 = xor i32 %1, %0
%5 = lshr i32 %4, 1
%6 = and i32 %5, 2147450879
%7 = add i32 %6, %3
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
void put4k(FILE *file, char *buf) { fwrite(buf, 1, 4096, file); }


x86 assembly (clang, -O0):
<put4k>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x1,%esi
mov    $0x1000,%edx
call   1030 <fwrite@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put4k>:
mov    %rdi,%rcx
mov    %rsi,%rdi
mov    $0x1,%esi
mov    $0x1000,%edx
jmp    1030 <fwrite@plt>

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

LLVM IR (-O2):
define void @put4k(i32* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @fwrite(i8* %1, i32 1, i32 4096, i32* %0)
ret void
}
void free_matrix(double **m, int num_cols) {
  for (int i = 0; i < num_cols; i++) {
    free(m[i]);
  }
  free(m);
}


x86 assembly (clang, -O0):
<free_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1151 <free_matrix+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <free_matrix+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_matrix>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
jle    1142 <free_matrix+0x32>
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <free_matrix+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_matrix(double** %0, i32 %1) {
%3 = alloca double**
%4 = alloca i32
%5 = alloca i32
store double** %0, double*** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load double**, double*** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds double*, double** %11, i64 %13
%15 = load double*, double** %14
%16 = bitcast double* %15 to i8*
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
%21 = load double**, double*** %3
%22 = bitcast double** %21 to i8*
ret void
}

LLVM IR (-O2):
define void @free_matrix(double** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %8
6: ; preds = %8, %2
%7 = bitcast double** %0 to i8*
tail call void @free(i8* %7)
ret void
8: ; preds = %4, %8
%9 = phi i64 [ 0, %4 ], [ %13, %8 ]
%10 = getelementptr inbounds double*, double** %0, i64 %9
%11 = bitcast double** %10 to i8**
%12 = load i8*, i8** %11
tail call void @free(i8* %12)
%13 = add nuw nsw i64 %9, 1
%14 = icmp eq i64 %13, %5
br i1 %14, label %6, label %8
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int syscon_clear_quaddobl_system(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc(387, a, b, c);
  return fail;
}


x86 assembly (clang, -O0):
<syscon_clear_quaddobl_system>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x183,%edi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<syscon_clear_quaddobl_system>:
mov    $0x183,%edi
jmp    1030 <_ada_use_c2phc@plt>

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

LLVM IR (-O2):
define i32 @syscon_clear_quaddobl_system() {
%1 = tail call i32 @_ada_use_c2phc(i32 387, i32* undef, i32* undef, double* undef)
ret i32 %1
}
const char *unac_version(void) { return "1.8.0"; }


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"1.8.0\00"
define i8* @unac_version() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}
int f(int a, int b, int c) {
  if (c > 5)
    return c;
  if (a == 0)
    return b;
  return a + b;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x5,-0x10(%rbp)
jle    1122 <f+0x22>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1140 <f+0x40>
cmpl   $0x0,-0x8(%rbp)
jne    1137 <f+0x37>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1140 <f+0x40>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
lea    (%rdi,%rsi,1),%eax
cmp    $0x6,%edx
cmovge %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @f(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, 5
%5 = add nsw i32 %1, %0
%6 = select i1 %4, i32 %2, i32 %5
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ a1;
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int a[10];
  int *a1 = a;
  printf("%ld\n", sizeof(a));
  printf("%ld\n", sizeof(a1));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    0xed9(%rip),%rdi
mov    $0x28,%esi
call   1030 <printf@plt>
lea    0xec8(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x28,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 40)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 8)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ DriveReg1_SaveConfig();
void DriveReg1_Sleep(void) { DriveReg1_SaveConfig(); }


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

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

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

LLVM IR (-O2):
define void @DriveReg1_Sleep() {
%1 = tail call i32 (...) @DriveReg1_SaveConfig()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ uart_init();
int /*<<< orphan*/ uart_puts(char *);
void main(void) {
  uart_init();
  uart_puts("\n");
  uart_puts("Eat more fish!\n");
  for (;;)
    ;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <uart_init@plt>
lea    0xedc(%rip),%rdi
call   1040 <uart_puts@plt>
lea    0xec2(%rip),%rdi
call   1040 <uart_puts@plt>
jmp    1143 <main+0x23>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <uart_init@plt>
lea    0xedf(%rip),%rdi
call   1040 <uart_puts@plt>
lea    0xec5(%rip),%rdi
call   1040 <uart_puts@plt>
jmp    1140 <main+0x20>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [16 x i8] c"Eat more fish!\0A\00"
define void @main() {
%1 = call i32 (...) @uart_init()
%2 = call i32 @uart_puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @uart_puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %4
4: ; preds = %4, %0
br label %4
}

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [16 x i8] c"Eat more fish!\0A\00"
define void @main() {
%1 = tail call i32 (...) @uart_init()
%2 = tail call i32 @uart_puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @uart_puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %4
4: ; preds = %4, %0
br label %4
}
/* Variables and functions */
float cos(float);
float pow(float, int);
float sin(float);
float funct(float x) { return (x * cos(x) - pow(x, 2) * sin(x)); }


x86 assembly (clang, -O0):
<funct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <sin@plt>
movss  -0x10(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0x8(%rbp),%xmm0
mulss  %xmm3,%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<funct>:
sub    $0x18,%rsp
movss  %xmm0,0xc(%rsp)
call   1040 <cos@plt>
movss  %xmm0,0x14(%rsp)
movss  0xc(%rsp),%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
movss  %xmm0,0x10(%rsp)
movss  0xc(%rsp),%xmm0
call   1030 <sin@plt>
mulss  0x10(%rsp),%xmm0
movss  0x14(%rsp),%xmm1
mulss  0xc(%rsp),%xmm1
subss  %xmm0,%xmm1
movaps %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float @funct(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = load float, float* %2
%5 = call float @cos(float %4)
%6 = load float, float* %2
%7 = call float @pow(float %6, i32 2)
%8 = load float, float* %2
%9 = call float @sin(float %8)
%10 = fmul float %7, %9
%11 = fneg float %10
%12 = call float @llvm.fmuladd.f32(float %3, float %5, float %11)
ret float %12
}

LLVM IR (-O2):
define float @funct(float %0) {
%2 = tail call float @cos(float %0)
%3 = tail call float @pow(float %0, i32 2)
%4 = tail call float @sin(float %0)
%5 = fneg float %3
%6 = fmul float %4, %5
%7 = tail call float @llvm.fmuladd.f32(float %0, float %2, float %6)
ret float %7
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ wcstombs(char *, int /*<<< orphan*/ *, int);
char *wide2str(wchar_t *src) {
  int len = wcstombs(NULL, src, 0) + 1;
  char *dest = malloc((len + 1) * sizeof(char));
  wcstombs(dest, src, len);
  if (!dest)
    dest = "";
  return dest;
}


x86 assembly (clang, -O0):
<wide2str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
xor    %edx,%edx
call   1040 <wcstombs@plt>
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1040 <wcstombs@plt>
cmpq   $0x0,-0x18(%rbp)
jne    117e <wide2str+0x5e>
lea    0xe86(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wide2str>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   1040 <wcstombs@plt>
lea    0x1(%rax),%r14d
lea    0x2(%rax),%edi
call   1030 <malloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1040 <wcstombs@plt>
test   %rbp,%rbp
lea    0xea6(%rip),%rax
cmovne %rbp,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @wide2str(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i8*
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = call i32 @wcstombs(i8* null, i32* %5, i32 0)
%7 = add nsw i32 %6, 1
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 1
%10 = sext i32 %9 to i64
%11 = mul i64 %10, 1
%12 = trunc i64 %11 to i32
%13 = call i8* @malloc(i32 %12)
store i8* %13, i8** %4
%14 = load i8*, i8** %4
%15 = load i32*, i32** %2
%16 = load i32, i32* %3
%17 = call i32 @wcstombs(i8* %14, i32* %15, i32 %16)
%18 = load i8*, i8** %4
%19 = icmp ne i8* %18, null
br i1 %19, label %21, label %20
20: ; preds = %1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %4
br label %21
21: ; preds = %20, %1
%22 = load i8*, i8** %4
ret i8* %22
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @wide2str(i32* %0) {
%2 = tail call i32 @wcstombs(i8* null, i32* %0, i32 0)
%3 = add nsw i32 %2, 1
%4 = add nsw i32 %2, 2
%5 = tail call i8* @malloc(i32 %4)
%6 = tail call i32 @wcstombs(i8* %5, i32* %0, i32 %3)
%7 = icmp eq i8* %5, null
%8 = select i1 %7, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %5
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ bit_get_msb_pos(int);
int bit_unset(int, int /*<<< orphan*/);
int bit_clear_msb(int n) { return bit_unset(n, bit_get_msb_pos(n)); }


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

x86 assembly (clang, -O2):
<bit_clear_msb>:
push   %rbx
mov    %edi,%ebx
call   1030 <bit_get_msb_pos@plt>
mov    %ebx,%edi
mov    %eax,%esi
pop    %rbx
jmp    1040 <bit_unset@plt>

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

LLVM IR (-O2):
define i32 @bit_clear_msb(i32 %0) {
%2 = tail call i32 @bit_get_msb_pos(i32 %0)
%3 = tail call i32 @bit_unset(i32 %0, i32 %2)
ret i32 %3
}
void rt_low_level_init(void) {
  (*(volatile unsigned int *)(((0XFFFFF000) + 0x124)) = (0xFFFFFFFF));
  (*(volatile unsigned int *)(((0XFFFFF000) + 0x128)) = (0xFFFFFFFF));
  (*(volatile unsigned int *)(((0XFFFFEE00) + 0x100)) = ((1 << 0) | (1 << 1)));
  (*(volatile unsigned int *)(((0XFFFFFD40) + 0x00)) =
       ((0xA5000000) | (0x00000001)));
  (*(volatile unsigned int *)(((0XFFFFFD40) + 0x04)) = ((0x00008000)));
}


x86 assembly (clang, -O0):
<rt_low_level_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfffff124,%eax
movl   $0xffffffff,(%rax)
mov    $0xfffff128,%eax
movl   $0xffffffff,(%rax)
mov    $0xffffef00,%eax
movl   $0x3,(%rax)
mov    $0xfffffd40,%eax
movl   $0xa5000001,(%rax)
mov    $0xfffffd44,%eax
movl   $0x8000,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rt_low_level_init>:
mov    $0xffffef00,%eax
movl   $0xffffffff,0x224(%rax)
ff ff ff
movl   $0xffffffff,0x228(%rax)
ff ff ff
movl   $0x3,(%rax)
movl   $0xa5000001,0xe40(%rax)
movl   $0x8000,0xe44(%rax)
ret

LLVM IR (-O0):
define void @rt_low_level_init() {
store volatile i32 -1, i32* inttoptr (i64 4294963492 to i32*)
store volatile i32 -1, i32* inttoptr (i64 4294963496 to i32*)
store volatile i32 3, i32* inttoptr (i64 4294962944 to i32*)
store volatile i32 -1526726655, i32* inttoptr (i64 4294966592 to i32*)
store volatile i32 32768, i32* inttoptr (i64 4294966596 to i32*)
ret void
}

LLVM IR (-O2):
define void @rt_low_level_init() {
store volatile i32 -1, i32* inttoptr (i64 4294963492 to i32*)
store volatile i32 -1, i32* inttoptr (i64 4294963496 to i32*)
store volatile i32 3, i32* inttoptr (i64 4294962944 to i32*)
store volatile i32 -1526726655, i32* inttoptr (i64 4294966592 to i32*)
store volatile i32 32768, i32* inttoptr (i64 4294966596 to i32*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ wr_char(unsigned char const);
void wr_buf(const unsigned char *str, int len) {
  int i;
  for (i = 0; i < len; i++) {
    wr_char(str[i]);
  }
}


x86 assembly (clang, -O0):
<wr_buf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1151 <wr_buf+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
call   1030 <wr_char@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <wr_buf+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wr_buf>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    1143 <wr_buf+0x33>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl (%r14,%rbx,1),%edi
call   1030 <wr_char@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <wr_buf+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @wr_buf(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = tail call i32 @wr_char(i8 zeroext %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
/* Variables and functions */
int strlen(char const *);
int stringStat(const char *string, size_t multiplier, int *count) {
  int len = strlen(string);
  *count += 1;
  return len * multiplier;
}


x86 assembly (clang, -O0):
<stringStat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
movslq -0x1c(%rbp),%rax
imul   -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stringStat>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r14
call   1030 <strlen@plt>
addl   $0x1,(%rbx)
imul   %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @stringStat(i8* %0, i64 %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32*
%7 = alloca i32
store i8* %0, i8** %4
store i64 %1, i64* %5
store i32* %2, i32** %6
%8 = load i8*, i8** %4
%9 = call i32 @strlen(i8* %8)
store i32 %9, i32* %7
%10 = load i32*, i32** %6
%11 = load i32, i32* %10
%12 = add nsw i32 %11, 1
store i32 %12, i32* %10
%13 = load i32, i32* %7
%14 = sext i32 %13 to i64
%15 = load i64, i64* %5
%16 = mul i64 %14, %15
%17 = trunc i64 %16 to i32
ret i32 %17
}

LLVM IR (-O2):
define i32 @stringStat(i8* %0, i64 %1, i32* nocapture %2) {
%4 = tail call i32 @strlen(i8* %0)
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 1
store i32 %6, i32* %2
%7 = trunc i64 %1 to i32
%8 = mul i32 %4, %7
ret i32 %8
}
void XtRemoveActionHook() {}


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

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

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

LLVM IR (-O2):
define void @XtRemoveActionHook() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void aligned_free(void *pointer) { free(pointer); }


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

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

LLVM IR (-O2):
define void @aligned_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
void outsl(unsigned short port, const void *addr, unsigned long count) {
  __asm__ __volatile__("rep ; outs"
                       "l"
                       : "=S"(addr), "=c"(count)
                       : "d"(port), "0"(addr), "1"(count));
}


x86 assembly (clang, -O0):
<outsl>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x2(%rbp),%dx
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
rep outsl %ds:(%rsi),(%dx)
mov    %rsi,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<outsl>:
mov    %rdx,%rcx
mov    %edi,%edx
rep outsl %ds:(%rsi),(%dx)
ret

LLVM IR (-O0):
define void @outsl(i16 zeroext %0, i8* %1, i64 %2) {
%4 = alloca i16
%5 = alloca i8*
%6 = alloca i64
store i16 %0, i16* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i16, i16* %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call { i8*, i64 } asm sideeffect "rep ; outsl", "={si},={cx},{dx},0,1,~{dirflag},~{fpsr},~{flags}"(i16 %7, i8* %8, i64 %9)
%11 = extractvalue { i8*, i64 } %10, 0
%12 = extractvalue { i8*, i64 } %10, 1
store i8* %11, i8** %5
store i64 %12, i64* %6
ret void
}

LLVM IR (-O2):
define void @outsl(i16 zeroext %0, i8* %1, i64 %2) {
%4 = tail call { i8*, i64 } asm sideeffect "rep ; outsl", "={si},={cx},{dx},0,1,~{dirflag},~{fpsr},~{flags}"(i16 %0, i8* %1, i64 %2)
ret void
}
void rop3_152_1_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  stk3 = T | S;
  stk3 = ~stk3;
  stk2 = *D | stk3;
  stk1 = S ^ stk2;
  stk1 = ~stk1;
  *D = (stk1 & (~S)) | (*D & S);
}


x86 assembly (clang, -O0):
<rop3_152_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0x9(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xd(%rbp)
movzbl -0xd(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xd(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xc(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_152_1_0>:
mov    (%rdi),%al
not    %dl
or     %sil,%dl
or     %al,%dl
not    %dl
and    %sil,%al
or     %dl,%al
mov    %al,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_152_1_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%10 = load i8, i8* %6
%11 = zext i8 %10 to i32
%12 = load i8, i8* %5
%13 = zext i8 %12 to i32
%14 = or i32 %11, %13
%15 = trunc i32 %14 to i8
store i8 %15, i8* %9
%16 = load i8, i8* %9
%17 = zext i8 %16 to i32
%18 = xor i32 %17, -1
%19 = trunc i32 %18 to i8
store i8 %19, i8* %9
%20 = load i8*, i8** %4
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = load i8, i8* %9
%24 = zext i8 %23 to i32
%25 = or i32 %22, %24
%26 = trunc i32 %25 to i8
store i8 %26, i8* %8
%27 = load i8, i8* %5
%28 = zext i8 %27 to i32
%29 = load i8, i8* %8
%30 = zext i8 %29 to i32
%31 = xor i32 %28, %30
%32 = trunc i32 %31 to i8
store i8 %32, i8* %7
%33 = load i8, i8* %7
%34 = zext i8 %33 to i32
%35 = xor i32 %34, -1
%36 = trunc i32 %35 to i8
store i8 %36, i8* %7
%37 = load i8, i8* %7
%38 = zext i8 %37 to i32
%39 = load i8, i8* %5
%40 = zext i8 %39 to i32
%41 = xor i32 %40, -1
%42 = and i32 %38, %41
%43 = load i8*, i8** %4
%44 = load i8, i8* %43
%45 = zext i8 %44 to i32
%46 = load i8, i8* %5
%47 = zext i8 %46 to i32
%48 = and i32 %45, %47
%49 = or i32 %42, %48
%50 = trunc i32 %49 to i8
%51 = load i8*, i8** %4
store i8 %50, i8* %51
ret void
}

LLVM IR (-O2):
define void @rop3_152_1_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = xor i8 %2, -1
%6 = or i8 %5, %1
%7 = or i8 %6, %4
%8 = xor i8 %7, -1
%9 = and i8 %4, %1
%10 = or i8 %9, %8
store i8 %10, i8* %0
ret void
}
/* Variables and functions */
char *malloc(unsigned int);
int /*<<< orphan*/ memcpy(char *, char const *, unsigned int);
char *pstrndup(const char *str, unsigned int str_length) {
  char *b;
  b = malloc(str_length + 1);
  if (!b) {
    return NULL;
  }
  memcpy(b, str, str_length);
  b[str_length] = '\0';
  return b;
}


x86 assembly (clang, -O0):
<pstrndup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%edi
add    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1156 <pstrndup+0x36>
movq   $0x0,-0x8(%rbp)
jmp    1179 <pstrndup+0x59>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pstrndup>:
push   %r15
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%r15
lea    0x1(%r14),%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1151 <pstrndup+0x31>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14d,%edx
call   1030 <memcpy@plt>
mov    %r14d,%eax
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @pstrndup(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
%7 = load i32, i32* %5
%8 = add i32 %7, 1
%9 = call i8* @malloc(i32 %8)
store i8* %9, i8** %6
%10 = load i8*, i8** %6
%11 = icmp ne i8* %10, null
br i1 %11, label %13, label %12
12: ; preds = %2
store i8* null, i8** %3
br label %23
13: ; preds = %2
%14 = load i8*, i8** %6
%15 = load i8*, i8** %4
%16 = load i32, i32* %5
%17 = call i32 @memcpy(i8* %14, i8* %15, i32 %16)
%18 = load i8*, i8** %6
%19 = load i32, i32* %5
%20 = zext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
store i8 0, i8* %21
%22 = load i8*, i8** %6
store i8* %22, i8** %3
br label %23
23: ; preds = %13, %12
%24 = load i8*, i8** %3
ret i8* %24
}

LLVM IR (-O2):
define i8* @pstrndup(i8* %0, i32 %1) {
%3 = add i32 %1, 1
%4 = tail call i8* @malloc(i32 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = tail call i32 @memcpy(i8* %4, i8* %0, i32 %1)
%8 = zext i32 %1 to i64
%9 = getelementptr inbounds i8, i8* %4, i64 %8
store i8 0, i8* %9
br label %10
10: ; preds = %2, %6
ret i8* %4
}
char *str_copy(char *d, const char *s) {
  char *t = d;
  while (*d++ = *s++)
    ;
  return t;
}


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

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

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

LLVM IR (-O2):
define i8* @str_copy(i8* returned writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %1, %2 ], [ %6, %3 ]
%5 = phi i8* [ %0, %2 ], [ %8, %3 ]
%6 = getelementptr inbounds i8, i8* %4, i64 1
%7 = load i8, i8* %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %7, i8* %5
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret i8* %0
}
/* Type definitions */
typedef scalar_t__ int64_t;
typedef scalar_t__ int32_t;

/* Variables and functions */
scalar_t__ __stdfix_sat_lr(scalar_t__);
int32_t __stdfix_sadd_lr(int32_t x, int32_t y) {
  return (__stdfix_sat_lr((int64_t)x + (int64_t)y));
}


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

x86 assembly (clang, -O2):
<__stdfix_sadd_lr>:
add    %rsi,%rdi
jmp    1030 <__stdfix_sat_lr@plt>

LLVM IR (-O0):
define i64 @__stdfix_sadd_lr(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = add nsw i64 %5, %6
%8 = call i64 @__stdfix_sat_lr(i64 %7)
ret i64 %8
}

LLVM IR (-O2):
define i64 @__stdfix_sadd_lr(i64 %0, i64 %1) {
%3 = add nsw i64 %1, %0
%4 = tail call i64 @__stdfix_sat_lr(i64 %3)
ret i64 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int /*<<< orphan*/ pthread_mutex_destroy(int /*<<< orphan*/ *);
void pthread_destroy_mutex(const pthread_mutex_t *mutex) {
  pthread_mutex_destroy((pthread_mutex_t *)mutex);
}


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

x86 assembly (clang, -O2):
<pthread_destroy_mutex>:
jmp    1030 <pthread_mutex_destroy@plt>

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

LLVM IR (-O2):
define void @pthread_destroy_mutex(i32* %0) {
%2 = tail call i32 @pthread_mutex_destroy(i32* %0)
ret void
}
int IsBlank(char c) { return c == ' '; }


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

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

LLVM IR (-O0):
define i32 @IsBlank(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, 32
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @IsBlank(i8 signext %0) {
%2 = icmp eq i8 %0, 32
%3 = zext i1 %2 to i32
ret i32 %3
}
double cephes_pdtr(k, m)
int k;
double m;
{
  double v;
  if ((k < 0) || (m <= 0.0)) {
    mtherr("pdtr", 1);
    return (0.0);
  }
  v = k + 1;
  return (cephes_igamc(v, m));
}


x86 assembly (clang, -O0):
<cephes_pdtr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1148 <cephes_pdtr+0x28>
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     1168 <cephes_pdtr+0x48>
lea    0xeb1(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1040 <mtherr@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1191 <cephes_pdtr+0x71>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mov    $0x2,%al
call   1030 <cephes_igamc@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cephes_pdtr>:
push   %rax
test   %edi,%edi
js     114d <cephes_pdtr+0x2d>
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jae    114d <cephes_pdtr+0x2d>
add    $0x1,%edi
xorps  %xmm0,%xmm0
cvtsi2sd %edi,%xmm0
mov    $0x2,%al
call   1030 <cephes_igamc@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
pop    %rax
ret
lea    0xeac(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <mtherr@plt>
xorpd  %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"pdtr\00"
define double @cephes_pdtr(i32 %0, double %1) {
%3 = alloca double
%4 = alloca i32
%5 = alloca double
%6 = alloca double
store i32 %0, i32* %4
store double %1, double* %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %2
%10 = load double, double* %5
%11 = fcmp ole double %10, 0.000000e+00
br i1 %11, label %12, label %14
12: ; preds = %9, %2
%13 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @mtherr to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 1)
store double 0.000000e+00, double* %3
br label %22
14: ; preds = %9
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 1
%17 = sitofp i32 %16 to double
store double %17, double* %6
%18 = load double, double* %6
%19 = load double, double* %5
%20 = call i32 (double, double, ...) bitcast (i32 (...)* @cephes_igamc to i32 (double, double, ...)*)(double %18, double %19)
%21 = sitofp i32 %20 to double
store double %21, double* %3
br label %22
22: ; preds = %14, %12
%23 = load double, double* %3
ret double %23
}

LLVM IR (-O2):
@.str = [5 x i8] c"pdtr\00"
define double @cephes_pdtr(i32 %0, double %1) {
%3 = icmp slt i32 %0, 0
%4 = fcmp ole double %1, 0.000000e+00
%5 = or i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @mtherr to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 1)
br label %13
8: ; preds = %2
%9 = add nuw nsw i32 %0, 1
%10 = sitofp i32 %9 to double
%11 = tail call i32 (double, double, ...) bitcast (i32 (...)* @cephes_igamc to i32 (double, double, ...)*)(double %10, double %1)
%12 = sitofp i32 %11 to double
br label %13
13: ; preds = %8, %6
%14 = phi double [ 0.000000e+00, %6 ], [ %12, %8 ]
ret double %14
}
/* Variables and functions */
scalar_t__ malloc(int);
int main() {
  struct base {
    int basic;
  };
  struct derived {
    struct base common;
    char extra;
  };
  struct base *bp;
  bp = (struct base *)malloc(sizeof(struct derived));
  bp->basic = 10;
  ((struct derived *)bp)->extra = 'x';
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x8,%edi
call   1030 <malloc@plt>
movl   $0xa,(%rax)
movb   $0x78,0x4(%rax)
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.base = type { i32 }
%struct.derived = type { %struct.base, i8 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.base*
store i32 0, i32* %1
%3 = call i64 @malloc(i32 8)
%4 = inttoptr i64 %3 to %struct.base*
store %struct.base* %4, %struct.base** %2
%5 = load %struct.base*, %struct.base** %2
%6 = getelementptr inbounds %struct.base, %struct.base* %5, i32 0, i32 0
store i32 10, i32* %6
%7 = load %struct.base*, %struct.base** %2
%8 = bitcast %struct.base* %7 to %struct.derived*
%9 = getelementptr inbounds %struct.derived, %struct.derived* %8, i32 0, i32 1
store i8 120, i8* %9
ret i32 0
}

LLVM IR (-O2):
%struct.base = type { i32 }
%struct.derived = type { %struct.base, i8 }
define i32 @main() {
%1 = tail call i64 @malloc(i32 8)
%2 = inttoptr i64 %1 to %struct.base*
%3 = getelementptr inbounds %struct.base, %struct.base* %2, i64 0, i32 0
store i32 10, i32* %3
%4 = inttoptr i64 %1 to %struct.derived*
%5 = getelementptr inbounds %struct.derived, %struct.derived* %4, i64 0, i32 1
store i8 120, i8* %5
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ bcopy(void const *, void *, size_t);
void *memmove(void *s1, const void *s2, size_t n) {
  bcopy(s2, s1, n);
  return s1;
}


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

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

LLVM IR (-O0):
define i8* @memmove(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %5
%8 = load i8*, i8** %4
%9 = load i64, i64* %6
%10 = call i32 @bcopy(i8* %7, i8* %8, i64 %9)
%11 = load i8*, i8** %4
ret i8* %11
}

LLVM IR (-O2):
define i8* @memmove(i8* returned writeonly %0, i8* nocapture %1, i64 %2) {
tail call void @llvm.memmove.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 %1, i64 %2, i1 false)
ret i8* %0
}
int putchar(int c) { return c; }


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

x86 assembly (clang, -O2):
<putchar>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @putchar(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ assert(char *);
int /*<<< orphan*/ read_buffer_prealloc(unsigned int *, void *);
void read_string_prealloc(char *body) {
  unsigned size;
  assert(body);
  read_buffer_prealloc(&size, (void *)body);
  body[size] = 0;
}


x86 assembly (clang, -O0):
<read_string_prealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdi
call   1040 <read_buffer_prealloc@plt>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
movb   $0x0,(%rax,%rcx,1)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_string_prealloc>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
call   1030 <assert@plt>
lea    0xc(%rsp),%rdi
mov    %rbx,%rsi
call   1040 <read_buffer_prealloc@plt>
mov    0xc(%rsp),%eax
movb   $0x0,(%rbx,%rax,1)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @read_string_prealloc(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @assert(i8* %4)
%6 = load i8*, i8** %2
%7 = call i32 @read_buffer_prealloc(i32* %3, i8* %6)
%8 = load i8*, i8** %2
%9 = load i32, i32* %3
%10 = zext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
store i8 0, i8* %11
ret void
}

LLVM IR (-O2):
define void @read_string_prealloc(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 @assert(i8* %0)
%5 = call i32 @read_buffer_prealloc(i32* %2, i8* %0)
%6 = load i32, i32* %2
%7 = zext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
store i8 0, i8* %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ moveArm(int, int);
int /*<<< orphan*/ moveClaw(int, int);
int /*<<< orphan*/ moveForward(int, int);
int /*<<< orphan*/ stopMotors();
int /*<<< orphan*/ turnLeft(int, int);
void runAutonomous() {
  moveClaw(127, 500);
  moveForward(127, 1000);
  moveClaw(-127, 500);
  moveArm(127, 250);
  turnLeft(127, 500);
  stopMotors();
}


x86 assembly (clang, -O0):
<runAutonomous>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7f,%edi
mov    $0x1f4,%esi
call   1040 <moveClaw@plt>
mov    $0x7f,%edi
mov    $0x3e8,%esi
call   1060 <moveForward@plt>
mov    $0xffffff81,%edi
mov    $0x1f4,%esi
call   1040 <moveClaw@plt>
mov    $0x7f,%edi
mov    $0xfa,%esi
call   1030 <moveArm@plt>
mov    $0x7f,%edi
mov    $0x1f4,%esi
call   1070 <turnLeft@plt>
mov    $0x0,%al
call   1050 <stopMotors@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<runAutonomous>:
push   %rax
mov    $0x7f,%edi
mov    $0x1f4,%esi
call   1040 <moveClaw@plt>
mov    $0x7f,%edi
mov    $0x3e8,%esi
call   1060 <moveForward@plt>
mov    $0xffffff81,%edi
mov    $0x1f4,%esi
call   1040 <moveClaw@plt>
mov    $0x7f,%edi
mov    $0xfa,%esi
call   1030 <moveArm@plt>
mov    $0x7f,%edi
mov    $0x1f4,%esi
call   1070 <turnLeft@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <stopMotors@plt>

LLVM IR (-O0):
define void @runAutonomous() {
%1 = call i32 @moveClaw(i32 127, i32 500)
%2 = call i32 @moveForward(i32 127, i32 1000)
%3 = call i32 @moveClaw(i32 -127, i32 500)
%4 = call i32 @moveArm(i32 127, i32 250)
%5 = call i32 @turnLeft(i32 127, i32 500)
%6 = call i32 (...) @stopMotors()
ret void
}

LLVM IR (-O2):
define void @runAutonomous() {
%1 = tail call i32 @moveClaw(i32 127, i32 500)
%2 = tail call i32 @moveForward(i32 127, i32 1000)
%3 = tail call i32 @moveClaw(i32 -127, i32 500)
%4 = tail call i32 @moveArm(i32 127, i32 250)
%5 = tail call i32 @turnLeft(i32 127, i32 500)
%6 = tail call i32 (...) @stopMotors()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ FUTEX_WAKE;
int /*<<< orphan*/ INT_MAX;
int futex_op(int *, int /*<<< orphan*/, int /*<<< orphan*/,
             int /*<<< orphan*/ *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int futex_wake(int *addr) {
  int err;
  err = futex_op(addr, FUTEX_WAKE, INT_MAX, NULL, NULL, 0);
  return err < 0 ? err : 0;
}


x86 assembly (clang, -O0):
<futex_wake>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea9(%rip),%rax
mov    (%rax),%esi
mov    0x2eb8(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%r8d
xor    %r9d,%r9d
mov    %r8,%rcx
call   1030 <futex_op@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    115a <futex_wake+0x4a>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1164 <futex_wake+0x54>
xor    %eax,%eax
mov    %eax,-0x10(%rbp)
jmp    1164 <futex_wake+0x54>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<futex_wake>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%esi
mov    0x2ec7(%rip),%rax
mov    (%rax),%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1030 <futex_op@plt>
mov    %eax,%ecx
sar    $0x1f,%ecx
and    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@FUTEX_WAKE = global i32 0
@INT_MAX = global i32 0
define i32 @futex_wake(i32* %0) {
%2 = load i32, i32* @FUTEX_WAKE
%3 = load i32, i32* @INT_MAX
%4 = tail call i32 @futex_op(i32* %0, i32 %2, i32 %3, i32* null, i32* null, i32 0)
%5 = icmp slt i32 %4, 0
%6 = select i1 %5, i32 %4, i32 0
ret i32 %6
}
void uDelay(const unsigned int usec) {
  unsigned int count = 0;
  const unsigned int utime = (120 * usec);
  do {
    if (++count > utime) {
      return;
    }
  } while (1);
}


x86 assembly (clang, -O0):
<uDelay>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
imul   $0x78,-0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmp    -0xc(%rbp),%eax
jbe    112c <uDelay+0x2c>
jmp    1140 <uDelay+0x40>
jmp    1131 <uDelay+0x31>
mov    $0x1,%al
test   $0x1,%al
jne    1115 <uDelay+0x15>
jmp    1140 <uDelay+0x40>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @uDelay(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bl_test();
int /*<<< orphan*/ blx_test();
int /*<<< orphan*/ bx_test();
void branch_instruction_test(void) {
  bl_test();
  blx_test();
  bx_test();
}


x86 assembly (clang, -O0):
<branch_instruction_test>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <bl_test@plt>
mov    $0x0,%al
call   1040 <blx_test@plt>
mov    $0x0,%al
call   1050 <bx_test@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<branch_instruction_test>:
push   %rax
xor    %eax,%eax
call   1030 <bl_test@plt>
xor    %eax,%eax
call   1040 <blx_test@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <bx_test@plt>

LLVM IR (-O0):
define void @branch_instruction_test() {
%1 = call i32 (...) @bl_test()
%2 = call i32 (...) @blx_test()
%3 = call i32 (...) @bx_test()
ret void
}

LLVM IR (-O2):
define void @branch_instruction_test() {
%1 = tail call i32 (...) @bl_test()
%2 = tail call i32 (...) @blx_test()
%3 = tail call i32 (...) @bx_test()
ret void
}