xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ g5_calculate_force_on_xMC(int /*<<< orphan*/, double **,
                                             double **, double *, int);
void g5_calculate_force_on_x(double (*x)[3], double (*a)[3], double *p,
                             int ni) {
  g5_calculate_force_on_xMC(0, x, a, p, ni);
}


x86 assembly (clang, -O0):
<g5_calculate_force_on_x>:
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    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
xor    %edi,%edi
call   1030 <g5_calculate_force_on_xMC@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g5_calculate_force_on_x>:
mov    %ecx,%r8d
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rdi,%rsi
xor    %edi,%edi
jmp    1030 <g5_calculate_force_on_xMC@plt>

LLVM IR (-O0):
define void @g5_calculate_force_on_x([3 x double]* %0, [3 x double]* %1, double* %2, i32 %3) {
%5 = alloca [3 x double]*
%6 = alloca [3 x double]*
%7 = alloca double*
%8 = alloca i32
store [3 x double]* %0, [3 x double]** %5
store [3 x double]* %1, [3 x double]** %6
store double* %2, double** %7
store i32 %3, i32* %8
%9 = load [3 x double]*, [3 x double]** %5
%10 = bitcast [3 x double]* %9 to double**
%11 = load [3 x double]*, [3 x double]** %6
%12 = bitcast [3 x double]* %11 to double**
%13 = load double*, double** %7
%14 = load i32, i32* %8
%15 = call i32 @g5_calculate_force_on_xMC(i32 0, double** %10, double** %12, double* %13, i32 %14)
ret void
}

