xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
time_t __attribute__((no)) pcp_time(time_t *t) { return time(t); }


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

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

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

LLVM IR (-O2):
define i32 @pcp_time(i32* %0) {
%2 = tail call i32 @time(i32* %0)
ret i32 %2
}
int memrlimit_cgroup_charge_as(struct mm_struct *mm, unsigned long nr_pages) {
  return 0;
}


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

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

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

LLVM IR (-O2):
%struct.mm_struct = type opaque
define i32 @memrlimit_cgroup_charge_as(%struct.mm_struct* nocapture readnone %0, i64 %1) {
ret i32 0
}
/* Variables and functions */
char *malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *strdup(const char *s) {
  char *dup = malloc(strlen(s) + 1);
  if (dup == NULL)
    return NULL;
  strcpy(dup, s);
  return dup;
}


x86 assembly (clang, -O0):
<strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    116d <strdup+0x3d>
movq   $0x0,-0x8(%rbp)
jmp    1182 <strdup+0x52>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1158 <strdup+0x28>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @strdup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @malloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i32 @strcpy(i8* %4, i8* %0)
br label %8
8: ; preds = %1, %6
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ fn_glutDisplayFunc(void *);
void glutDisplayFunc(void *fn) { fn_glutDisplayFunc(fn); }


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

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

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

LLVM IR (-O2):
define void @glutDisplayFunc(i8* %0) {
%2 = tail call i32 @fn_glutDisplayFunc(i8* %0)
ret void
}
void proto(x) int x;
{}


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

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

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

