xunge/DecIR huggingface dataset:
/* Variables and functions */
void *mem_alloc(size_t, char *, int);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *mem_calloc(size_t size, size_t elem, char *fil, int lin) {
  void *m;
  m = mem_alloc(size * elem, fil, lin);
  if (m != NULL)
    memset(m, 0, size * elem);
  return (m);
}


x86 assembly (clang, -O0):
<mem_calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
imul   -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <mem_alloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     116f <mem_calloc+0x4f>
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%rdx
imul   -0x10(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_calloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
imul   %rsi,%rbx
mov    %rbx,%rdi
mov    %rdx,%rsi
mov    %ecx,%edx
call   1040 <mem_alloc@plt>
mov    %rax,%r14
test   %rax,%rax
je     114d <mem_calloc+0x2d>
mov    %r14,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1030 <memset@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @mem_calloc(i64 %0, i64 %1, i8* %2, i32 %3) {
%5 = mul i64 %1, %0
%6 = tail call i8* @mem_alloc(i64 %5, i8* %2, i32 %3)
%7 = icmp eq i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = tail call i32 @memset(i8* %6, i32 0, i64 %5)
br label %10
10: ; preds = %8, %4
ret i8* %6
}
extern unsigned unsigned_greater(unsigned a, unsigned b) { return a > b; }


x86 assembly (clang, -O0):
<unsigned_greater>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
seta   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<unsigned_greater>:
xor    %eax,%eax
cmp    %esi,%edi
seta   %al
ret

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

LLVM IR (-O2):
define i32 @unsigned_greater(i32 %0, i32 %1) {
%3 = icmp ugt i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
int ascftime(char *, char const *, struct tm *);
int /*<<< orphan*/ *localtime_r(int /*<<< orphan*/ const *, struct tm *);
int cftime(char *s, const char *format, const time_t *clock) {
  struct tm res;
  if (localtime_r(clock, &res) == NULL) {
    s[0] = '\0';
    return 0;
  } else {
    return ascftime(s, format, &res);
  }
}


x86 assembly (clang, -O0):
<cftime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <localtime_r@plt>
cmp    $0x0,%rax
jne    115e <cftime+0x3e>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1172 <cftime+0x52>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1040 <ascftime@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cftime>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsp,%rsi
mov    %rdx,%rdi
call   1030 <localtime_r@plt>
test   %rax,%rax
je     114a <cftime+0x2a>
mov    %rsp,%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <ascftime@plt>
jmp    114f <cftime+0x2f>
movb   $0x0,(%rbx)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define i32 @cftime(i8* %0, i8* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca %struct.tm
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32* %2, i32** %7
%9 = load i32*, i32** %7
%10 = call i32* @localtime_r(i32* %9, %struct.tm* %8)
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %15
12: ; preds = %3
%13 = load i8*, i8** %5
%14 = getelementptr inbounds i8, i8* %13, i64 0
store i8 0, i8* %14
store i32 0, i32* %4
br label %19
15: ; preds = %3
%16 = load i8*, i8** %5
%17 = load i8*, i8** %6
%18 = call i32 @ascftime(i8* %16, i8* %17, %struct.tm* %8)
store i32 %18, i32* %4
br label %19
19: ; preds = %15, %12
%20 = load i32, i32* %4
ret i32 %20
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define i32 @cftime(i8* %0, i8* %1, i32* %2) {
%4 = alloca %struct.tm
%5 = bitcast %struct.tm* %4 to i8*
%6 = call i32* @localtime_r(i32* %2, %struct.tm* %4)
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %9
8: ; preds = %3
store i8 0, i8* %0
br label %11
9: ; preds = %3
%10 = call i32 @ascftime(i8* %0, i8* %1, %struct.tm* %4)
br label %11
11: ; preds = %9, %8
%12 = phi i32 [ 0, %8 ], [ %10, %9 ]
ret i32 %12
}
signed char f1(signed char n) { return (long double)n; }


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
mov    %ax,%cx
mov    %cl,%al
mov    %cx,-0x4(%rbp)
filds  -0x4(%rbp)
fstp   %st(0)
movsbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i8 @f1(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sitofp i8 %3 to x86_fp80
%5 = fptosi x86_fp80 %4 to i8
ret i8 %5
}

LLVM IR (-O2):
define signext i8 @f1(i8 returned signext %0) {
ret i8 %0
}
float *vector(nl, nh)
long nh, nl;
{
  float *v;
  v = (float *)malloc((unsigned int)((nh - nl + 1 + 1) * sizeof(float)));
  if (!v)
    nrerror("allocation failure in vector()");
  return v - nl + 1;
}


x86 assembly (clang, -O0):
<vector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
sub    -0x8(%rbp),%rax
add    $0x1,%rax
add    $0x1,%rax
shl    $0x2,%rax
mov    %eax,%eax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    116a <vector+0x4a>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <nrerror@plt>
mov    -0x18(%rbp),%rax
xor    %ecx,%ecx
sub    -0x8(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
add    $0x4,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vector>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
sub    %r14d,%esi
lea    0x8(,%rsi,4),%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114c <vector+0x2c>
lea    0xebb(%rip),%rdi
xor    %eax,%eax
call   1030 <nrerror@plt>
shl    $0x2,%r14
sub    %r14,%rbx
add    $0x4,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [31 x i8] c"allocation failure in vector()\00"
define float* @vector(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca float*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = load i64, i64* %3
%8 = sub nsw i64 %6, %7
%9 = add nsw i64 %8, 1
%10 = add nsw i64 %9, 1
%11 = mul i64 %10, 4
%12 = trunc i64 %11 to i32
%13 = zext i32 %12 to i64
%14 = call i8* @malloc(i64 %13)
%15 = bitcast i8* %14 to float*
store float* %15, float** %5
%16 = load float*, float** %5
%17 = icmp ne float* %16, null
br i1 %17, label %20, label %18
18: ; preds = %2
%19 = call i32 (i8*, ...) bitcast (i32 (...)* @nrerror to i32 (i8*, ...)*)(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %18, %2
%21 = load float*, float** %5
%22 = load i64, i64* %3
%23 = sub i64 0, %22
%24 = getelementptr inbounds float, float* %21, i64 %23
%25 = getelementptr inbounds float, float* %24, i64 1
ret float* %25
}

LLVM IR (-O2):
@.str = [31 x i8] c"allocation failure in vector()\00"
define float* @vector(i64 %0, i64 %1) {
%3 = sub nsw i64 %1, %0
%4 = shl i64 %3, 2
%5 = add i64 %4, 8
%6 = and i64 %5, 4294967292
%7 = tail call i8* @malloc(i64 %6)
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = tail call i32 (i8*, ...) bitcast (i32 (...)* @nrerror to i32 (i8*, ...)*)(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %2
%12 = bitcast i8* %7 to float*
%13 = sub i64 0, %0
%14 = getelementptr inbounds float, float* %12, i64 %13
%15 = getelementptr inbounds float, float* %14, i64 1
ret float* %15
}
void f1(void) {
  unsigned int a = -5;
  (void)a;
}


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
movl   $0xfffffffb,-0x4(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @f1() {
%1 = alloca i32
store i32 -5, i32* %1
%2 = load i32, i32* %1
ret void
}

LLVM IR (-O2):
define void @f1() {
ret void
}
short test_short_5(short a, short b, short c, short d, short e) { return 1583; }


x86 assembly (clang, -O0):
<test_short_5>:
push   %rbp
mov    %rsp,%rbp
mov    %r8w,%ax
mov    %di,-0x2(%rbp)
mov    %si,-0x4(%rbp)
mov    %dx,-0x6(%rbp)
mov    %cx,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    $0x62f,%ax
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_short_5>:
mov    $0x62f,%ax
ret

LLVM IR (-O0):
define signext i16 @test_short_5(i16 signext %0, i16 signext %1, i16 signext %2, i16 signext %3, i16 signext %4) {
%6 = alloca i16
%7 = alloca i16
%8 = alloca i16
%9 = alloca i16
%10 = alloca i16
store i16 %0, i16* %6
store i16 %1, i16* %7
store i16 %2, i16* %8
store i16 %3, i16* %9
store i16 %4, i16* %10
ret i16 1583
}

LLVM IR (-O2):
define signext i16 @test_short_5(i16 signext %0, i16 signext %1, i16 signext %2, i16 signext %3, i16 signext %4) {
ret i16 1583
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main(int argc, char const *argv[]) {
  assert(1 != 1);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @assert(i32 0)
ret i32 0
}
int main(int argc, const char **argv) {
  int *p = 0;
  *p = 0;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32* null, i32** %6
%7 = load i32*, i32** %6
store i32 0, i32* %7
ret i32 0
}

LLVM IR (-O2):
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void test_program_get_versions_from_changelog() {
  printf("test_program_get_versions_from_changelog...");
  printf("Ok\n");
}


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

x86 assembly (clang, -O2):
<test_program_get_versions_from_changelog>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <printf@plt>
lea    0xef8(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [44 x i8] c"test_program_get_versions_from_changelog...\00"
@.str.1 = [4 x i8] c"Ok\0A\00"
define void @test_program_get_versions_from_changelog() {
%1 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [44 x i8] c"test_program_get_versions_from_changelog...\00"
@str = [3 x i8] c"Ok\00"
define void @test_program_get_versions_from_changelog() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret void
}
int ret4(int a0, int a1, int a2, int a3, int a4, int a5) { return a4; }


x86 assembly (clang, -O0):
<ret4>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ret4>:
mov    %r8d,%eax
ret

LLVM IR (-O0):
define i32 @ret4(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%13 = load i32, i32* %11
ret i32 %13
}

LLVM IR (-O2):
define i32 @ret4(i32 %0, i32 %1, i32 %2, i32 %3, i32 returned %4, i32 %5) {
ret i32 %4
}
void motion_result8(int *data) {
  int i = 0;
  int j = data[0];
  if (i < data[2]) {
    j = j * 21;
    do {
      data[i] = j + i;
      i++;
    } while (i < data[2]);
  }
}


x86 assembly (clang, -O0):
<motion_result8>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
cmp    0x8(%rcx),%eax
jge    115e <motion_result8+0x5e>
imul   $0x15,-0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edx
add    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
cmp    0x8(%rcx),%eax
jl     112f <motion_result8+0x2f>
jmp    115e <motion_result8+0x5e>
pop    %rbp
ret

x86 assembly (clang, -O2):
<motion_result8>:
cmpl   $0x0,0x8(%rdi)
jle    1123 <motion_result8+0x23>
mov    (%rdi),%eax
lea    (%rax,%rax,4),%ecx
lea    (%rax,%rcx,4),%eax
xor    %ecx,%ecx
lea    (%rax,%rcx,1),%edx
mov    %edx,(%rdi,%rcx,4)
add    $0x1,%rcx
movslq 0x8(%rdi),%rdx
cmp    %rdx,%rcx
jl     1110 <motion_result8+0x10>
ret

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

LLVM IR (-O2):
define void @motion_result8(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %17
5: ; preds = %1
%6 = load i32, i32* %0
%7 = mul nsw i32 %6, 21
br label %8
8: ; preds = %8, %5
%9 = phi i64 [ %13, %8 ], [ 0, %5 ]
%10 = trunc i64 %9 to i32
%11 = add nsw i32 %7, %10
%12 = getelementptr inbounds i32, i32* %0, i64 %9
store i32 %11, i32* %12
%13 = add nuw nsw i64 %9, 1
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = icmp slt i64 %13, %15
br i1 %16, label %8, label %17
17: ; preds = %8, %1
ret void
}
/* Type definitions */
typedef int uint_fast16_t;
typedef scalar_t__ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
uint16_t BigEndianReadU16(const uint8_t *bytes) {
  return (uint16_t)((uint_fast16_t)bytes[0] << 8 | (uint_fast16_t)bytes[1]);
}


x86 assembly (clang, -O0):
<BigEndianReadU16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
mov    0x8(%rcx),%rcx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<BigEndianReadU16>:
mov    (%rdi),%eax
shl    $0x8,%eax
or     0x8(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @BigEndianReadU16(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = getelementptr inbounds i64, i64* %3, i64 0
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = shl i32 %6, 8
%8 = load i64*, i64** %2
%9 = getelementptr inbounds i64, i64* %8, i64 1
%10 = load i64, i64* %9
%11 = trunc i64 %10 to i32
%12 = or i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @BigEndianReadU16(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = trunc i64 %2 to i32
%4 = shl i32 %3, 8
%5 = getelementptr inbounds i64, i64* %0, i64 1
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i32
%8 = or i32 %4, %7
ret i32 %8
}
/* Variables and functions */
char *strrchr(char const *, char);
const char *pjf_basename(const char *path) {
  char *l;
  l = strrchr(path, '/');
  return l ? l + 1 : path;
}


x86 assembly (clang, -O0):
<pjf_basename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114a <pjf_basename+0x3a>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1152 <pjf_basename+0x42>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pjf_basename>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmove  %rbx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @pjf_basename(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strrchr(i8* %4, i8 signext 47)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 1
br label %13
11: ; preds = %1
%12 = load i8*, i8** %2
br label %13
13: ; preds = %11, %8
%14 = phi i8* [ %10, %8 ], [ %12, %11 ]
ret i8* %14
}

LLVM IR (-O2):
define i8* @pjf_basename(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
ret i8* %5
}
void __adf_os_mem_free(void *buf) { ; }


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

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

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

LLVM IR (-O2):
define void @__adf_os_mem_free(i8* nocapture %0) {
ret void
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint32_t;
typedef int /*<<< orphan*/ p;

/* Variables and functions */
uint32_t scrypt_le32dec(const void *pp) {
  const uint8_t *p = (uint8_t const *)pp;
  return ((uint32_t)(p[0]) + ((uint32_t)(p[1]) << 8) +
          ((uint32_t)(p[2]) << 16) + ((uint32_t)(p[3]) << 24));
}


x86 assembly (clang, -O0):
<scrypt_le32dec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rcx
mov    0x8(%rcx),%rcx
shl    $0x8,%ecx
add    %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    0x10(%rcx),%rcx
shl    $0x10,%ecx
add    %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    0x18(%rcx),%rcx
shl    $0x18,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<scrypt_le32dec>:
mov    0x8(%rdi),%eax
mov    0x10(%rdi),%ecx
shl    $0x8,%eax
add    (%rdi),%eax
shl    $0x10,%ecx
add    %eax,%ecx
mov    0x18(%rdi),%eax
shl    $0x18,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @scrypt_le32dec(i8* %0) {
%2 = alloca i8*
%3 = alloca i64*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i64*
store i64* %5, i64** %3
%6 = load i64*, i64** %3
%7 = getelementptr inbounds i64, i64* %6, i64 0
%8 = load i64, i64* %7
%9 = trunc i64 %8 to i32
%10 = load i64*, i64** %3
%11 = getelementptr inbounds i64, i64* %10, i64 1
%12 = load i64, i64* %11
%13 = trunc i64 %12 to i32
%14 = shl i32 %13, 8
%15 = add nsw i32 %9, %14
%16 = load i64*, i64** %3
%17 = getelementptr inbounds i64, i64* %16, i64 2
%18 = load i64, i64* %17
%19 = trunc i64 %18 to i32
%20 = shl i32 %19, 16
%21 = add nsw i32 %15, %20
%22 = load i64*, i64** %3
%23 = getelementptr inbounds i64, i64* %22, i64 3
%24 = load i64, i64* %23
%25 = trunc i64 %24 to i32
%26 = shl i32 %25, 24
%27 = add nsw i32 %21, %26
ret i32 %27
}

LLVM IR (-O2):
define i32 @scrypt_le32dec(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
%5 = getelementptr inbounds i8, i8* %0, i64 8
%6 = bitcast i8* %5 to i64*
%7 = load i64, i64* %6
%8 = trunc i64 %7 to i32
%9 = shl i32 %8, 8
%10 = add nsw i32 %9, %4
%11 = getelementptr inbounds i8, i8* %0, i64 16
%12 = bitcast i8* %11 to i64*
%13 = load i64, i64* %12
%14 = trunc i64 %13 to i32
%15 = shl i32 %14, 16
%16 = add nsw i32 %10, %15
%17 = getelementptr inbounds i8, i8* %0, i64 24
%18 = bitcast i8* %17 to i64*
%19 = load i64, i64* %18
%20 = trunc i64 %19 to i32
%21 = shl i32 %20, 24
%22 = add nsw i32 %16, %21
ret i32 %22
}
/* Type definitions */
typedef size_t uint8_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char *, size_t);
void substr(char *src, char *dst, uint8_t start, uint8_t len) {
  memcpy(dst, &src[start], len - 1);
}


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

x86 assembly (clang, -O2):
<substr>:
mov    %rsi,%rax
lea    (%rdi,%rdx,1),%rsi
lea    -0x1(%rcx),%rdx
mov    %rax,%rdi
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
define void @substr(i8* %0, i8* %1, i64 %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
store i8* %0, i8** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%9 = load i8*, i8** %6
%10 = load i8*, i8** %5
%11 = load i64, i64* %7
%12 = getelementptr inbounds i8, i8* %10, i64 %11
%13 = load i64, i64* %8
%14 = sub i64 %13, 1
%15 = call i32 @memcpy(i8* %9, i8* %12, i64 %14)
ret void
}

LLVM IR (-O2):
define void @substr(i8* %0, i8* %1, i64 %2, i64 %3) {
%5 = getelementptr inbounds i8, i8* %0, i64 %2
%6 = add i64 %3, -1
%7 = tail call i32 @memcpy(i8* %1, i8* %5, i64 %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_file(char *);
int main(int argc, char *argv[]) {
  if (argc > 1)
    test_file(argv[1]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    113d <main+0x2d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <test_file@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
cmp    $0x2,%edi
jl     1123 <main+0x13>
push   %rax
mov    0x8(%rsi),%rdi
call   1030 <test_file@plt>
add    $0x8,%rsp
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @test_file(i8* %6)
br label %8
8: ; preds = %4, %2
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fputc(int /*<<< orphan*/, int /*<<< orphan*/ *);
void writeZeros(int num, FILE *fp) {
  int k;
  for (k = 0; k < num; k++) {
    fputc(0, fp);
  }
}


x86 assembly (clang, -O0):
<writeZeros>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    114b <writeZeros+0x3b>
mov    -0x10(%rbp),%rsi
xor    %edi,%edi
call   1030 <fputc@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <writeZeros+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeZeros>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
jle    112f <writeZeros+0x1f>
mov    %rsi,%rbx
mov    %edi,%ebp
nopl   0x0(%rax)
xor    %edi,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
add    $0xffffffff,%ebp
jne    1120 <writeZeros+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @writeZeros(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 = %13, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %3
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %16
10: ; preds = %6
%11 = load i32*, i32** %4
%12 = call i32 @fputc(i32 0, i32* %11)
br label %13
13: ; preds = %10
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 1
store i32 %15, i32* %5
br label %6
16: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @writeZeros(i32 %0, i32* nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %9
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ 0, %2 ]
%6 = tail call i32 @fputc(i32 0, i32* %1)
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, %0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
ret void
}
int is_leap_year(int year) {
  return (year % 4) == 0 && ((year % 100) != 0 || (year % 400) == 0);
}


x86 assembly (clang, -O0):
<is_leap_year>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
xor    %eax,%eax
cmp    $0x0,%edx
mov    %al,-0x5(%rbp)
jne    1153 <is_leap_year+0x53>
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    $0x1,%al
cmp    $0x0,%edx
mov    %al,-0x6(%rbp)
jne    114d <is_leap_year+0x4d>
mov    -0x4(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
sete   %al
mov    %al,-0x6(%rbp)
mov    -0x6(%rbp),%al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_leap_year>:
xor    %eax,%eax
test   $0x3,%dil
je     1109 <is_leap_year+0x9>
ret
imul   $0xc28f5c29,%edi,%ecx
add    $0x51eb850,%ecx
mov    %ecx,%edx
ror    $0x2,%edx
mov    $0x1,%eax
cmp    $0x28f5c28,%edx
ja     1108 <is_leap_year+0x8>
ror    $0x4,%ecx
xor    %eax,%eax
cmp    $0xa3d70b,%ecx
setb   %al
ret

LLVM IR (-O0):
define i32 @is_leap_year(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = srem i32 %3, 4
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %16
6: ; preds = %1
%7 = load i32, i32* %2
%8 = srem i32 %7, 100
%9 = icmp ne i32 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %6
%11 = load i32, i32* %2
%12 = srem i32 %11, 400
%13 = icmp eq i32 %12, 0
br label %14
14: ; preds = %10, %6
%15 = phi i1 [ true, %6 ], [ %13, %10 ]
br label %16
16: ; preds = %14, %1
%17 = phi i1 [ false, %1 ], [ %15, %14 ]
%18 = zext i1 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @is_leap_year(i32 %0) {
%2 = and i32 %0, 3
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %11
4: ; preds = %1
%5 = srem i32 %0, 100
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = srem i32 %0, 400
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %4, %7, %1
%12 = phi i32 [ 0, %1 ], [ 1, %4 ], [ %10, %7 ]
ret i32 %12
}
int fun1123() { return 1123; }


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

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

LLVM IR (-O0):
define i32 @fun1123() {
ret i32 1123
}

LLVM IR (-O2):
define i32 @fun1123() {
ret i32 1123
}
/* Variables and functions */
int omap_rev();
int is_omap3515(void) {
  return (((omap_rev() >> 16) & 0xffff) == (0x3515)) ? 1 : 0;
}


x86 assembly (clang, -O0):
<is_omap3515>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <omap_rev@plt>
mov    %eax,%edx
sar    $0x10,%edx
and    $0xffff,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x3515,%edx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_omap3515>:
push   %rax
xor    %eax,%eax
call   1030 <omap_rev@plt>
and    $0xffff0000,%eax
xor    %ecx,%ecx
cmp    $0x35150000,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @is_omap3515() {
%1 = call i32 (...) @omap_rev()
%2 = ashr i32 %1, 16
%3 = and i32 %2, 65535
%4 = icmp eq i32 %3, 13589
%5 = zext i1 %4 to i64
%6 = select i1 %4, i32 1, i32 0
ret i32 %6
}

LLVM IR (-O2):
define i32 @is_omap3515() {
%1 = tail call i32 (...) @omap_rev()
%2 = and i32 %1, -65536
%3 = icmp eq i32 %2, 890568704
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t smpte_fec_get_pt_recovery(const uint8_t *p_fec) {
  return p_fec[4] & 0x7f;
}


x86 assembly (clang, -O0):
<smpte_fec_get_pt_recovery>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%eax
and    $0x7f,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<smpte_fec_get_pt_recovery>:
mov    0x10(%rdi),%eax
and    $0x7f,%eax
ret

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

LLVM IR (-O2):
define i32 @smpte_fec_get_pt_recovery(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 4
%3 = load i32, i32* %2
%4 = and i32 %3, 127
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void MG_reset(void) {
  printf("ERROR: MG_reset called but DDalphaAMG library not included.\n");
  exit(1);
}


x86 assembly (clang, -O0):
<MG_reset>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<MG_reset>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [61 x i8] c"ERROR: MG_reset called but DDalphaAMG library not included.\0A\00"
define void @MG_reset() {
%1 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [60 x i8] c"ERROR: MG_reset called but DDalphaAMG library not included.\00"
define void @MG_reset() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
struct metal_list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ metal_list_add_before(struct metal_list *,
                                         struct metal_list *);
void metal_list_add_tail(struct metal_list *list, struct metal_list *node) {
  metal_list_add_before(list, node);
}


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

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

LLVM IR (-O0):
%struct.metal_list = type { i32 }
define void @metal_list_add_tail(%struct.metal_list* %0, %struct.metal_list* %1) {
%3 = alloca %struct.metal_list*
%4 = alloca %struct.metal_list*
store %struct.metal_list* %0, %struct.metal_list** %3
store %struct.metal_list* %1, %struct.metal_list** %4
%5 = load %struct.metal_list*, %struct.metal_list** %3
%6 = load %struct.metal_list*, %struct.metal_list** %4
%7 = call i32 @metal_list_add_before(%struct.metal_list* %5, %struct.metal_list* %6)
ret void
}

LLVM IR (-O2):
%struct.metal_list = type { i32 }
define void @metal_list_add_tail(%struct.metal_list* %0, %struct.metal_list* %1) {
%3 = tail call i32 @metal_list_add_before(%struct.metal_list* %0, %struct.metal_list* %1)
ret void
}
/* Type definitions */
typedef unsigned long volatile uint32_t;

/* Variables and functions */
void I2CMasterGlitchFilterConfigSet(uint32_t ui32Base, uint32_t ui32Config) {
  ;
  (*((volatile unsigned long *)(ui32Base + 0x0000000C))) |= ui32Config;
}


x86 assembly (clang, -O0):
<I2CMasterGlitchFilterConfigSet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%rcx
or     %rdx,%rcx
mov    %rcx,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2CMasterGlitchFilterConfigSet>:
mov    %rdi,-0x8(%rsp)
mov    %rsi,-0x10(%rsp)
mov    -0x10(%rsp),%rax
mov    -0x8(%rsp),%rcx
or     %rax,0xc(%rcx)
ret

LLVM IR (-O0):
define void @I2CMasterGlitchFilterConfigSet(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store volatile i64 %0, i64* %3
store volatile i64 %1, i64* %4
%5 = load volatile i64, i64* %4
%6 = load volatile i64, i64* %3
%7 = add i64 %6, 12
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = or i64 %9, %5
store volatile i64 %10, i64* %8
ret void
}

LLVM IR (-O2):
define void @I2CMasterGlitchFilterConfigSet(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store volatile i64 %0, i64* %3
store volatile i64 %1, i64* %4
%5 = load volatile i64, i64* %4
%6 = load volatile i64, i64* %3
%7 = add i64 %6, 12
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = or i64 %9, %5
store volatile i64 %10, i64* %8
ret void
}
/* Type definitions */
struct map_entry {
  int dummy;
};
struct map {
  int dummy;
};

/* Variables and functions */
struct map_entry *map_iter_from(struct map const *, int /*<<< orphan*/);
struct map_entry *map_iter_first(const struct map *map) {
  return map_iter_from(map, 0);
}


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

x86 assembly (clang, -O2):
<map_iter_first>:
xor    %esi,%esi
jmp    1030 <map_iter_from@plt>

LLVM IR (-O0):
%struct.map_entry = type { i32 }
%struct.map = type { i32 }
define %struct.map_entry* @map_iter_first(%struct.map* %0) {
%2 = alloca %struct.map*
store %struct.map* %0, %struct.map** %2
%3 = load %struct.map*, %struct.map** %2
%4 = call %struct.map_entry* @map_iter_from(%struct.map* %3, i32 0)
ret %struct.map_entry* %4
}

LLVM IR (-O2):
%struct.map_entry = type { i32 }
%struct.map = type { i32 }
define %struct.map_entry* @map_iter_first(%struct.map* %0) {
%2 = tail call %struct.map_entry* @map_iter_from(%struct.map* %0, i32 0)
ret %struct.map_entry* %2
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ memcpy(char *, char const *, int);
int strlen(char const *);
char *duplicate(const char *src) {
  int length = strlen(src);
  char *dst = malloc(length + 1);
  memcpy(dst, src, length + 1);
  return dst;
}


x86 assembly (clang, -O0):
<duplicate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
add    $0x1,%edx
call   1040 <memcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<duplicate>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
lea    0x1(%rax),%ebp
mov    %ebp,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1040 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8* @duplicate(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = add nsw i32 %7, 1
%9 = call i8* @malloc(i32 %8)
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = load i8*, i8** %2
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
%14 = call i32 @memcpy(i8* %10, i8* %11, i32 %13)
%15 = load i8*, i8** %4
ret i8* %15
}

LLVM IR (-O2):
define i8* @duplicate(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 @memcpy(i8* %4, i8* %0, i32 %3)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ test_var(int, int, int, int, int);
int main() { test_var(4, 5, 6, 7, 8); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4,%edi
mov    $0x5,%esi
mov    $0x6,%edx
mov    $0x7,%ecx
mov    $0x8,%r8d
call   1030 <test_var@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x4,%edi
mov    $0x5,%esi
mov    $0x6,%edx
mov    $0x7,%ecx
mov    $0x8,%r8d
call   1030 <test_var@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @test_var(i32 4, i32 5, i32 6, i32 7, i32 8)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @test_var(i32 4, i32 5, i32 6, i32 7, i32 8)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ volatile int32_t;

/* Variables and functions */
int /*<<< orphan*/ android_memory_barrier();
extern int32_t android_atomic_release_load(volatile int32_t *ptr) {
  android_memory_barrier();
  return *ptr;
}


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

x86 assembly (clang, -O2):
<android_atomic_release_load>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <android_memory_barrier@plt>
mov    (%rbx),%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @android_atomic_release_load(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = call i32 (...) @android_memory_barrier()
%4 = load i32*, i32** %2
%5 = load volatile i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @android_atomic_release_load(i32* %0) {
%2 = tail call i32 (...) @android_memory_barrier()
%3 = load volatile i32, i32* %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int bigfunc(int TID) {
  printf("This function is called from thread %d and needs to be thread safe\n",
         TID);
  return (1);
}


x86 assembly (clang, -O0):
<bigfunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bigfunc>:
push   %rax
mov    %edi,%esi
lea    0xee6(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [68 x i8] c"This function is called from thread %d and needs to be thread safe\0A\00"
define i32 @bigfunc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 1
}

LLVM IR (-O2):
@.str = [68 x i8] c"This function is called from thread %d and needs to be thread safe\0A\00"
define i32 @bigfunc(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i32 1
}
/* Type definitions */
struct rlimit {
  int /*<<< orphan*/ rlim_max;
  int /*<<< orphan*/ rlim_cur;
};

/* Variables and functions */
int /*<<< orphan*/ RLIMIT_AS;
int /*<<< orphan*/ getrlimit(int /*<<< orphan*/, struct rlimit *);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int main() {
  struct rlimit rl;
  getrlimit(RLIMIT_AS, &rl);
  printf("%ld, %ld", rl.rlim_cur, rl.rlim_max);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1040 <getrlimit@plt>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.rlimit = type { i32, i32 }
@RLIMIT_AS = global i32 0
@.str = [9 x i8] c"%ld, %ld\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.rlimit
store i32 0, i32* %1
%3 = load i32, i32* @RLIMIT_AS
%4 = call i32 @getrlimit(i32 %3, %struct.rlimit* %2)
%5 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %2, i32 0, i32 1
%6 = load i32, i32* %5
%7 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %2, i32 0, i32 0
%8 = load i32, i32* %7
%9 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %8)
ret i32 0
}

LLVM IR (-O2):
%struct.rlimit = type { i32, i32 }
@RLIMIT_AS = global i32 0
@.str = [9 x i8] c"%ld, %ld\00"
define i32 @main() {
%1 = alloca %struct.rlimit
%2 = bitcast %struct.rlimit* %1 to i8*
%3 = load i32, i32* @RLIMIT_AS
%4 = call i32 @getrlimit(i32 %3, %struct.rlimit* %1)
%5 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %1, i64 0, i32 1
%6 = load i32, i32* %5
%7 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %1, i64 0, i32 0
%8 = load i32, i32* %7
%9 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %8)
ret i32 0
}
int main(int a, char **b) {}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
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**
store i32 %0, i32* %3
store i8** %1, i8*** %4
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
int main() {
  int a = 5;
  int b;
  b = a;
  return b;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 5
}
void XtIsShell() {}


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

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

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

LLVM IR (-O2):
define void @XtIsShell() {
ret void
}
/* Variables and functions */
int write(int, char *, int);
void writeBlank() {
  int rc;
  (void)rc;
  rc = write(1, " ", 1);
}


x86 assembly (clang, -O0):
<writeBlank>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edx
lea    0xedc(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
mov    %eax,-0x4(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeBlank>:
lea    0xee9(%rip),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
jmp    1030 <write@plt>

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
define void @writeBlank() {
%1 = alloca i32
%2 = load i32, i32* %1
%3 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
store i32 %3, i32* %1
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
define void @writeBlank() {
%1 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ nufft_hr();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  srand(time(NULL));
  nufft_hr();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    $0x0,%al
call   1050 <nufft_hr@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
xor    %eax,%eax
call   1050 <nufft_hr@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @time(i32* null)
%6 = call i32 @srand(i32 %5)
%7 = call i32 (...) @nufft_hr()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = tail call i32 (...) @nufft_hr()
ret i32 0
}
unsigned long read_cr4() {
  unsigned long cr4;
  asm volatile("mov %%cr4, %0" : "=r"(cr4));
  return cr4;
}


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

x86 assembly (clang, -O2):
<read_cr4>:
mov    %cr4,%rax
ret

LLVM IR (-O0):
define i64 @read_cr4() {
%1 = alloca i64
%2 = call i64 asm sideeffect "mov %cr4, $0", "=r,~{dirflag},~{fpsr},~{flags}"()
store i64 %2, i64* %1
%3 = load i64, i64* %1
ret i64 %3
}

LLVM IR (-O2):
define i64 @read_cr4() {
%1 = tail call i64 asm sideeffect "mov %cr4, $0", "=r,~{dirflag},~{fpsr},~{flags}"()
ret i64 %1
}
int test_imm_26uint32_reg(unsigned int val) {
  return ((val) & (0x26 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_26uint32_reg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 38
%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_26uint32_reg(i32 %0) {
%2 = and i32 %0, 38
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}