xunge/DecIR huggingface dataset:
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int fstat(int, struct stat *);
mode_t fstype(int fd) {
  struct stat s;
  if (fstat(fd, &s) == -1) {
    exit(EXIT_FAILURE);
  }
  return s.st_mode;
}


x86 assembly (clang, -O0):
<fstype>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
call   1040 <fstat@plt>
cmp    $0xffffffff,%eax
jne    114e <fstype+0x2e>
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
call   1030 <exit@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fstype>:
push   %rax
mov    %rsp,%rsi
call   1040 <fstat@plt>
cmp    $0xffffffff,%eax
je     1133 <fstype+0x13>
mov    (%rsp),%eax
pop    %rcx
ret
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
call   1030 <exit@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
@EXIT_FAILURE = global i32 0
define i32 @fstype(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.stat
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @fstat(i32 %4, %struct.stat* %3)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* @EXIT_FAILURE
%9 = call i32 @exit(i32 %8)
unreachable
10: ; preds = %1
%11 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%12 = load i32, i32* %11
ret i32 %12
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@EXIT_FAILURE = global i32 0
define i32 @fstype(i32 %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @fstat(i32 %0, %struct.stat* %2)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %1
%10 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%11 = load i32, i32* %10
ret i32 %11
}
int IsEOL(const unsigned char *offset, const unsigned char *end) {
  if ((offset) >= end)
    return 0;
  return (*offset & 0x80) != 0;
}


x86 assembly (clang, -O0):
<IsEOL>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jb     1126 <IsEOL+0x26>
movl   $0x0,-0x4(%rbp)
jmp    1140 <IsEOL+0x40>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
and    $0x80,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsEOL>:
xor    %eax,%eax
cmp    %rsi,%rdi
jae    110d <IsEOL+0xd>
movzbl (%rdi),%eax
shr    $0x7,%eax
ret

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

LLVM IR (-O2):
define i32 @IsEOL(i8* %0, i8* readnone %1) {
%3 = icmp ult i8* %0, %1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i8, i8* %0
%6 = lshr i8 %5, 7
%7 = zext i8 %6 to i32
br label %8
8: ; preds = %2, %4
%9 = phi i32 [ %7, %4 ], [ 0, %2 ]
ret i32 %9
}
int main() {
  int l = 0;
  asm volatile("" : "=r"(l) : "0"(l));
  foo(l + 1, l + 2, l + 3, l + 4, l + 5, l + 6, l + 30);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
add    $0x1,%edi
mov    -0x8(%rbp),%esi
add    $0x2,%esi
mov    -0x8(%rbp),%edx
add    $0x3,%edx
mov    -0x8(%rbp),%ecx
add    $0x4,%ecx
mov    -0x8(%rbp),%r8d
add    $0x5,%r8d
mov    -0x8(%rbp),%r9d
add    $0x6,%r9d
mov    -0x8(%rbp),%eax
add    $0x1e,%eax
mov    %eax,(%rsp)
mov    $0x0,%al
call   1030 <foo@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
lea    0x1(%rax),%edi
lea    0x2(%rax),%esi
lea    0x3(%rax),%edx
lea    0x4(%rax),%ecx
lea    0x5(%rax),%r8d
lea    0x6(%rax),%r9d
add    $0x1e,%eax
mov    %eax,(%rsp)
xor    %eax,%eax
call   1030 <foo@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 asm sideeffect "", "=r,0,~{dirflag},~{fpsr},~{flags}"(i32 %3)
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 1
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 2
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 3
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 4
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 5
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 6
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 30
%19 = call i32 (i32, i32, i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @foo to i32 (i32, i32, i32, i32, i32, i32, i32, ...)*)(i32 %6, i32 %8, i32 %10, i32 %12, i32 %14, i32 %16, i32 %18)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 asm sideeffect "", "=r,0,~{dirflag},~{fpsr},~{flags}"(i32 0)
%2 = add nsw i32 %1, 1
%3 = add nsw i32 %1, 2
%4 = add nsw i32 %1, 3
%5 = add nsw i32 %1, 4
%6 = add nsw i32 %1, 5
%7 = add nsw i32 %1, 6
%8 = add nsw i32 %1, 30
%9 = tail call i32 (i32, i32, i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @foo to i32 (i32, i32, i32, i32, i32, i32, i32, ...)*)(i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int creat(char *, int);
int hyper_create(char *hyper_path) {
  int fd = creat(hyper_path, 0755);
  if (fd < 0)
    return -1;
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<hyper_create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x1ed,%esi
call   1040 <creat@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1153 <hyper_create+0x33>
movl   $0xffffffff,-0x4(%rbp)
jmp    1162 <hyper_create+0x42>
mov    -0x14(%rbp),%edi
call   1030 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hyper_create>:
push   %rax
mov    $0x1ed,%esi
call   1040 <creat@plt>
test   %eax,%eax
js     113a <hyper_create+0x1a>
mov    %eax,%edi
call   1030 <close@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    $0xffffffff,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @hyper_create(i8* %0) {
%2 = tail call i32 @creat(i8* %0, i32 493)
%3 = icmp slt i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @close(i32 %2)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ 0, %4 ], [ -1, %1 ]
ret i32 %7
}
int test_imm_3Fint8_mem(signed char *val) {
  return ((*val) & (-0x3F << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_3Fint8_mem(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 = and i32 %5, -63
%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_3Fint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -63
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int rstdin_d();
int with_ilimit_read_d(int n) {
  int m;
  do {
    printf("(debe ser mayor a %d) ", n);
    m = rstdin_d();
  } while (m < n);
  return m;
}


x86 assembly (clang, -O0):
<with_ilimit_read_d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <rstdin_d@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jl     112b <with_ilimit_read_d+0xb>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<with_ilimit_read_d>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0xed3(%rip),%r14
nopl   (%rax)
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <rstdin_d@plt>
cmp    %ebx,%eax
jl     1130 <with_ilimit_read_d+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [23 x i8] c"(debe ser mayor a %d) \00"
define i32 @with_ilimit_read_d(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
br label %4
4: ; preds = %8, %1
%5 = load i32, i32* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = call i32 (...) @rstdin_d()
store i32 %7, i32* %3
br label %8
8: ; preds = %4
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = icmp slt i32 %9, %10
br i1 %11, label %4, label %12
12: ; preds = %8
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
@.str = [23 x i8] c"(debe ser mayor a %d) \00"
define i32 @with_ilimit_read_d(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %0)
%4 = tail call i32 (...) @rstdin_d()
%5 = icmp slt i32 %4, %0
br i1 %5, label %2, label %6
6: ; preds = %2
ret i32 %4
}
/* Variables and functions */
scalar_t__ malloc(size_t);
double *alloc_dvector(double *v, unsigned int nh) {
  return (double *)malloc((size_t)((nh + 1) * (sizeof(double))));
}


x86 assembly (clang, -O0):
<alloc_dvector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,%eax
mov    %eax,%edi
shl    $0x3,%rdi
call   1030 <malloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_dvector>:
lea    0x1(%rsi),%edi
shl    $0x3,%rdi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define double* @alloc_dvector(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = add i32 %5, 1
%7 = zext i32 %6 to i64
%8 = mul i64 %7, 8
%9 = call i64 @malloc(i64 %8)
%10 = inttoptr i64 %9 to double*
ret double* %10
}

LLVM IR (-O2):
define double* @alloc_dvector(double* nocapture readnone %0, i32 %1) {
%3 = add i32 %1, 1
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 3
%6 = tail call i64 @malloc(i64 %5)
%7 = inttoptr i64 %6 to double*
ret double* %7
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ err(int /*<<< orphan*/, char *, size_t);
void *malloc(size_t);
void *smalloc(size_t size) {
  void *result = malloc(size);
  if (result == NULL)
    err(EXIT_FAILURE, "malloc(%zd)", size);
  return result;
}


x86 assembly (clang, -O0):
<smalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115d <smalloc+0x3d>
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xea8(%rip),%rsi
call   1030 <err@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114c <smalloc+0x2c>
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
lea    0xebc(%rip),%rsi
mov    %r14,%rdx
call   1030 <err@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str = [12 x i8] c"malloc(%zd)\00"
define noalias i8* @smalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = load i32, i32* @EXIT_FAILURE
%6 = tail call i32 @err(i32 %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i64 %0)
br label %7
7: ; preds = %4, %1
ret i8* %2
}
/* Variables and functions */
void *calloc(size_t, size_t);
void *git_ptr_error(int);
void *git__calloc(size_t a, size_t b) {
  void *r = calloc(a, b);
  if (!r)
    return git_ptr_error((-1 - 3));
  return r;
}


x86 assembly (clang, -O0):
<git__calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <calloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    115f <git__calloc+0x3f>
mov    $0xfffffffc,%edi
call   1030 <git_ptr_error@plt>
mov    %rax,-0x8(%rbp)
jmp    1167 <git__calloc+0x47>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<git__calloc>:
push   %rax
call   1040 <calloc@plt>
test   %rax,%rax
je     112d <git__calloc+0xd>
pop    %rcx
ret
mov    $0xfffffffc,%edi
pop    %rax
jmp    1030 <git_ptr_error@plt>

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

LLVM IR (-O2):
define i8* @git__calloc(i64 %0, i64 %1) {
%3 = tail call i8* @calloc(i64 %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i8* @git_ptr_error(i32 -4)
br label %7
7: ; preds = %2, %5
%8 = phi i8* [ %6, %5 ], [ %3, %2 ]
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ putstr(char *, int);
void term_left(void) { putstr("\x1b[D", 3); }


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"\1B[D\00"
define void @term_left() {
%1 = call i32 @putstr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"\1B[D\00"
define void @term_left() {
%1 = tail call i32 @putstr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
ret void
}
void av_stream_add_side_data() {}


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

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

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

LLVM IR (-O2):
define void @av_stream_add_side_data() {
ret void
}
int exynos_drm_iommu_register(struct platform_driver **drivers, int count) {
  return 0;
}


x86 assembly (clang, -O0):
<exynos_drm_iommu_register>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.platform_driver = type opaque
define i32 @exynos_drm_iommu_register(%struct.platform_driver** %0, i32 %1) {
%3 = alloca %struct.platform_driver**
%4 = alloca i32
store %struct.platform_driver** %0, %struct.platform_driver*** %3
store i32 %1, i32* %4
ret i32 0
}

LLVM IR (-O2):
%struct.platform_driver = type opaque
define i32 @exynos_drm_iommu_register(%struct.platform_driver** nocapture readnone %0, i32 %1) {
ret i32 0
}
void glGetInternalformativ(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glGetInternalformativ() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ unlink(char *);
void sighandler(void) {
  unlink("./sock-server");
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<sighandler>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <unlink@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<sighandler>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <unlink@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"./sock-server\00"
@EXIT_SUCCESS = global i32 0
define void @sighandler() {
%1 = call i32 @unlink(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_SUCCESS
%3 = call i32 @exit(i32 %2)
unreachable
}

LLVM IR (-O2):
@.str = [14 x i8] c"./sock-server\00"
@EXIT_SUCCESS = global i32 0
define void @sighandler() {
%1 = tail call i32 @unlink(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_SUCCESS
%3 = tail call i32 @exit(i32 %2)
unreachable
}
int iscntrl(int c) { return (c >= 0x00 && c <= 0x1d); }


x86 assembly (clang, -O0):
<iscntrl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1120 <iscntrl+0x20>
cmpl   $0x1d,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<iscntrl>:
xor    %eax,%eax
cmp    $0x1e,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @iscntrl(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 29
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @iscntrl(i32 %0) {
%2 = icmp ult i32 %0, 30
%3 = zext i1 %2 to i32
ret i32 %3
}
void f(int n_f_smp) {}


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

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

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

LLVM IR (-O2):
define void @f(i32 %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int /*<<< orphan*/ _sort(void **, void **, int /*<<< orphan*/, size_t,
                         int (*)(void *, void *));
void **malloc(size_t);
void merge_sort1(void **a, size_t n, int (*comp)(void *, void *)) {
  size_t i;
  void **aux;
  aux = malloc(n * sizeof(a));
  _sort(a, aux, 0, n - 1, comp);
}


x86 assembly (clang, -O0):
<merge_sort1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
shl    $0x3,%rdi
call   1030 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
mov    -0x18(%rbp),%r8
xor    %edx,%edx
call   1040 <_sort@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<merge_sort1>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
lea    0x0(,%rsi,8),%rdi
call   1030 <malloc@plt>
add    $0xffffffffffffffff,%rbx
mov    %r15,%rdi
mov    %rax,%rsi
xor    %edx,%edx
mov    %rbx,%rcx
mov    %r14,%r8
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <_sort@plt>

LLVM IR (-O0):
define void @merge_sort1(i8** %0, i64 %1, i32 (i8*, i8*)* %2) {
%4 = alloca i8**
%5 = alloca i64
%6 = alloca i32 (i8*, i8*)*
%7 = alloca i64
%8 = alloca i8**
store i8** %0, i8*** %4
store i64 %1, i64* %5
store i32 (i8*, i8*)* %2, i32 (i8*, i8*)** %6
%9 = load i64, i64* %5
%10 = mul i64 %9, 8
%11 = call i8** @malloc(i64 %10)
store i8** %11, i8*** %8
%12 = load i8**, i8*** %4
%13 = load i8**, i8*** %8
%14 = load i64, i64* %5
%15 = sub i64 %14, 1
%16 = load i32 (i8*, i8*)*, i32 (i8*, i8*)** %6
%17 = call i32 @_sort(i8** %12, i8** %13, i32 0, i64 %15, i32 (i8*, i8*)* %16)
ret void
}

LLVM IR (-O2):
define void @merge_sort1(i8** %0, i64 %1, i32 (i8*, i8*)* %2) {
%4 = shl i64 %1, 3
%5 = tail call i8** @malloc(i64 %4)
%6 = add i64 %1, -1
%7 = tail call i32 @_sort(i8** %0, i8** %5, i32 0, i64 %6, i32 (i8*, i8*)* %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *);
FILE *openFile() {
  FILE *f = fopen("pass.txt", "w");
  if (f == NULL) {
    printf("Error opening file!\n");
    return NULL;
  }
  return f;
}


x86 assembly (clang, -O0):
<openFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    0xed3(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1163 <openFile+0x43>
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
movq   $0x0,-0x8(%rbp)
jmp    116b <openFile+0x4b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<openFile>:
push   %rbx
lea    0xed8(%rip),%rdi
lea    0xeda(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1148 <openFile+0x28>
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"pass.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [21 x i8] c"Error opening file!\0A\00"
define i32* @openFile() {
%1 = alloca i32*
%2 = alloca i32*
%3 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %2
%4 = load i32*, i32** %2
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
store i32* null, i32** %1
br label %10
8: ; preds = %0
%9 = load i32*, i32** %2
store i32* %9, i32** %1
br label %10
10: ; preds = %8, %6
%11 = load i32*, i32** %1
ret i32* %11
}

LLVM IR (-O2):
@.str = [9 x i8] c"pass.txt\00"
@.str.1 = [2 x i8] c"w\00"
@str = [20 x i8] c"Error opening file!\00"
define noalias i32* @openFile() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32* %1, null
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %5
5: ; preds = %0, %3
ret i32* %1
}
unsigned int convert_unsigned_char_to_unsigned_int(unsigned char x) {
  return x;
}


x86 assembly (clang, -O0):
<convert_unsigned_char_to_unsigned_int>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @convert_unsigned_char_to_unsigned_int(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @convert_unsigned_char_to_unsigned_int(i8 zeroext %0) {
%2 = zext i8 %0 to i32
ret i32 %2
}
int is_harshad(int n) {
  int x = n, sum = 0;
  while (x > 0) {
    sum += x % 10;
    x /= 10;
  }
  return n % sum == 0;
}


x86 assembly (clang, -O0):
<is_harshad>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1142 <is_harshad+0x42>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    -0xc(%rbp),%edx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    1114 <is_harshad+0x14>
mov    -0x4(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_harshad>:
mov    %edi,%eax
xor    %r9d,%r9d
test   %edi,%edi
jle    113e <is_harshad+0x3e>
mov    $0xcccccccd,%r8d
mov    %eax,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ecx,%edi
imul   %r8,%rdi
shr    $0x23,%rdi
lea    (%rdi,%rdi,1),%edx
lea    (%rdx,%rdx,4),%edx
mov    %ecx,%esi
sub    %edx,%esi
add    %esi,%r9d
cmp    $0x9,%ecx
mov    %edi,%ecx
ja     1120 <is_harshad+0x20>
cltd
idiv   %r9d
xor    %eax,%eax
test   %edx,%edx
sete   %al
ret

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

LLVM IR (-O2):
define i32 @is_harshad(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %10
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %8, %3 ], [ %0, %1 ]
%6 = urem i32 %5, 10
%7 = add nuw nsw i32 %4, %6
%8 = udiv i32 %5, 10
%9 = icmp ult i32 %5, 10
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %7, %3 ]
%12 = srem i32 %0, %11
%13 = icmp eq i32 %12, 0
%14 = zext i1 %13 to i32
ret i32 %14
}
int loop(int *a, int size) {
  int i;
  int n = a[0];
  for (i = 1; i < 1000; i++) {
    n = a[n];
  }
  return n;
}


x86 assembly (clang, -O0):
<loop>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
movl   $0x1,-0x10(%rbp)
cmpl   $0x3e8,-0x10(%rbp)
jge    1144 <loop+0x44>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    111b <loop+0x1b>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<loop>:
mov    (%rdi),%eax
mov    $0x3e7,%ecx
nopw   0x0(%rax,%rax,1)
cltq
movslq (%rdi,%rax,4),%rax
movslq (%rdi,%rax,4),%rax
mov    (%rdi,%rax,4),%eax
add    $0xfffffffd,%ecx
jne    1110 <loop+0x10>
ret

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

LLVM IR (-O2):
define i32 @loop(i32* nocapture %0, i32 %1) {
%3 = load i32, i32* %0
br label %4
4: ; preds = %4, %2
%5 = phi i32 [ %3, %2 ], [ %16, %4 ]
%6 = phi i32 [ 1, %2 ], [ %15, %4 ]
%7 = sext i32 %5 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %0, i64 %10
%12 = load i32, i32* %11
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %0, i64 %13
%15 = add nuw nsw i32 %6, 3
%16 = load i32, i32* %14
%17 = icmp eq i32 %15, 1000
br i1 %17, label %18, label %4
18: ; preds = %4
ret i32 %16
}
int cmp_int(int a, int b) { return a - b; }


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

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

LLVM IR (-O0):
define i32 @cmp_int(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 = sub nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @cmp_int(i32 %0, i32 %1) {
%3 = sub nsw i32 %0, %1
ret i32 %3
}
void error(h) char *h;
{ ziperr(5, h); }


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

x86 assembly (clang, -O2):
<error>:
mov    %rdi,%rsi
mov    $0x5,%edi
xor    %eax,%eax
jmp    1030 <ziperr@plt>

LLVM IR (-O0):
define void @error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @ziperr to i32 (i32, i8*, ...)*)(i32 5, i8* %3)
ret void
}

LLVM IR (-O2):
define void @error(i8* %0) {
%2 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @ziperr to i32 (i32, i8*, ...)*)(i32 5, i8* %0)
ret void
}
/* Variables and functions */
scalar_t__ malloc(size_t);
double *dvector(int nl, int nh) {
  double *v;
  v = (double *)malloc((size_t)((nh - nl + 1) * sizeof(double)));
  if (!v)
    return NULL;
  return v - nl;
}


x86 assembly (clang, -O0):
<dvector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    -0x10(%rbp),%eax
sub    -0xc(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x3,%rdi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    114f <dvector+0x3f>
movq   $0x0,-0x8(%rbp)
jmp    1167 <dvector+0x57>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dvector>:
push   %rbx
mov    %edi,%ebx
sub    %edi,%esi
add    $0x1,%esi
movslq %esi,%rdi
shl    $0x3,%rdi
call   1030 <malloc@plt>
movslq %ebx,%rcx
shl    $0x3,%rcx
mov    %rax,%rdx
sub    %rcx,%rdx
test   %rax,%rax
cmovne %rdx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define double* @dvector(i32 %0, i32 %1) {
%3 = sub i32 1, %0
%4 = add i32 %3, %1
%5 = sext i32 %4 to i64
%6 = shl nsw i64 %5, 3
%7 = tail call i64 @malloc(i64 %6)
%8 = icmp eq i64 %7, 0
%9 = inttoptr i64 %7 to double*
%10 = sext i32 %0 to i64
%11 = sub nsw i64 0, %10
%12 = getelementptr inbounds double, double* %9, i64 %11
%13 = select i1 %8, double* null, double* %12
ret double* %13
}
void f(int i, int j) {
#pragma hlt unroll factor(20)
  for (i = 0; i < 100 && j > 20; i++, j--) {
  }
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x64,-0x4(%rbp)
mov    %al,-0x9(%rbp)
jge    112a <f+0x2a>
cmpl   $0x14,-0x8(%rbp)
setg   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    113a <f+0x3a>
jmp    1156 <f+0x56>
jmp    113f <f+0x3f>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1111 <f+0x11>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @f(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(double *);
void aml_array_dbl_1d_free(double *arr) { free(arr); }


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

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

LLVM IR (-O2):
define void @aml_array_dbl_1d_free(double* nocapture %0) {
%2 = tail call i32 @free(double* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
char *fd2str(int);
int open(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char const *);
char *file2str(const char *path) {
  int fd;
  if ((fd = open(path, O_RDONLY)) == -1) {
    perror(path);
    return NULL;
  }
  return fd2str(fd);
}


x86 assembly (clang, -O0):
<file2str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2ea1(%rip),%rax
mov    (%rax),%esi
call   1040 <open@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
jne    1170 <file2str+0x40>
mov    -0x10(%rbp),%rdi
call   1050 <perror@plt>
movq   $0x0,-0x8(%rbp)
jmp    117c <file2str+0x4c>
mov    -0x14(%rbp),%edi
call   1030 <fd2str@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file2str>:
push   %rbx
mov    %rdi,%rbx
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
call   1040 <open@plt>
cmp    $0xffffffff,%eax
je     114f <file2str+0x1f>
mov    %eax,%edi
pop    %rbx
jmp    1030 <fd2str@plt>
mov    %rbx,%rdi
call   1050 <perror@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@O_RDONLY = global i32 0
define i8* @file2str(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = load i32, i32* @O_RDONLY
%7 = call i32 @open(i8* %5, i32 %6)
store i32 %7, i32* %4
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call i32 @perror(i8* %10)
store i8* null, i8** %2
br label %15
12: ; preds = %1
%13 = load i32, i32* %4
%14 = call i8* @fd2str(i32 %13)
store i8* %14, i8** %2
br label %15
15: ; preds = %12, %9
%16 = load i8*, i8** %2
ret i8* %16
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
define i8* @file2str(i8* nocapture %0) {
%2 = load i32, i32* @O_RDONLY
%3 = tail call i32 @open(i8* %0, i32 %2)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @perror(i8* %0)
br label %9
7: ; preds = %1
%8 = tail call i8* @fd2str(i32 %3)
br label %9
9: ; preds = %7, %5
%10 = phi i8* [ null, %5 ], [ %8, %7 ]
ret i8* %10
}
int int_endian_swap(int i) {
  return ((i & 0xff) << 24) + ((i & 0xff00) << 8) + ((i & 0xff0000) >> 8) +
         ((i >> 24) & 0xff);
}


x86 assembly (clang, -O0):
<int_endian_swap>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
shl    $0x18,%eax
mov    -0x4(%rbp),%ecx
and    $0xff00,%ecx
shl    $0x8,%ecx
add    %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0xff0000,%ecx
sar    $0x8,%ecx
add    %ecx,%eax
mov    -0x4(%rbp),%ecx
sar    $0x18,%ecx
and    $0xff,%ecx
add    %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @int_endian_swap(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 255
%5 = shl i32 %4, 24
%6 = load i32, i32* %2
%7 = and i32 %6, 65280
%8 = shl i32 %7, 8
%9 = add nsw i32 %5, %8
%10 = load i32, i32* %2
%11 = and i32 %10, 16711680
%12 = ashr i32 %11, 8
%13 = add nsw i32 %9, %12
%14 = load i32, i32* %2
%15 = ashr i32 %14, 24
%16 = and i32 %15, 255
%17 = add nsw i32 %13, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @int_endian_swap(i32 %0) {
%2 = tail call i32 @llvm.bswap.i32(i32 %0)
ret i32 %2
}
void golay23_init(void) {}


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

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

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

LLVM IR (-O2):
define void @golay23_init() {
ret void
}
/* Variables and functions */
char *strstr(char *, char *);
int strhas(char *haystack, char *needle) {
  char *r = strstr(haystack, needle);
  return r ? 0 : 1;
}


x86 assembly (clang, -O0):
<strhas>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strhas>:
push   %rax
call   1030 <strstr@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @strhas(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
%7 = load i8*, i8** %4
%8 = call i8* @strstr(i8* %6, i8* %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
%11 = zext i1 %10 to i64
%12 = select i1 %10, i32 0, i32 1
ret i32 %12
}

LLVM IR (-O2):
define i32 @strhas(i8* %0, i8* nocapture %1) {
%3 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%4 = icmp eq i8* %3, null
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int getpid();
int /*<<< orphan*/ printf(char *, int);
void atexit_child1(void) { printf("child1: %d: finished\n", getpid()); }


x86 assembly (clang, -O0):
<atexit_child1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
lea    0xecc(%rip),%rdi
call   1040 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<atexit_child1>:
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"child1: %d: finished\0A\00"
define void @atexit_child1() {
%1 = call i32 (...) @getpid()
%2 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"child1: %d: finished\0A\00"
define void @atexit_child1() {
%1 = tail call i32 (...) @getpid()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
void strcpy_loc(char *dst, char *src) {
  while ((*dst++ = *src++) != 0)
    ;
}


x86 assembly (clang, -O0):
<strcpy_loc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%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)
movsbl %al,%eax
cmp    $0x0,%eax
je     113f <strcpy_loc+0x3f>
jmp    110c <strcpy_loc+0xc>
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy_loc>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rsi,%rax,1),%ecx
mov    %cl,(%rdi,%rax,1)
add    $0x1,%rax
test   %cl,%cl
jne    1110 <strcpy_loc+0x10>
ret

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

LLVM IR (-O2):
define void @strcpy_loc(i8* nocapture writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %8, %3 ]
%5 = phi i8* [ %1, %2 ], [ %6, %3 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = load i8, i8* %5
%8 = getelementptr inbounds i8, i8* %4, i64 1
store i8 %7, i8* %4
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret void
}
/* Variables and functions */
double *malloc(int);
double *alloc_1d_double(int ndim1) { return malloc(ndim1 * sizeof(double)); }


x86 assembly (clang, -O0):
<alloc_1d_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_1d_double>:
shl    $0x3,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define double* @alloc_1d_double(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
%5 = mul i64 %4, 8
%6 = trunc i64 %5 to i32
%7 = call double* @malloc(i32 %6)
ret double* %7
}

LLVM IR (-O2):
define noalias double* @alloc_1d_double(i32 %0) {
%2 = shl i32 %0, 3
%3 = tail call double* @malloc(i32 %2)
ret double* %3
}
int recovery_mode_enabled(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @recovery_mode_enabled() {
ret i32 0
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
void *uDMAControlAlternateBaseGet(void) {
  return ((void *)(*((volatile uint32_t *)(0x400FF00C))));
}


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

x86 assembly (clang, -O2):
<uDMAControlAlternateBaseGet>:
mov    0x400ff00c,%rax
40
ret

LLVM IR (-O0):
define i8* @uDMAControlAlternateBaseGet() {
%1 = load volatile i64, i64* inttoptr (i64 1074786316 to i64*)
%2 = inttoptr i64 %1 to i8*
ret i8* %2
}

LLVM IR (-O2):
define i8* @uDMAControlAlternateBaseGet() {
%1 = load volatile i64, i64* inttoptr (i64 1074786316 to i64*)
%2 = inttoptr i64 %1 to i8*
ret i8* %2
}
void rop3_45_1_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  stk3 = ~*D;
  stk2 = S | stk3;
  stk1 = T ^ stk2;
  *D = (stk1 & (~S) & (~T)) | (*D & S) | (*D & T);
}


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

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

LLVM IR (-O2):
define void @rop3_45_1_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = or i8 %2, %1
%6 = or i8 %5, %4
%7 = xor i8 %6, -1
%8 = and i8 %4, %1
%9 = or i8 %8, %7
%10 = and i8 %4, %2
%11 = or i8 %9, %10
store i8 %11, i8* %0
ret void
}