LLVM IR (-O2):
define void @proto(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __coverity_alloc__(int);
void *cn_cbor_array_create(void *context, void *errp) {
  __coverity_alloc__(10);
}


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

x86 assembly (clang, -O2):
<cn_cbor_array_create>:
mov    $0xa,%edi
jmp    1030 <__coverity_alloc__@plt>

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

LLVM IR (-O2):
define noalias i8* @cn_cbor_array_create(i8* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = tail call i32 @__coverity_alloc__(i32 10)
ret i8* undef
}
double f3(double x) {
  return ((5.0 + 3.0 * x) / (1.0 - x - x * x + x * x * x));
}


x86 assembly (clang, -O0):
<f3>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xef2(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeee(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xed2(%rip),%xmm1
subsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm3
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
movsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f3>:
movsd  0xef8(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xef4(%rip),%xmm1
movsd  0xef4(%rip),%xmm2
subsd  %xmm0,%xmm2
movapd %xmm0,%xmm3
mulsd  %xmm0,%xmm3
subsd  %xmm3,%xmm2
mulsd  %xmm0,%xmm3
addsd  %xmm2,%xmm3
divsd  %xmm3,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @f3(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %3, double 5.000000e+00)
%5 = load double, double* %2
%6 = fsub double 1.000000e+00, %5
%7 = load double, double* %2
%8 = load double, double* %2
%9 = fneg double %7
%10 = call double @llvm.fmuladd.f64(double %9, double %8, double %6)
%11 = load double, double* %2
%12 = load double, double* %2
%13 = fmul double %11, %12
%14 = load double, double* %2
%15 = call double @llvm.fmuladd.f64(double %13, double %14, double %10)
%16 = fdiv double %4, %15
ret double %16
}

LLVM IR (-O2):
define double @f3(double %0) {
%2 = tail call double @llvm.fmuladd.f64(double %0, double 3.000000e+00, double 5.000000e+00)
%3 = fsub double 1.000000e+00, %0
%4 = fneg double %0
%5 = tail call double @llvm.fmuladd.f64(double %4, double %0, double %3)
%6 = fmul double %0, %0
%7 = tail call double @llvm.fmuladd.f64(double %6, double %0, double %5)
%8 = fdiv double %2, %7
ret double %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
extern void shmem_longlong_or_to_all(long long *target, long long *source,
                                     int nreduce, int PE_start,
                                     int logPE_stride, int PE_size,
                                     long long *pWrk, long *pSync) {
  printf("\nOpenSHMEM Analyzer\n");
}


x86 assembly (clang, -O0):
<shmem_longlong_or_to_all>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [21 x i8] c"\0AOpenSHMEM Analyzer\0A\00"
define void @shmem_longlong_or_to_all(i64* %0, i64* %1, i32 %2, i32 %3, i32 %4, i32 %5, i64* %6, i64* %7) {
%9 = alloca i64*
%10 = alloca i64*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i64*
%16 = alloca i64*
store i64* %0, i64** %9
store i64* %1, i64** %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store i64* %6, i64** %15
store i64* %7, i64** %16
%17 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [20 x i8] c"\0AOpenSHMEM Analyzer\00"
define void @shmem_longlong_or_to_all(i64* nocapture readnone %0, i64* nocapture readnone %1, i32 %2, i32 %3, i32 %4, i32 %5, i64* nocapture readnone %6, i64* nocapture readnone %7) {
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int open(char const *const, int /*<<< orphan*/);
int checkFile(const char *const path) {
  int fileDesc = open(path, O_RDONLY);
  if (fileDesc == -1)
    return 0;
  else {
    close(fileDesc);
    return 1;
  }
}


x86 assembly (clang, -O0):
<checkFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2eb1(%rip),%rax
mov    (%rax),%esi
call   1040 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1157 <checkFile+0x37>
movl   $0x0,-0x4(%rbp)
jmp    1166 <checkFile+0x46>
mov    -0x14(%rbp),%edi
call   1030 <close@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkFile>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
call   1040 <open@plt>
cmp    $0xffffffff,%eax
je     1142 <checkFile+0x22>
mov    %eax,%edi
call   1030 <close@plt>
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@O_RDONLY = global i32 0
define i32 @checkFile(i8* %0) {
%2 = alloca i32
%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 = load i32, i32* %4
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 0, i32* %2
br label %14
11: ; preds = %1
%12 = load i32, i32* %4
%13 = call i32 @close(i32 %12)
store i32 1, i32* %2
br label %14
14: ; preds = %11, %10
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
define i32 @checkFile(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 %7, label %5
5: ; preds = %1
%6 = tail call i32 @close(i32 %3)
br label %7
7: ; preds = %1, %5
%8 = phi i32 [ 1, %5 ], [ 0, %1 ]
ret i32 %8
}
double Tween_QuadraticInEasing(double k) { return k * k; }


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

x86 assembly (clang, -O2):
<Tween_QuadraticInEasing>:
mulsd  %xmm0,%xmm0
ret

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

LLVM IR (-O2):
define double @Tween_QuadraticInEasing(double %0) {
%2 = fmul double %0, %0
ret double %2
}
/* Variables and functions */
void *memchr(const void *buf, int ch, size_t n) {
  const unsigned char *src = buf;
  while (n--) {
    if (*src == (unsigned char)ch) {
      return (void *)src;
    }
    src++;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<memchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x20(%rbp)
cmp    $0x0,%rax
je     1163 <memchr+0x63>
mov    -0x28(%rbp),%rax
movzbl (%rax),%eax
mov    -0x14(%rbp),%ecx
movzbl %cl,%ecx
cmp    %ecx,%eax
jne    1152 <memchr+0x52>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    116b <memchr+0x6b>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1117 <memchr+0x17>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<memchr>:
test   %rdx,%rdx
je     1122 <memchr+0x22>
mov    %rdi,%rax
nopl   0x0(%rax,%rax,1)
cmp    %sil,(%rax)
je     1124 <memchr+0x24>
add    $0xffffffffffffffff,%rdx
add    $0x1,%rax
test   %rdx,%rdx
jne    1110 <memchr+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @memchr(i8* %0, i32 %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %16, label %5
5: ; preds = %3
%6 = trunc i32 %1 to i8
br label %7
7: ; preds = %5, %13
%8 = phi i64 [ %2, %5 ], [ %10, %13 ]
%9 = phi i8* [ %0, %5 ], [ %14, %13 ]
%10 = add i64 %8, -1
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, %6
br i1 %12, label %16, label %13
13: ; preds = %7
%14 = getelementptr inbounds i8, i8* %9, i64 1
%15 = icmp eq i64 %10, 0
br i1 %15, label %16, label %7
16: ; preds = %7, %13, %3
%17 = phi i8* [ null, %3 ], [ null, %13 ], [ %9, %7 ]
ret i8* %17
}
int cmp_gt_ll(const void *p, const void *q) {
  const long long a = *(const long long *)p;
  const long long b = *(const long long *)q;
  do {
    if (a < b)
      return +1;
    if (b < a)
      return -1;
    return 0;
  } while (0);
}


x86 assembly (clang, -O0):
<cmp_gt_ll>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jge    113c <cmp_gt_ll+0x3c>
movl   $0x1,-0x4(%rbp)
jmp    115d <cmp_gt_ll+0x5d>
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
jge    1156 <cmp_gt_ll+0x56>
movl   $0xffffffff,-0x4(%rbp)
jmp    115d <cmp_gt_ll+0x5d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_gt_ll>:
mov    (%rdi),%rax
mov    (%rsi),%rcx
xor    %edx,%edx
cmp    %rax,%rcx
setl   %dl
neg    %edx
cmp    %rcx,%rax
mov    $0x1,%eax
cmovge %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @cmp_gt_ll(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i64*
%4 = load i64, i64* %3
%5 = bitcast i8* %1 to i64*
%6 = load i64, i64* %5
%7 = icmp slt i64 %4, %6
%8 = icmp slt i64 %6, %4
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}
int IsAscii(char C) { return (C & ~0x7F) == 0; }


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

x86 assembly (clang, -O2):
<IsAscii>:
not    %dil
shr    $0x7,%dil
movzbl %dil,%eax
ret

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

LLVM IR (-O2):
define i32 @IsAscii(i8 signext %0) {
%2 = xor i8 %0, -1
%3 = lshr i8 %2, 7
%4 = zext i8 %3 to i32
ret i32 %4
}
int main(void) {
  int n = 3;
  int m = 4;
  int a[n][6];
  int(*p)[6];
  p = a;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
movl   $0x4,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
mov    %rsp,%rax
mov    %rax,-0x18(%rbp)
lea    (%rcx,%rcx,2),%rax
lea    0xf(,%rax,8),%rdx
movabs $0x3ffffffff0,%rax
and    %rax,%rdx
mov    %rsp,%rax
sub    %rdx,%rax
mov    %rax,%rsp
mov    %rcx,-0x20(%rbp)
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
void d2i_X509_PUBKEY(void) {}


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

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

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

LLVM IR (-O2):
define void @d2i_X509_PUBKEY() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ i2cmaster_WriteAddrREG(int, unsigned char, unsigned char);
void i2c1master_WriteAddrREG(unsigned char addr, unsigned char rwbit) {
  i2cmaster_WriteAddrREG(1, addr, rwbit);
}


x86 assembly (clang, -O0):
<i2c1master_WriteAddrREG>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    -0x1(%rbp),%al
mov    $0x1,%edi
movzbl %al,%esi
movzbl -0x2(%rbp),%edx
call   1030 <i2cmaster_WriteAddrREG@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c1master_WriteAddrREG>:
mov    %esi,%edx
mov    %edi,%esi
mov    $0x1,%edi
jmp    1030 <i2cmaster_WriteAddrREG@plt>

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

LLVM IR (-O2):
define void @i2c1master_WriteAddrREG(i8 zeroext %0, i8 zeroext %1) {
%3 = tail call i32 @i2cmaster_WriteAddrREG(i32 1, i8 zeroext %0, i8 zeroext %1)
ret void
}
/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ putchar(int);
main() {
  int c;
  while ((c = getchar()) != EOF) {
    if (c == ' ' || c == '\t' || c == '\n')
      putchar('\n');
    else
      putchar(c);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2ea8(%rip),%rcx
cmp    (%rcx),%eax
je     1182 <main+0x62>
cmpl   $0x20,-0x8(%rbp)
je     1166 <main+0x46>
cmpl   $0x9,-0x8(%rbp)
je     1166 <main+0x46>
cmpl   $0xa,-0x8(%rbp)
jne    1175 <main+0x55>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    117d <main+0x5d>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    112f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb6(%rip),%rbx
cmp    (%rbx),%eax
jne    1140 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
movabs $0x100000600,%r14
jmp    1162 <main+0x42>
nopl   0x0(%rax)
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%rbx),%eax
je     1136 <main+0x16>
cmp    $0x20,%eax
ja     1150 <main+0x30>
mov    $0xa,%edi
mov    %eax,%ecx
bt     %rcx,%r14
jb     1152 <main+0x32>
jmp    1150 <main+0x30>

LLVM IR (-O0):
@EOF = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %21, %0
%4 = call i32 (...) @getchar()
store i32 %4, i32* %2
%5 = load i32, i32* @EOF
%6 = icmp ne i32 %4, %5
br i1 %6, label %7, label %22
7: ; preds = %3
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 32
br i1 %9, label %16, label %10
10: ; preds = %7
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 9
br i1 %12, label %16, label %13
13: ; preds = %10
%14 = load i32, i32* %2
%15 = icmp eq i32 %14, 10
br i1 %15, label %16, label %18
16: ; preds = %13, %10, %7
%17 = call i32 @putchar(i32 10)
br label %21
18: ; preds = %13
%19 = load i32, i32* %2
%20 = call i32 @putchar(i32 %19)
br label %21
21: ; preds = %18, %16
br label %3
22: ; preds = %3
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %13, label %4
4: ; preds = %0, %7
%5 = phi i32 [ %10, %7 ], [ %1, %0 ]
switch i32 %5, label %6 [
i32 32, label %7
i32 10, label %7
i32 9, label %7
]
6: ; preds = %4
br label %7
7: ; preds = %4, %4, %4, %6
%8 = phi i32 [ %5, %6 ], [ 10, %4 ], [ 10, %4 ], [ 10, %4 ]
%9 = tail call i32 @putchar(i32 %8)
%10 = tail call i32 (...) @getchar()
%11 = load i32, i32* @EOF
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %4
13: ; preds = %7, %0
ret i32 0
}
int cmp_chars(char a, char b) { return a - b; }


x86 assembly (clang, -O0):
<cmp_chars>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movsbl -0x1(%rbp),%eax
movsbl -0x2(%rbp),%ecx
sub    %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @cmp_chars(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
%9 = sub nsw i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @cmp_chars(i8 signext %0, i8 signext %1) {
%3 = sext i8 %0 to i32
%4 = sext i8 %1 to i32
%5 = sub nsw i32 %3, %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ Inst_Printf(char *, char *);
void C_Ret(void) {
  Inst_Printf("ldq", "$26,0($30)");
  Inst_Printf("addq", "$30,32,$30");
  Inst_Printf("ret", "$31,($26),1");
}


x86 assembly (clang, -O0):
<C_Ret>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xee2(%rip),%rsi
call   1030 <Inst_Printf@plt>
lea    0xee1(%rip),%rdi
lea    0xedf(%rip),%rsi
call   1030 <Inst_Printf@plt>
lea    0xede(%rip),%rdi
lea    0xedb(%rip),%rsi
call   1030 <Inst_Printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<C_Ret>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xee5(%rip),%rsi
call   1030 <Inst_Printf@plt>
lea    0xee4(%rip),%rdi
lea    0xee2(%rip),%rsi
call   1030 <Inst_Printf@plt>
lea    0xee1(%rip),%rdi
lea    0xede(%rip),%rsi
pop    %rax
jmp    1030 <Inst_Printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"ldq\00"
@.str.1 = [11 x i8] c"$26,0($30)\00"
@.str.2 = [5 x i8] c"addq\00"
@.str.3 = [11 x i8] c"$30,32,$30\00"
@.str.4 = [4 x i8] c"ret\00"
@.str.5 = [12 x i8] c"$31,($26),1\00"
define void @C_Ret() {
%1 = call i32 @Inst_Printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 @Inst_Printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%3 = call i32 @Inst_Printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"ldq\00"
@.str.1 = [11 x i8] c"$26,0($30)\00"
@.str.2 = [5 x i8] c"addq\00"
@.str.3 = [11 x i8] c"$30,32,$30\00"
@.str.4 = [4 x i8] c"ret\00"
@.str.5 = [12 x i8] c"$31,($26),1\00"
define void @C_Ret() {
%1 = tail call i32 @Inst_Printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @Inst_Printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%3 = tail call i32 @Inst_Printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ *cg_queue_get(void *);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
void *cg_consumer(void *queue) {
  for (int i = 1; i < 5000000;)
    if ((cg_queue_get(queue) != NULL))
      ++i;
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<cg_consumer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x4c4b40,-0x14(%rbp)
jge    1161 <cg_consumer+0x41>
mov    -0x10(%rbp),%rdi
call   1030 <cg_queue_get@plt>
cmp    $0x0,%rax
je     115c <cg_consumer+0x3c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1133 <cg_consumer+0x13>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cg_consumer>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x1,%ebp
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <cg_queue_get@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%ebp
cmp    $0x4c4b40,%ebp
jb     1130 <cg_consumer+0x10>
xor    %edi,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <pthread_exit@plt>

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

LLVM IR (-O2):
define noalias i8* @cg_consumer(i8* %0) {
br label %4
2: ; preds = %4
%3 = tail call i32 @pthread_exit(i32* null)
ret i8* undef
4: ; preds = %1, %4
%5 = phi i32 [ 1, %1 ], [ %9, %4 ]
%6 = tail call i32* @cg_queue_get(i8* %0)
%7 = icmp ne i32* %6, null
%8 = zext i1 %7 to i32
%9 = add nuw nsw i32 %5, %8
%10 = icmp ult i32 %9, 5000000
br i1 %10, label %4, label %2
}
void tex_disp_perct(double perct) {}


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

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

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

LLVM IR (-O2):
define void @tex_disp_perct(double %0) {
ret void
}
int g() {
  static int x = 2;
  return x;
}


x86 assembly (clang, -O0):
<g>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f16(%rip),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@g.x = internal global i32 2
define i32 @g() {
%1 = load i32, i32* @g.x
ret i32 %1
}

LLVM IR (-O2):
define i32 @g() {
ret i32 2
}
/* Variables and functions */
int /*<<< orphan*/ z80_ed_45_retn();
void z80_ed_55_retn(void) { z80_ed_45_retn(); }


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

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

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

LLVM IR (-O2):
define void @z80_ed_55_retn() {
%1 = tail call i32 (...) @z80_ed_45_retn()
ret void
}
int parity(unsigned int x) {
  x ^= x >> 1;
  x ^= x >> 2;
  x = (x & 0x11111111U) * 0x11111111U;
  return (x >> 28) & 1;
}


x86 assembly (clang, -O0):
<parity>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x2,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x11111111,%eax
imul   $0x11111111,%eax,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1c,%eax
and    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<parity>:
mov    %edi,%eax
shr    %eax
xor    %edi,%eax
mov    %eax,%ecx
shr    $0x2,%ecx
xor    %eax,%ecx
and    $0x11111111,%ecx
imul   $0x11111111,%ecx,%eax
shr    $0x1c,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @parity(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = lshr i32 %3, 1
%5 = load i32, i32* %2
%6 = xor i32 %5, %4
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = lshr i32 %7, 2
%9 = load i32, i32* %2
%10 = xor i32 %9, %8
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = and i32 %11, 286331153
%13 = mul i32 %12, 286331153
store i32 %13, i32* %2
%14 = load i32, i32* %2
%15 = lshr i32 %14, 28
%16 = and i32 %15, 1
ret i32 %16
}

LLVM IR (-O2):
define i32 @parity(i32 %0) {
%2 = lshr i32 %0, 1
%3 = xor i32 %2, %0
%4 = lshr i32 %3, 2
%5 = xor i32 %4, %3
%6 = and i32 %5, 286331153
%7 = mul i32 %6, 286331153
%8 = lshr i32 %7, 28
%9 = and i32 %8, 1
ret i32 %9
}
void camc(const int c, const int n, const int a, const int f) {}


x86 assembly (clang, -O0):
<camc>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @camc(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
ret void
}

LLVM IR (-O2):
define void @camc(i32 %0, i32 %1, i32 %2, i32 %3) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void __attribute__((constructor)) constructor() {
  printf(
      "\nTEST START -------------------------------------------------------\n");
}


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

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

LLVM IR (-O0):
@.str = [69 x i8] c"\0ATEST START -------------------------------------------------------\0A\00"
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @constructor, i8* null }]
define void @constructor() {
%1 = call i32 @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @constructor, i8* null }]
@str = [68 x i8] c"\0ATEST START -------------------------------------------------------\00"
define void @constructor() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print_char(char);
void positive_or_not(int i) {
  if (i == 0) {
    print_char('Z');
  } else if (i > 0) {
    print_char('P');
  } else {
    print_char('N');
  }
}


x86 assembly (clang, -O0):
<positive_or_not>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1134 <positive_or_not+0x24>
mov    $0x5a,%edi
call   1030 <print_char@plt>
jmp    115c <positive_or_not+0x4c>
cmpl   $0x0,-0x4(%rbp)
jle    114d <positive_or_not+0x3d>
mov    $0x50,%edi
call   1030 <print_char@plt>
jmp    1157 <positive_or_not+0x47>
mov    $0x4e,%edi
call   1030 <print_char@plt>
jmp    115c <positive_or_not+0x4c>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<positive_or_not>:
test   %edi,%edi
setg   %al
add    %al,%al
add    $0x4e,%al
test   %edi,%edi
movzbl %al,%eax
mov    $0x5a,%ecx
cmovne %eax,%ecx
movzbl %cl,%edi
jmp    1030 <print_char@plt>

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

LLVM IR (-O2):
define void @positive_or_not(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = icmp sgt i32 %0, 0
%4 = select i1 %3, i8 80, i8 78
%5 = select i1 %2, i8 90, i8 %4
%6 = tail call i32 @print_char(i8 signext %5)
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t set_xlow_0(uint64_t u) { return ~(u + 1) | u; }


x86 assembly (clang, -O0):
<set_xlow_0>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
xor    $0xffffffff,%eax
or     -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_xlow_0>:
mov    $0xfffffffe,%eax
sub    %edi,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @set_xlow_0(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 1
%5 = xor i32 %4, -1
%6 = load i32, i32* %2
%7 = or i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @set_xlow_0(i32 %0) {
%2 = sub i32 -2, %0
%3 = or i32 %2, %0
ret i32 %3
}
int test_imm_56uint16_reg(unsigned short val) {
  return ((val) & (0x56 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_56uint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0x56,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_56uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 86
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int f(int x) {
  if (x == 0) {
    return 1;
  } else {
    return 2;
  }
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    111d <f+0x1d>
movl   $0x1,-0x4(%rbp)
jmp    1124 <f+0x24>
movl   $0x2,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
cmp    $0x1,%edi
mov    $0x2,%eax
sbb    $0x0,%eax
ret

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

LLVM IR (-O2):
define i32 @f(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i32 1, i32 2
ret i32 %3
}
void pcp_def_net_eicmp6_metrics(void) {}


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

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

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

LLVM IR (-O2):
define void @pcp_def_net_eicmp6_metrics() {
ret void
}
/* Type definitions */
struct Node {
  int dummy;
};

/* Variables and functions */
int INT_MAX;
int INT_MIN;
int isBSTfind(struct Node *, int *, int *, int *);
int findLargestBST(struct Node *node) {
  int min = INT_MIN;
  int max = INT_MAX;
  int result = 0;
  int tmp = isBSTfind(node, &min, &min, &result);
  return result;
}


x86 assembly (clang, -O0):
<findLargestBST>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    0x2eb9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rdx
lea    -0x14(%rbp),%rcx
mov    %rdx,%rsi
call   1030 <isBSTfind@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findLargestBST>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4(%rsp)
movl   $0x0,(%rsp)
lea    0x4(%rsp),%rdx
mov    %rsp,%rcx
mov    %rdx,%rsi
call   1030 <isBSTfind@plt>
mov    (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.Node = type { i32 }
@INT_MIN = global i32 0
@INT_MAX = global i32 0
define i32 @findLargestBST(%struct.Node* %0) {
%2 = alloca %struct.Node*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store %struct.Node* %0, %struct.Node** %2
%7 = load i32, i32* @INT_MIN
store i32 %7, i32* %3
%8 = load i32, i32* @INT_MAX
store i32 %8, i32* %4
store i32 0, i32* %5
%9 = load %struct.Node*, %struct.Node** %2
%10 = call i32 @isBSTfind(%struct.Node* %9, i32* %3, i32* %3, i32* %5)
store i32 %10, i32* %6
%11 = load i32, i32* %5
ret i32 %11
}

LLVM IR (-O2):
%struct.Node = type { i32 }
@INT_MIN = global i32 0
@INT_MAX = global i32 0
define i32 @findLargestBST(%struct.Node* %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
%5 = load i32, i32* @INT_MIN
store i32 %5, i32* %2
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%7 = call i32 @isBSTfind(%struct.Node* %0, i32* %2, i32* %2, i32* %3)
%8 = load i32, i32* %3
ret i32 %8
}
/* Variables and functions */
int ib_compare_bytes(char const *, int /*<<< orphan*/, char const *,
                     int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
int ib_hash_compare_cstr(const void *key1, const void *key2) {
  const char *x = (const char *)key1;
  const char *y = (const char *)key2;
  return ib_compare_bytes(x, strlen(x), y, strlen(y));
}


x86 assembly (clang, -O0):
<ib_hash_compare_cstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x38(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    %eax,%ecx
call   1030 <ib_compare_bytes@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ib_hash_compare_cstr>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
mov    %eax,%ecx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <ib_compare_bytes@plt>

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

LLVM IR (-O2):
define i32 @ib_hash_compare_cstr(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @strlen(i8* %1)
%5 = tail call i32 @ib_compare_bytes(i8* %0, i32 %3, i8* %1, i32 %4)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ bitClear(unsigned int *, int);
int /*<<< orphan*/ bitSet(unsigned int *, int);
void bitWrite(unsigned int *x, int n, int b) {
  if (b == 0)
    bitClear(x, n);
  if (b == 1)
    bitSet(x, n);
  return;
}


x86 assembly (clang, -O0):
<bitWrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    1148 <bitWrite+0x28>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <bitClear@plt>
cmpl   $0x1,-0x10(%rbp)
jne    115e <bitWrite+0x3e>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <bitSet@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitWrite>:
cmp    $0x1,%edx
je     112e <bitWrite+0xe>
test   %edx,%edx
jne    1133 <bitWrite+0x13>
jmp    1040 <bitClear@plt>
jmp    1030 <bitSet@plt>
ret

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

LLVM IR (-O2):
define void @bitWrite(i32* %0, i32 %1, i32 %2) {
switch i32 %2, label %8 [
i32 0, label %4
i32 1, label %6
]
4: ; preds = %3
%5 = tail call i32 @bitClear(i32* %0, i32 %1)
br label %8
6: ; preds = %3
%7 = tail call i32 @bitSet(i32* %0, i32 %1)
br label %8
8: ; preds = %4, %3, %6
ret void
}
int get_frame_height(void) { return 480; }


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

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

LLVM IR (-O0):
define i32 @get_frame_height() {
ret i32 480
}

LLVM IR (-O2):
define i32 @get_frame_height() {
ret i32 480
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a = 0;
  scanf("%d", &a);
  printf("-%d = %d\n", a, ~a + 1);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [10 x i8] c"-%d = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = sub i32 0, %4
%6 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 %5)
ret i32 0
}
int omap_device_scale(struct device *target_dev, unsigned long rate) {
  return 0;
}


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

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

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

LLVM IR (-O2):
%struct.device = type opaque
define i32 @omap_device_scale(%struct.device* nocapture readnone %0, i64 %1) {
ret i32 0
}
/* Variables and functions */
int FileDescrForEntry(int);
int write(int, char *, int);
int SerialPortWrite(int portNum, char *bufPtr, int bufSize) {
  int fDescr, count = 0;
  if ((fDescr = FileDescrForEntry(portNum)) < 0)
    return 0;
  count = write(fDescr, bufPtr, bufSize);
  if (count < 0)
    return 0;
  return count;
}


x86 assembly (clang, -O0):
<SerialPortWrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <FileDescrForEntry@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jge    1159 <SerialPortWrite+0x39>
movl   $0x0,-0x4(%rbp)
jmp    1187 <SerialPortWrite+0x67>
mov    -0x18(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <write@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    1181 <SerialPortWrite+0x61>
movl   $0x0,-0x4(%rbp)
jmp    1187 <SerialPortWrite+0x67>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SerialPortWrite>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%rbx
call   1040 <FileDescrForEntry@plt>
test   %eax,%eax
js     1148 <SerialPortWrite+0x28>
mov    %eax,%edi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1030 <write@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
cmovns %ecx,%eax
jmp    114a <SerialPortWrite+0x2a>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @SerialPortWrite(i32 %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @FileDescrForEntry(i32 %0)
%5 = icmp slt i32 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %3
%7 = tail call i32 @write(i32 %4, i8* %1, i32 %2)
%8 = icmp sgt i32 %7, 0
%9 = select i1 %8, i32 %7, i32 0
br label %10
10: ; preds = %6, %3
%11 = phi i32 [ 0, %3 ], [ %9, %6 ]
ret i32 %11
}