LLVM IR (-O2):
define void @g5_calculate_force_on_x([3 x double]* %0, [3 x double]* %1, double* %2, i32 %3) {
%5 = bitcast [3 x double]* %0 to double**
%6 = bitcast [3 x double]* %1 to double**
%7 = tail call i32 @g5_calculate_force_on_xMC(i32 0, double** %5, double** %6, double* %2, i32 %3)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fclose(int /*<<< orphan*/ *);
int _close_file(void *arg) {
  FILE *f = (FILE *)arg;
  return fclose(f);
}


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

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

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

LLVM IR (-O2):
define i32 @_close_file(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = tail call i32 @fclose(i32* %2)
ret i32 %3
}
int c049(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @c049() {
ret i32 0
}
int test_imm_2Dint32_reg(int val) { return ((val) & (0x2D << 0)) ? -20 : -40; }


x86 assembly (clang, -O0):
<test_imm_2Dint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x2d,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_2Dint32_reg>:
test   $0x2d,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_2Dint32_reg(i32 %0) {
%2 = and i32 %0, 45
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int multiplicador;
  int multiplicando;
  int resultado;
  multiplicador = 1000;
  multiplicando = 2;
  resultado = multiplicador * multiplicando;
  printf("Resultado = %d\n", resultado);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3e8,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [16 x i8] c"Resultado = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 2000)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;
typedef int /*<<< orphan*/ msg;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ vsnprintf(char *, int, char const *, int /*<<< orphan*/);
void vreportf(const char *fmt, va_list params) {
  char msg[4096];
  vsnprintf(msg, sizeof(msg), fmt, params);
  fprintf(stderr, "%s\n", msg);
}


x86 assembly (clang, -O0):
<vreportf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1010,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x1010(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
mov    $0x1000,%esi
call   1030 <vsnprintf@plt>
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
lea    -0x1010(%rbp),%rdx
lea    0xe9f(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x1010,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vreportf>:
push   %rbx
sub    $0x1000,%rsp
mov    %esi,%ecx
mov    %rdi,%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x1000,%esi
call   1030 <vsnprintf@plt>
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
mov    %rbx,%rdx
call   1040 <fprintf@plt>
add    $0x1000,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @vreportf(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [4096 x i8]
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%7 = load i8*, i8** %3
%8 = load i32, i32* %4
%9 = call i32 @vsnprintf(i8* %6, i32 4096, i8* %7, i32 %8)
%10 = load i32, i32* @stderr
%11 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%12 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %11)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @vreportf(i8* nocapture %0, i32 %1) {
%3 = alloca [4096 x i8]
%4 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%5 = call i32 @vsnprintf(i8* %4, i32 4096, i8* %0, i32 %1)
%6 = load i32, i32* @stderr
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Q_add(char *);
int /*<<< orphan*/ Q_clear();
void *thread1(void *arg) {
  Q_add("data 0");
  Q_add("data 1");
  Q_add("data 2");
  Q_add("data 3");
  Q_add("data 4");
  Q_clear();
  return NULL;
}


x86 assembly (clang, -O0):
<thread1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <Q_add@plt>
lea    0xec8(%rip),%rdi
call   1030 <Q_add@plt>
lea    0xec3(%rip),%rdi
call   1030 <Q_add@plt>
lea    0xebe(%rip),%rdi
call   1030 <Q_add@plt>
lea    0xeb9(%rip),%rdi
call   1030 <Q_add@plt>
mov    $0x0,%al
call   1040 <Q_clear@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread1>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <Q_add@plt>
lea    0xed3(%rip),%rdi
call   1030 <Q_add@plt>
lea    0xece(%rip),%rdi
call   1030 <Q_add@plt>
lea    0xec9(%rip),%rdi
call   1030 <Q_add@plt>
lea    0xec4(%rip),%rdi
call   1030 <Q_add@plt>
xor    %eax,%eax
call   1040 <Q_clear@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"data 0\00"
@.str.1 = [7 x i8] c"data 1\00"
@.str.2 = [7 x i8] c"data 2\00"
@.str.3 = [7 x i8] c"data 3\00"
@.str.4 = [7 x i8] c"data 4\00"
define i8* @thread1(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @Q_add(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @Q_add(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @Q_add(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @Q_add(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @Q_add(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%8 = call i32 (...) @Q_clear()
ret i8* null
}

LLVM IR (-O2):
@.str = [7 x i8] c"data 0\00"
@.str.1 = [7 x i8] c"data 1\00"
@.str.2 = [7 x i8] c"data 2\00"
@.str.3 = [7 x i8] c"data 3\00"
@.str.4 = [7 x i8] c"data 4\00"
define noalias i8* @thread1(i8* nocapture readnone %0) {
%2 = tail call i32 @Q_add(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @Q_add(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @Q_add(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 @Q_add(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%6 = tail call i32 @Q_add(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%7 = tail call i32 (...) @Q_clear()
ret i8* null
}
void ff_hevc_put_hevc_epel_h16_10_avx2() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_epel_h16_10_avx2() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int close_port(int fd) {
  close(fd);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @close_port(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret i32 0
}
int execute_ftruncate() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @execute_ftruncate() {
ret i32 0
}
/* Type definitions */
union i2c_smbus_data {
  int word;
};

/* Variables and functions */
int /*<<< orphan*/ I2C_SMBUS_WORD_DATA;
int /*<<< orphan*/ I2C_SMBUS_WRITE;
int i2c_smbus_access(int, int /*<<< orphan*/, int, int /*<<< orphan*/,
                     union i2c_smbus_data *);
int wiringPiI2CWriteReg16(int fd, int reg, int value) {
  union i2c_smbus_data data;
  data.word = value;
  return i2c_smbus_access(fd, I2C_SMBUS_WRITE, reg, I2C_SMBUS_WORD_DATA, &data);
}


x86 assembly (clang, -O0):
<wiringPiI2CWriteReg16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ea7(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%edx
mov    0x2eab(%rip),%rax
mov    (%rax),%ecx
lea    -0x10(%rbp),%r8
call   1030 <i2c_smbus_access@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wiringPiI2CWriteReg16>:
push   %rax
mov    %esi,%eax
mov    %edx,(%rsp)
mov    0x2ebb(%rip),%rcx
mov    (%rcx),%esi
mov    0x2ec2(%rip),%rcx
mov    (%rcx),%ecx
mov    %rsp,%r8
mov    %eax,%edx
call   1030 <i2c_smbus_access@plt>
pop    %rcx
ret

LLVM IR (-O0):
%union.i2c_smbus_data = type { i32 }
@I2C_SMBUS_WRITE = global i32 0
@I2C_SMBUS_WORD_DATA = global i32 0
define i32 @wiringPiI2CWriteReg16(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca %union.i2c_smbus_data
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = bitcast %union.i2c_smbus_data* %7 to i32*
store i32 %8, i32* %9
%10 = load i32, i32* %4
%11 = load i32, i32* @I2C_SMBUS_WRITE
%12 = load i32, i32* %5
%13 = load i32, i32* @I2C_SMBUS_WORD_DATA
%14 = call i32 @i2c_smbus_access(i32 %10, i32 %11, i32 %12, i32 %13, %union.i2c_smbus_data* %7)
ret i32 %14
}

LLVM IR (-O2):
%union.i2c_smbus_data = type { i32 }
@I2C_SMBUS_WRITE = global i32 0
@I2C_SMBUS_WORD_DATA = global i32 0
define i32 @wiringPiI2CWriteReg16(i32 %0, i32 %1, i32 %2) {
%4 = alloca %union.i2c_smbus_data
%5 = bitcast %union.i2c_smbus_data* %4 to i8*
%6 = getelementptr inbounds %union.i2c_smbus_data, %union.i2c_smbus_data* %4, i64 0, i32 0
store i32 %2, i32* %6
%7 = load i32, i32* @I2C_SMBUS_WRITE
%8 = load i32, i32* @I2C_SMBUS_WORD_DATA
%9 = call i32 @i2c_smbus_access(i32 %0, i32 %7, i32 %1, i32 %8, %union.i2c_smbus_data* %4)
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ puts(char const *);
void printpath(const char *path) {
  if (*path != '\0') {
    putchar(' ');
    puts(path);
  } else {
    putchar('\n');
  }
}


x86 assembly (clang, -O0):
<printpath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1154 <printpath+0x34>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%rdi
call   1040 <puts@plt>
jmp    115e <printpath+0x3e>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printpath>:
push   %rbx
cmpb   $0x0,(%rdi)
je     113c <printpath+0x1c>
mov    %rdi,%rbx
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <puts@plt>
mov    $0xa,%edi
pop    %rbx
jmp    1030 <putchar@plt>

LLVM IR (-O0):
define void @printpath(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = call i32 @putchar(i8 signext 32)
%9 = load i8*, i8** %2
%10 = call i32 @puts(i8* %9)
br label %13
11: ; preds = %1
%12 = call i32 @putchar(i8 signext 10)
br label %13
13: ; preds = %11, %7
ret void
}

LLVM IR (-O2):
define void @printpath(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i32 @putchar(i8 signext 32)
%6 = tail call i32 @puts(i8* %0)
br label %9
7: ; preds = %1
%8 = tail call i32 @putchar(i8 signext 10)
br label %9
9: ; preds = %7, %4
ret void
}
int main(void) {
  int x, c, y;
  x = 3;
  if (c)
    x = 2;
  y = x + 1;
  return y;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1123 <main+0x23>
movl   $0x2,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ test_reverse();
int main() {
  int counter = 0;
  if (!test_reverse()) {
    counter++;
    printf("Reverse test failed!\n");
  }
  printf("%d tests failed.\n", counter);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <test_reverse@plt>
cmp    $0x0,%eax
jne    115d <main+0x3d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <test_reverse@plt>
test   %eax,%eax
jne    114f <main+0x1f>
lea    0xecd(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
lea    0xeaa(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Reverse test failed!\0A\00"
@.str.1 = [18 x i8] c"%d tests failed.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 (...) @test_reverse()
%4 = icmp ne i32 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %0
%6 = load i32, i32* %2
%7 = add nsw i32 %6, 1
store i32 %7, i32* %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %5, %0
%10 = load i32, i32* %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
@.str.1 = [18 x i8] c"%d tests failed.\0A\00"
@str = [21 x i8] c"Reverse test failed!\00"
define i32 @main() {
%1 = tail call i32 (...) @test_reverse()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
%6 = phi i32 [ 0, %0 ], [ 1, %3 ]
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}
/* Type definitions */
struct buffer {
  int dummy;
};

/* Variables and functions */
int add_int_data(struct buffer *, int, unsigned int);
int add_serno_avp(struct buffer *buf, unsigned int serno) {
  return add_int_data(buf, 15, serno);
}


x86 assembly (clang, -O0):
<add_serno_avp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    $0xf,%esi
call   1030 <add_int_data@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_serno_avp>:
mov    %esi,%edx
mov    $0xf,%esi
jmp    1030 <add_int_data@plt>

LLVM IR (-O0):
%struct.buffer = type { i32 }
define i32 @add_serno_avp(%struct.buffer* %0, i32 %1) {
%3 = alloca %struct.buffer*
%4 = alloca i32
store %struct.buffer* %0, %struct.buffer** %3
store i32 %1, i32* %4
%5 = load %struct.buffer*, %struct.buffer** %3
%6 = load i32, i32* %4
%7 = call i32 @add_int_data(%struct.buffer* %5, i32 15, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.buffer = type { i32 }
define i32 @add_serno_avp(%struct.buffer* %0, i32 %1) {
%3 = tail call i32 @add_int_data(%struct.buffer* %0, i32 15, i32 %1)
ret i32 %3
}
int execvp(const char *file, char *const argv[]) {
  printf("tcl>>> %s\n", __func__);
  return -1;
}


x86 assembly (clang, -O0):
<execvp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed9(%rip),%rdi
lea    0xedd(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<execvp>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xeec(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"tcl>>> %s\0A\00"
@__func__.execvp = [7 x i8] c"execvp\00"
define i32 @execvp(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
store i8* %0, i8** %3
store i8** %1, i8*** %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @__func__.execvp, i64 0, i64 0))
ret i32 -1
}

LLVM IR (-O2):
@.str = [11 x i8] c"tcl>>> %s\0A\00"
@__func__.execvp = [7 x i8] c"execvp\00"
define i32 @execvp(i8* nocapture readnone %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @__func__.execvp, i64 0, i64 0))
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ servo_set_pin3(long);
void servo_pen_down() { servo_set_pin3(550L); }


x86 assembly (clang, -O0):
<servo_pen_down>:
push   %rbp
mov    %rsp,%rbp
mov    $0x226,%edi
call   1030 <servo_set_pin3@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<servo_pen_down>:
mov    $0x226,%edi
jmp    1030 <servo_set_pin3@plt>

LLVM IR (-O0):
define void @servo_pen_down() {
%1 = call i32 @servo_set_pin3(i64 550)
ret void
}

LLVM IR (-O2):
define void @servo_pen_down() {
%1 = tail call i32 @servo_set_pin3(i64 550)
ret void
}
int test_imm_BCuint16_mem(unsigned short *val) {
  return ((*val) & (0xBC << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_BCuint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 188
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
struct expr {
  int dummy;
};

/* Variables and functions */
int isalpha(char const);
int find_word(const char *remain, struct expr *e) { return isalpha(*remain); }


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

x86 assembly (clang, -O2):
<find_word>:
movsbl (%rdi),%edi
jmp    1030 <isalpha@plt>

LLVM IR (-O0):
%struct.expr = type { i32 }
define i32 @find_word(i8* %0, %struct.expr* %1) {
%3 = alloca i8*
%4 = alloca %struct.expr*
store i8* %0, i8** %3
store %struct.expr* %1, %struct.expr** %4
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = call i32 @isalpha(i8 signext %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.expr = type { i32 }
define i32 @find_word(i8* nocapture %0, %struct.expr* nocapture readnone %1) {
%3 = load i8, i8* %0
%4 = tail call i32 @isalpha(i8 signext %3)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ print_add(int *, int);
int main() {
  int q = 10;
  int o = 20;
  print_add(&q, 10);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xa,-0x4(%rbp)
movl   $0x14,-0x8(%rbp)
lea    -0x4(%rbp),%rdi
mov    $0xa,%esi
call   1030 <print_add@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0xa,0x4(%rsp)
lea    0x4(%rsp),%rdi
mov    $0xa,%esi
call   1030 <print_add@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 10, i32* %1
%3 = call i32 @print_add(i32* %1, i32 10)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_cond_t;

/* Variables and functions */
int /*<<< orphan*/ pthread_cond_signal(int /*<<< orphan*/ *);
void EventSet(void *Handle) {
  if (Handle) {
    pthread_cond_signal((pthread_cond_t *)Handle);
  }
}


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

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

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

LLVM IR (-O2):
define void @EventSet(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = bitcast i8* %0 to i32*
%5 = tail call i32 @pthread_cond_signal(i32* %4)
br label %6
6: ; preds = %3, %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ u_int64_t;

/* Variables and functions */
int /*<<< orphan*/ __put_unaligned_be64(int /*<<< orphan*/, void *);
void put_unaligned_be64(u_int64_t val, void *p) {
  __put_unaligned_be64(val, p);
}


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

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

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

LLVM IR (-O2):
define void @put_unaligned_be64(i32 %0, i8* %1) {
%3 = tail call i32 @__put_unaligned_be64(i32 %0, i8* %1)
ret void
}
/* Variables and functions */
int main(int argc, char **argv) {
  size_t size = 16;
  char p[size - 2];
  p[16] = 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x10,-0x18(%rbp)
mov    -0x18(%rbp),%rdx
mov    %rdx,%rcx
add    $0xfffffffffffffffe,%rcx
mov    %rsp,%rax
mov    %rax,-0x20(%rbp)
add    $0xd,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rax
sub    %rdx,%rax
mov    %rax,%rsp
mov    %rcx,-0x28(%rbp)
movb   $0x0,0x10(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
xor    %eax,%eax
mov    %rbp,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i64
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i64 16, i64* %5
%8 = load i64, i64* %5
%9 = sub i64 %8, 2
%10 = call i8* @llvm.stacksave()
store i8* %10, i8** %6
%11 = alloca i8, i64 %9
store i64 %9, i64* %7
%12 = getelementptr inbounds i8, i8* %11, i64 16
store i8 0, i8* %12
%13 = load i8*, i8** %6
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print(int *orig_rax, int file_count) {
  int i;
  for (i = 0; i < file_count; i++)
    printf("%d\t", orig_rax[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<print>:
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    1159 <print+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print+0x16>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <print+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <print+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\09\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @print(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %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 i32*, i32** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %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
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\09\00"
define void @print(i32* 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 i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %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
%14 = tail call i32 @putchar(i32 10)
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t sign_extend64(unsigned int bits, uint64_t value) {
  uint64_t C = (-1) << (bits - (uint64_t)1);
  return (value + C) ^ C;
}


x86 assembly (clang, -O0):
<sign_extend64>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
xor    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sign_extend64>:
lea    -0x1(%rdi),%ecx
mov    $0xffffffff,%edx
shl    %cl,%edx
lea    (%rsi,%rdx,1),%eax
xor    %edx,%eax
ret

LLVM IR (-O0):
define i32 @sign_extend64(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = sub i32 %6, 1
%8 = shl i32 -1, %7
store i32 %8, i32* %5
%9 = load i32, i32* %4
%10 = load i32, i32* %5
%11 = add nsw i32 %9, %10
%12 = load i32, i32* %5
%13 = xor i32 %11, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @sign_extend64(i32 %0, i32 %1) {
%3 = add i32 %0, -1
%4 = shl nsw i32 -1, %3
%5 = add nsw i32 %4, %1
%6 = xor i32 %5, %4
ret i32 %6
}
/* Variables and functions */
int divideBy255(int);
int convert8To4(int b) { return divideBy255(b * 15); }


x86 assembly (clang, -O0):
<convert8To4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
imul   $0xf,-0x4(%rbp),%edi
call   1030 <divideBy255@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert8To4>:
lea    (%rdi,%rdi,4),%eax
lea    (%rax,%rax,2),%edi
jmp    1030 <divideBy255@plt>

LLVM IR (-O0):
define i32 @convert8To4(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 15
%5 = call i32 @divideBy255(i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @convert8To4(i32 %0) {
%2 = mul nsw i32 %0, 15
%3 = tail call i32 @divideBy255(i32 %2)
ret i32 %3
}
int sunxi_get_position(int mode, unsigned int *pSrc, unsigned int *pDst) {
  return 0;
}


x86 assembly (clang, -O0):
<sunxi_get_position>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @sunxi_get_position(i32 %0, i32* nocapture readnone %1, i32* nocapture readnone %2) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ inner();
main() {
  inner();
  inner();
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @inner()
%2 = call i32 (...) @inner()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @inner()
%2 = tail call i32 (...) @inner()
ret i32 0
}
/* Variables and functions */
scalar_t__ EINTR;
int close(int);
scalar_t__ errno;
void serial_close(int fd) {
  int result = -1;
  if (fd > 0) {
    do {
      result = close(fd);
    } while (result == -1 && errno == EINTR);
  }
}


x86 assembly (clang, -O0):
<serial_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1175 <serial_close+0x65>
jmp    1131 <serial_close+0x21>
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0xffffffff,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jne    1165 <serial_close+0x55>
mov    0x2e8e(%rip),%rax
mov    (%rax),%rax
mov    0x2e7c(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1131 <serial_close+0x21>
jmp    1175 <serial_close+0x65>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serial_close>:
push   %r15
push   %r14
push   %rbx
test   %edi,%edi
jle    1144 <serial_close+0x34>
mov    %edi,%ebx
mov    0x2ebe(%rip),%r14
mov    0x2eaf(%rip),%r15
nopl   0x0(%rax)
mov    %ebx,%edi
call   1030 <close@plt>
cmp    $0xffffffff,%eax
jne    1144 <serial_close+0x34>
mov    (%r15),%rax
cmp    %rax,(%r14)
je     1130 <serial_close+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@errno = global i64 0
@EINTR = global i64 0
define void @serial_close(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 -1, i32* %3
%4 = load i32, i32* %2
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %20
6: ; preds = %1
br label %7
7: ; preds = %17, %6
%8 = load i32, i32* %2
%9 = call i32 @close(i32 %8)
store i32 %9, i32* %3
br label %10
10: ; preds = %7
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = load i64, i64* @errno
%15 = load i64, i64* @EINTR
%16 = icmp eq i64 %14, %15
br label %17
17: ; preds = %13, %10
%18 = phi i1 [ false, %10 ], [ %16, %13 ]
br i1 %18, label %7, label %19
19: ; preds = %17
br label %20
20: ; preds = %19, %1
ret void
}

LLVM IR (-O2):
@errno = global i64 0
@EINTR = global i64 0
define void @serial_close(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %10
3: ; preds = %1, %3
%4 = tail call i32 @close(i32 %0)
%5 = icmp eq i32 %4, -1
%6 = load i64, i64* @errno
%7 = load i64, i64* @EINTR
%8 = icmp eq i64 %6, %7
%9 = select i1 %5, i1 %8, i1 false
br i1 %9, label %3, label %10
10: ; preds = %3, %1
ret void
}
void deactivate_mm(struct task_struct *tsk, struct mm_struct *mm) {}


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

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

LLVM IR (-O0):
%struct.task_struct = type opaque
%struct.mm_struct = type opaque
define void @deactivate_mm(%struct.task_struct* %0, %struct.mm_struct* %1) {
%3 = alloca %struct.task_struct*
%4 = alloca %struct.mm_struct*
store %struct.task_struct* %0, %struct.task_struct** %3
store %struct.mm_struct* %1, %struct.mm_struct** %4
ret void
}

LLVM IR (-O2):
%struct.task_struct = type opaque
%struct.mm_struct = type opaque
define void @deactivate_mm(%struct.task_struct* nocapture %0, %struct.mm_struct* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _fail(char const *const, int const);
int /*<<< orphan*/ integer_not_in_range_display_error(int const, int const,
                                                      int const);
void _assert_not_in_range(const int value, const int minimum, const int maximum,
                          const char *const file, const int line) {
  if (!integer_not_in_range_display_error(value, minimum, maximum)) {
    _fail(file, line);
  }
}


x86 assembly (clang, -O0):
<_assert_not_in_range>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <integer_not_in_range_display_error@plt>
cmp    $0x0,%eax
jne    115c <_assert_not_in_range+0x3c>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1040 <_fail@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_assert_not_in_range>:
push   %rbp
push   %rbx
push   %rax
mov    %r8d,%ebp
mov    %rcx,%rbx
call   1030 <integer_not_in_range_display_error@plt>
test   %eax,%eax
je     1139 <_assert_not_in_range+0x19>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <_fail@plt>

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

LLVM IR (-O2):
define void @_assert_not_in_range(i32 %0, i32 %1, i32 %2, i8* %3, i32 %4) {
%6 = tail call i32 @integer_not_in_range_display_error(i32 %0, i32 %1, i32 %2)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @_fail(i8* %3, i32 %4)
br label %10
10: ; preds = %8, %5
ret void
}
/* Variables and functions */
double binomial_distribution(int, int);
double pow(int, double);
double bernstein_polynomial(int n, int i, float u) {
  return binomial_distribution(n, i) * pow(u, (double)i) *
         pow((1 - u), (double)(n - i));
}


x86 assembly (clang, -O0):
<bernstein_polynomial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <binomial_distribution@plt>
movsd  %xmm0,-0x20(%rbp)
cvttss2si -0xc(%rbp),%edi
cvtsi2sdl -0x8(%rbp),%xmm0
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movss  0xe95(%rip),%xmm0
subss  -0xc(%rbp),%xmm0
cvttss2si %xmm0,%edi
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
cvtsi2sd %eax,%xmm0
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bernstein_polynomial>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
movss  %xmm0,0x8(%rsp)
mov    %esi,%ebx
mov    %edi,%ebp
call   1030 <binomial_distribution@plt>
movsd  %xmm0,0x10(%rsp)
cvttss2si 0x8(%rsp),%edi
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
call   1040 <pow@plt>
movss  0xeab(%rip),%xmm1
subss  0x8(%rsp),%xmm1
cvttss2si %xmm1,%edi
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
sub    %ebx,%ebp
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
call   1040 <pow@plt>
mulsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @bernstein_polynomial(i32 %0, i32 %1, float %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
store i32 %0, i32* %4
store i32 %1, i32* %5
store float %2, float* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = call double @binomial_distribution(i32 %7, i32 %8)
%10 = load float, float* %6
%11 = fptosi float %10 to i32
%12 = load i32, i32* %5
%13 = sitofp i32 %12 to double
%14 = call double @pow(i32 %11, double %13)
%15 = fmul double %9, %14
%16 = load float, float* %6
%17 = fsub float 1.000000e+00, %16
%18 = fptosi float %17 to i32
%19 = load i32, i32* %4
%20 = load i32, i32* %5
%21 = sub nsw i32 %19, %20
%22 = sitofp i32 %21 to double
%23 = call double @pow(i32 %18, double %22)
%24 = fmul double %15, %23
ret double %24
}

LLVM IR (-O2):
define double @bernstein_polynomial(i32 %0, i32 %1, float %2) {
%4 = tail call double @binomial_distribution(i32 %0, i32 %1)
%5 = fptosi float %2 to i32
%6 = sitofp i32 %1 to double
%7 = tail call double @pow(i32 %5, double %6)
%8 = fmul double %4, %7
%9 = fsub float 1.000000e+00, %2
%10 = fptosi float %9 to i32
%11 = sub nsw i32 %0, %1
%12 = sitofp i32 %11 to double
%13 = tail call double @pow(i32 %10, double %12)
%14 = fmul double %8, %13
ret double %14
}
__float128 from_uns_char_load_4(unsigned char *a) { return (__float128)a[4]; }


x86 assembly (clang, -O0):
<from_uns_char_load_4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x4(%rax),%edi
call   1120 <__floatsitf>
add    $0x10,%rsp
pop    %rbp
ret
nop

x86 assembly (clang, -O2):
<from_uns_char_load_4>:
push   %rax
movzbl 0x4(%rdi),%edi
call   1110 <__floatsitf>
pop    %rax
ret
nopl   0x0(%rax)

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

LLVM IR (-O2):
define fp128 @from_uns_char_load_4(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 4
%3 = load i8, i8* %2
%4 = uitofp i8 %3 to fp128
ret fp128 %4
}
/* Type definitions */
struct ft_stack_node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct ft_stack_node *);
void ft_stack_node_del(struct ft_stack_node *this) { free(this); }


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

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

LLVM IR (-O2):
%struct.ft_stack_node = type { i32 }
define void @ft_stack_node_del(%struct.ft_stack_node* nocapture %0) {
%2 = tail call i32 @free(%struct.ft_stack_node* %0)
ret void
}
/* Variables and functions */
int add_two(int);
int subtract_two(int x) { return add_two(x) - 4; }


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

x86 assembly (clang, -O2):
<subtract_two>:
push   %rax
call   1030 <add_two@plt>
add    $0xfffffffc,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @subtract_two(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @add_two(i32 %3)
%5 = sub nsw i32 %4, 4
ret i32 %5
}

LLVM IR (-O2):
define i32 @subtract_two(i32 %0) {
%2 = tail call i32 @add_two(i32 %0)
%3 = add nsw i32 %2, -4
ret i32 %3
}
/* Variables and functions */
void *alloc3();
void *alloc2(void) { return alloc3(); }


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

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

LLVM IR (-O0):
define i8* @alloc2() {
%1 = call i8* (...) @alloc3()
ret i8* %1
}

LLVM IR (-O2):
define i8* @alloc2() {
%1 = tail call i8* (...) @alloc3()
ret i8* %1
}
__attribute__((visibility("hidden"))) void
resume_from_pause(struct wait_event *wait_event) {}


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

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

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

LLVM IR (-O2):
%struct.wait_event = type opaque
define hidden void @resume_from_pause(%struct.wait_event* nocapture %0) {
ret void
}
int bang(int x) {
  int y = x >> 31;
  int absX = (x + y) ^ y;
  return ((absX + (~0)) >> 31) & 1;
}


x86 assembly (clang, -O0):
<bang>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1f,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
sar    $0x1f,%eax
and    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bang>:
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
add    $0xffffffff,%eax
shr    $0x1f,%eax
ret

LLVM IR (-O0):
define i32 @bang(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = ashr i32 %5, 31
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = add nsw i32 %7, %8
%10 = load i32, i32* %3
%11 = xor i32 %9, %10
store i32 %11, i32* %4
%12 = load i32, i32* %4
%13 = add nsw i32 %12, -1
%14 = ashr i32 %13, 31
%15 = and i32 %14, 1
ret i32 %15
}

LLVM IR (-O2):
define i32 @bang(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
%3 = add nsw i32 %2, -1
%4 = lshr i32 %3, 31
ret i32 %4
}