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

/* Variables and functions */
int /*<<< orphan*/ save_var(char *, int /*<<< orphan*/);
int /*<<< orphan*/ uitoa(int /*<<< orphan*/, int, char *, int);
void save_cmd_status(int status) {
  char str_status[4] = {0};
  save_var("?", uitoa((uint)status, 10, str_status, 4));
}


x86 assembly (clang, -O0):
<save_cmd_status>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1040 <memset@plt>
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rdx
mov    $0xa,%esi
mov    $0x4,%ecx
call   1030 <uitoa@plt>
mov    %eax,%esi
lea    0xe96(%rip),%rdi
call   1050 <save_var@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<save_cmd_status>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rdx
mov    $0xa,%esi
mov    $0x4,%ecx
call   1030 <uitoa@plt>
lea    0xebc(%rip),%rdi
mov    %eax,%esi
call   1040 <save_var@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [2 x i8] c"?\00"
define void @save_cmd_status(i32 %0) {
%2 = alloca i32
%3 = alloca [4 x i8]
store i32 %0, i32* %2
%4 = bitcast [4 x i8]* %3 to i8*
%5 = load i32, i32* %2
%6 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%7 = call i32 @uitoa(i32 %5, i32 10, i8* %6, i32 4)
%8 = call i32 @save_var(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"?\00"
define void @save_cmd_status(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = call i32 @uitoa(i32 %0, i32 10, i8* %3, i32 4)
%5 = call i32 @save_var(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}
void swap_pointers(char **x, char **y) {
  char *tmp;
  tmp = *x;
  *x = *y;
  *y = tmp;
}


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

x86 assembly (clang, -O2):
<swap_pointers>:
mov    (%rdi),%rax
mov    (%rsi),%rcx
mov    %rcx,(%rdi)
mov    %rax,(%rsi)
ret

LLVM IR (-O0):
define void @swap_pointers(i8** %0, i8** %1) {
%3 = alloca i8**
%4 = alloca i8**
%5 = alloca i8*
store i8** %0, i8*** %3
store i8** %1, i8*** %4
%6 = load i8**, i8*** %3
%7 = load i8*, i8** %6
store i8* %7, i8** %5
%8 = load i8**, i8*** %4
%9 = load i8*, i8** %8
%10 = load i8**, i8*** %3
store i8* %9, i8** %10
%11 = load i8*, i8** %5
%12 = load i8**, i8*** %4
store i8* %11, i8** %12
ret void
}

LLVM IR (-O2):
define void @swap_pointers(i8** nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %0
%4 = load i8*, i8** %1
store i8* %4, i8** %0
store i8* %3, i8** %1
ret void
}
/* Variables and functions */
int kmem_generic(int /*<<< orphan*/, unsigned long, void *, unsigned int);
int kmem_write(unsigned long offset, void *buf, unsigned int count) {
  return kmem_generic(0, offset, buf, count);
}


x86 assembly (clang, -O0):
<kmem_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
xor    %edi,%edi
call   1030 <kmem_generic@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kmem_write>:
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %rdi,%rsi
xor    %edi,%edi
jmp    1030 <kmem_generic@plt>

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

LLVM IR (-O2):
define i32 @kmem_write(i64 %0, i8* %1, i32 %2) {
%4 = tail call i32 @kmem_generic(i32 0, i64 %0, i8* %1, i32 %2)
ret i32 %4
}
__attribute__((noipa)) float f2(float a, float b) { return a < 0 ? a : b; }


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    112a <f2+0x2a>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1134 <f2+0x34>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2>:
xorps  %xmm2,%xmm2
movaps %xmm0,%xmm3
cmpltss %xmm2,%xmm3
andps  %xmm3,%xmm0
andnps %xmm1,%xmm3
orps   %xmm3,%xmm0
ret

LLVM IR (-O0):
define float @f2(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = fcmp olt float %5, 0.000000e+00
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = load float, float* %3
br label %11
9: ; preds = %2
%10 = load float, float* %4
br label %11
11: ; preds = %9, %7
%12 = phi float [ %8, %7 ], [ %10, %9 ]
ret float %12
}

LLVM IR (-O2):
define float @f2(float %0, float %1) {
%3 = fcmp olt float %0, 0.000000e+00
%4 = select i1 %3, float %0, float %1
ret float %4
}
int blah() {}


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

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

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

LLVM IR (-O2):
define i32 @blah() {
ret i32 undef
}
__attribute__((no)) int f2(int n) { return n / 77; }


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x4d,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2>:
movslq %edi,%rax
imul   $0x3531dec1,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x24,%rax
add    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @f2(i32 %0) {
%2 = sdiv i32 %0, 77
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ f1();
int /*<<< orphan*/ f2();
scalar_t__ g1();
scalar_t__ g2();
int main() {
  f1();
  f2();
  if (g1() != g2())
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <f1@plt>
mov    $0x0,%al
call   1030 <f2@plt>
mov    $0x0,%al
call   1050 <g1@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1070 <g2@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
je     11a6 <main+0x46>
mov    $0x0,%al
call   1040 <abort@plt>
xor    %edi,%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1060 <f1@plt>
xor    %eax,%eax
call   1030 <f2@plt>
xor    %eax,%eax
call   1050 <g1@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1070 <g2@plt>
cmp    %rax,%rbx
jne    118c <main+0x2c>
xor    %edi,%edi
call   1080 <exit@plt>
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @f1()
%3 = call i32 (...) @f2()
%4 = call i64 (...) @g1()
%5 = call i64 (...) @g2()
%6 = icmp ne i64 %4, %5
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 (...) @abort()
unreachable
9: ; preds = %0
%10 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @f1()
%2 = tail call i32 (...) @f2()
%3 = tail call i64 (...) @g1()
%4 = tail call i64 (...) @g2()
%5 = icmp eq i64 %3, %4
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %0
%9 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
extern uint32_t cel_fnv_hash(const char *str) {
  register uint32_t h = 2166136261UL;
  uint32_t prime = 16777619;
  while (*str != '\0') {
    h *= prime;
    h ^= *str++;
  }
  return (h & 0x7FFFFFFF);
}


x86 assembly (clang, -O0):
<cel_fnv_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x811c9dc5,-0xc(%rbp)
movl   $0x1000193,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     114d <cel_fnv_hash+0x4d>
mov    -0x10(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <cel_fnv_hash+0x16>
mov    -0xc(%rbp),%eax
and    $0x7fffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cel_fnv_hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     112c <cel_fnv_hash+0x2c>
add    $0x1,%rdi
mov    $0x811c9dc5,%eax
nop
movsbl %cl,%ecx
imul   $0x1000193,%eax,%eax
xor    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <cel_fnv_hash+0x10>
and    $0x7fffffff,%eax
ret
mov    $0x11c9dc5,%eax
ret

LLVM IR (-O0):
define i32 @cel_fnv_hash(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
store i32 -2128831035, i32* %3
store i32 16777619, i32* %4
br label %5
5: ; preds = %10, %1
%6 = load i8*, i8** %2
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %20
10: ; preds = %5
%11 = load i32, i32* %4
%12 = load i32, i32* %3
%13 = mul nsw i32 %12, %11
store i32 %13, i32* %3
%14 = load i8*, i8** %2
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %2
%16 = load i8, i8* %14
%17 = sext i8 %16 to i32
%18 = load i32, i32* %3
%19 = xor i32 %18, %17
store i32 %19, i32* %3
br label %5
20: ; preds = %5
%21 = load i32, i32* %3
%22 = and i32 %21, 2147483647
ret i32 %22
}

LLVM IR (-O2):
define i32 @cel_fnv_hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %10, %4 ], [ %0, %1 ]
%7 = phi i32 [ %11, %4 ], [ -2128831035, %1 ]
%8 = sext i8 %5 to i32
%9 = mul nsw i32 %7, 16777619
%10 = getelementptr inbounds i8, i8* %6, i64 1
%11 = xor i32 %9, %8
%12 = load i8, i8* %10
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = and i32 %11, 2147483647
br label %16
16: ; preds = %14, %1
%17 = phi i32 [ 18652613, %1 ], [ %15, %14 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  fprintf(stdout, "Hello, tyr json!\n");
  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)
mov    0x2eb3(%rip),%rax
mov    (%rax),%edi
lea    0xeca(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [18 x i8] c"Hello, tyr json!\0A\00"
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* @stdout
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [18 x i8] c"Hello, tyr json!\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @stdout
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *, char *);
int /*<<< orphan*/ stderr;
void falla(char *mensaje) {
  fprintf(stderr, "%s%s%s\n", "\x1B[31m", mensaje, "\x1B[0m");
  exit(1);
}


x86 assembly (clang, -O0):
<falla>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rcx
lea    0xec0(%rip),%rsi
lea    0xec1(%rip),%rdx
lea    0xec0(%rip),%r8
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<falla>:
push   %rax
mov    %rdi,%rcx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
lea    0xecd(%rip),%rdx
lea    0xecc(%rip),%r8
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [8 x i8] c"%s%s%s\0A\00"
@.str.1 = [6 x i8] c"\1B[31m\00"
@.str.2 = [5 x i8] c"\1B[0m\00"
define void @falla(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [8 x i8] c"%s%s%s\0A\00"
@.str.1 = [6 x i8] c"\1B[31m\00"
@.str.2 = [5 x i8] c"\1B[0m\00"
define void @falla(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int write_standard_target_Laurent_system(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc4c(762, a, b, c, 0);
  return fail;
}


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

x86 assembly (clang, -O2):
<write_standard_target_Laurent_system>:
mov    $0x2fa,%edi
xor    %r8d,%r8d
jmp    1030 <_ada_use_c2phc4c@plt>

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

LLVM IR (-O2):
define i32 @write_standard_target_Laurent_system() {
%1 = tail call i32 @_ada_use_c2phc4c(i32 762, i32* undef, i32* undef, double* undef, i32 0)
ret i32 %1
}
/* Variables and functions */
int FS_X_OS_Init();
int /*<<< orphan*/ FS__fat_block_init();
int FS_Init(void) {
  int x;
  x = FS_X_OS_Init();
  if (x == 0) {
    FS__fat_block_init();
  }
  return x;
}


x86 assembly (clang, -O0):
<FS_Init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <FS_X_OS_Init@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1143 <FS_Init+0x23>
mov    $0x0,%al
call   1030 <FS__fat_block_init@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FS_Init>:
push   %rbx
xor    %eax,%eax
call   1040 <FS_X_OS_Init@plt>
mov    %eax,%ebx
test   %eax,%eax
jne    1135 <FS_Init+0x15>
xor    %eax,%eax
call   1030 <FS__fat_block_init@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @FS_Init() {
%1 = tail call i32 (...) @FS_X_OS_Init()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @FS__fat_block_init()
br label %5
5: ; preds = %3, %0
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int discriminant;
  scanf("%d", &discriminant);
  if (discriminant < 0) {
    printf("0\n");
  } else if (discriminant == 0) {
    printf("1\n");
  } else {
    printf("2\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jge    115a <main+0x3a>
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
jmp    1186 <main+0x66>
cmpl   $0x0,-0x8(%rbp)
jne    1175 <main+0x55>
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
jmp    1181 <main+0x61>
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
jmp    1186 <main+0x66>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
lea    0xec7(%rip),%rax
lea    0xebe(%rip),%rcx
cmove  %rax,%rcx
lea    0xeb7(%rip),%rdi
cmovns %rcx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"0\0A\00"
@.str.2 = [3 x i8] c"1\0A\00"
@.str.3 = [3 x i8] c"2\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%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 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %16
8: ; preds = %0
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %15
13: ; preds = %8
%14 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %15
15: ; preds = %13, %11
br label %16
16: ; preds = %15, %6
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [2 x i8] c"2\00"
@str.4 = [2 x i8] c"1\00"
@str.5 = [2 x i8] c"0\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%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 = icmp slt i32 %4, 0
%6 = icmp eq i32 %4, 0
%7 = select i1 %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0)
%8 = select i1 %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str.5, i64 0, i64 0), i8* %7
%9 = call i32 @puts(i8* dereferenceable(1) %8)
ret i32 0
}
/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
int /*<<< orphan*/ usleep(int);
ssize_t netio_null_recv(void *null_ptr, void *pkt, size_t max_len) {
  usleep(200000);
  return (-1);
}


x86 assembly (clang, -O0):
<netio_null_recv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x30d40,%edi
call   1030 <usleep@plt>
mov    $0xffffffff,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<netio_null_recv>:
push   %rax
mov    $0x30d40,%edi
call   1030 <usleep@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @netio_null_recv(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = call i32 @usleep(i32 200000)
ret i32 -1
}

LLVM IR (-O2):
define i32 @netio_null_recv(i8* nocapture readnone %0, i8* nocapture readnone %1, i64 %2) {
%4 = tail call i32 @usleep(i32 200000)
ret i32 -1
}
void transfer_YUV888_to_VYU888(unsigned char *(*output), unsigned char *input) {
  (*output)[0] = input[2];
  (*output)[1] = input[0];
  (*output)[2] = input[1];
  (*output) += 3;
}


x86 assembly (clang, -O0):
<transfer_YUV888_to_VYU888>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2(%rax),%cl
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %cl,0x1(%rax)
mov    -0x10(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %cl,0x2(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x3,%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<transfer_YUV888_to_VYU888>:
mov    0x2(%rsi),%al
mov    (%rdi),%rcx
mov    %al,(%rcx)
mov    (%rsi),%al
mov    (%rdi),%rcx
mov    %al,0x1(%rcx)
mov    0x1(%rsi),%al
mov    (%rdi),%rcx
mov    %al,0x2(%rcx)
addq   $0x3,(%rdi)
ret

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

LLVM IR (-O2):
define void @transfer_YUV888_to_VYU888(i8** nocapture %0, i8* nocapture %1) {
%3 = getelementptr inbounds i8, i8* %1, i64 2
%4 = load i8, i8* %3
%5 = load i8*, i8** %0
store i8 %4, i8* %5
%6 = load i8, i8* %1
%7 = load i8*, i8** %0
%8 = getelementptr inbounds i8, i8* %7, i64 1
store i8 %6, i8* %8
%9 = getelementptr inbounds i8, i8* %1, i64 1
%10 = load i8, i8* %9
%11 = load i8*, i8** %0
%12 = getelementptr inbounds i8, i8* %11, i64 2
store i8 %10, i8* %12
%13 = load i8*, i8** %0
%14 = getelementptr inbounds i8, i8* %13, i64 3
store i8* %14, i8** %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ by(int /*<<< orphan*/);
int /*<<< orphan*/ sub();
void sub_by(uint32_t x) {
  by(x);
  sub();
}


x86 assembly (clang, -O0):
<sub_by>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <by@plt>
mov    $0x0,%al
call   1040 <sub@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sub_by>:
push   %rax
call   1030 <by@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <sub@plt>

LLVM IR (-O0):
define void @sub_by(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @by(i32 %3)
%5 = call i32 (...) @sub()
ret void
}

LLVM IR (-O2):
define void @sub_by(i32 %0) {
%2 = tail call i32 @by(i32 %0)
%3 = tail call i32 (...) @sub()
ret void
}
/* Variables and functions */
double sin(double);
void GreenRedColRamp(double frac, double *red, double *green, double *blue) {
  *red = (1.0 - frac);
  *green = (0.80 * frac + 0.1);
  *blue = (0.80 * sin(3.141592653589793238462643383279502884197169399 * frac) +
           0.1);
}


x86 assembly (clang, -O0):
<GreenRedColRamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movsd  0xee7(%rip),%xmm0
subsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x8(%rbp),%xmm0
movsd  0xeb5(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeb1(%rip),%xmm1
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  0xea5(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
movsd  0xe83(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe7f(%rip),%xmm1
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GreenRedColRamp>:
push   %rbx
mov    %rdx,%rbx
movsd  0xee4(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rdi)
movapd %xmm0,%xmm1
mulsd  0xed8(%rip),%xmm1
addsd  0xed8(%rip),%xmm1
movsd  %xmm1,(%rsi)
mulsd  0xed4(%rip),%xmm0
call   1030 <sin@plt>
mulsd  0xeb7(%rip),%xmm0
addsd  0xeb7(%rip),%xmm0
movsd  %xmm0,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @GreenRedColRamp(double %0, double* %1, double* %2, double* %3) {
%5 = alloca double
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
store double %0, double* %5
store double* %1, double** %6
store double* %2, double** %7
store double* %3, double** %8
%9 = load double, double* %5
%10 = fsub double 1.000000e+00, %9
%11 = load double*, double** %6
store double %10, double* %11
%12 = load double, double* %5
%13 = call double @llvm.fmuladd.f64(double 8.000000e-01, double %12, double 1.000000e-01)
%14 = load double*, double** %7
store double %13, double* %14
%15 = load double, double* %5
%16 = fmul double 0x400921FB54442D18, %15
%17 = call double @sin(double %16)
%18 = call double @llvm.fmuladd.f64(double 8.000000e-01, double %17, double 1.000000e-01)
%19 = load double*, double** %8
store double %18, double* %19
ret void
}

LLVM IR (-O2):
define void @GreenRedColRamp(double %0, double* nocapture writeonly %1, double* nocapture writeonly %2, double* nocapture writeonly %3) {
%5 = fsub double 1.000000e+00, %0
store double %5, double* %1
%6 = tail call double @llvm.fmuladd.f64(double %0, double 8.000000e-01, double 1.000000e-01)
store double %6, double* %2
%7 = fmul double %0, 0x400921FB54442D18
%8 = tail call double @sin(double %7)
%9 = tail call double @llvm.fmuladd.f64(double %8, double 8.000000e-01, double 1.000000e-01)
store double %9, double* %3
ret void
}
int test_imm_98uint16_mem(unsigned short *val) {
  return ((*val) & (0x98 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_98uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 152
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
__attribute__((__noreturn__)) void show_help() {
  printf("Usage: fbtest [--fb <dev>] [--solid <color>] [--grab <fname>]\n"
         "       [--bars] [--cross] [--dshade]\n"
         "       [-x <x> -y <y> -setpix <col>]*\n");
  exit(0);
}


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

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

LLVM IR (-O0):
@.str = [138 x i8] c"Usage: fbtest [--fb <dev>] [--solid <color>] [--grab <fname>]\0A [--bars] [--cross] [--dshade]\0A [-x <x> -y <y> -setpix <col>]*\0A\00"
define void @show_help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [137 x i8] c"Usage: fbtest [--fb <dev>] [--solid <color>] [--grab <fname>]\0A [--bars] [--cross] [--dshade]\0A [-x <x> -y <y> -setpix <col>]*\00"
define void @show_help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([137 x i8], [137 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
int execute_olduname() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @execute_olduname() {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ copy_16bit(char *);
int /*<<< orphan*/ swap_16bit(int /*<<< orphan*/);
uint16_t ntoh_16bit(char *ptr) { return swap_16bit(copy_16bit(ptr)); }


x86 assembly (clang, -O0):
<ntoh_16bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <copy_16bit@plt>
mov    %eax,%edi
call   1030 <swap_16bit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ntoh_16bit>:
push   %rax
call   1040 <copy_16bit@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <swap_16bit@plt>

LLVM IR (-O0):
define i32 @ntoh_16bit(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @copy_16bit(i8* %3)
%5 = call i32 @swap_16bit(i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @ntoh_16bit(i8* %0) {
%2 = tail call i32 @copy_16bit(i8* %0)
%3 = tail call i32 @swap_16bit(i32 %2)
ret i32 %3
}
void gpio7_iomux_config() {}


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

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

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

LLVM IR (-O2):
define void @gpio7_iomux_config() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ int8_t;

/* Variables and functions */
int8_t stdlib_ndarray_get_ptr_uint8(const uint8_t *idx, uint8_t *out) {
  *out = *(uint8_t *)idx;
  return 0;
}


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

x86 assembly (clang, -O2):
<stdlib_ndarray_get_ptr_uint8>:
mov    (%rdi),%eax
mov    %eax,(%rsi)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @stdlib_ndarray_get_ptr_uint8(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* %5
%7 = load i32*, i32** %4
store i32 %6, i32* %7
ret i32 0
}

LLVM IR (-O2):
define i32 @stdlib_ndarray_get_ptr_uint8(i32* nocapture %0, i32* nocapture writeonly %1) {
%3 = load i32, i32* %0
store i32 %3, i32* %1
ret i32 0
}
int do_433() { return 433; }


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

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

LLVM IR (-O0):
define i32 @do_433() {
ret i32 433
}

LLVM IR (-O2):
define i32 @do_433() {
ret i32 433
}
/* Type definitions */
typedef int /*<<< orphan*/ XVisibilityEvent;

/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ malloc(int);
void *alloc_XVisibilityEvent(void) {
  XVisibilityEvent *_p = (XVisibilityEvent *)malloc(sizeof(XVisibilityEvent));
  if (_p == NULL)
    abort();
  return (void *)_p;
}


x86 assembly (clang, -O0):
<alloc_XVisibilityEvent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1148 <alloc_XVisibilityEvent+0x28>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_XVisibilityEvent>:
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     1132 <alloc_XVisibilityEvent+0x12>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i8* @alloc_XVisibilityEvent() {
%1 = alloca i32*
%2 = call i64 @malloc(i32 4)
%3 = inttoptr i64 %2 to i32*
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
%9 = load i32*, i32** %1
%10 = bitcast i32* %9 to i8*
ret i8* %10
}

LLVM IR (-O2):
define i8* @alloc_XVisibilityEvent() {
%1 = tail call i64 @malloc(i32 4)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = inttoptr i64 %1 to i8*
ret i8* %6
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
ssize_t lgetxattr(const char *path, const char *name, void *value,
                  size_t size) {
  return (errno = ENOSYS, -1);
}


x86 assembly (clang, -O0):
<lgetxattr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    0x2ecd(%rip),%rax
mov    (%rax),%ecx
mov    0x2eb4(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lgetxattr>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @lgetxattr(i8* %0, i8* %1, i8* %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%9 = load i32, i32* @ENOSYS
store i32 %9, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @lgetxattr(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i64 %3) {
%5 = load i32, i32* @ENOSYS
store i32 %5, i32* @errno
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ test_cria_jogadores();
int main() { test_cria_jogadores(); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_cria_jogadores()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ mp_msg(int, int /*<<< orphan*/, char *);
void flip_page(void) {
  mp_msg(3, 0, "[xvidix] error: didn't used vidix flip_page!\n");
  return;
}


x86 assembly (clang, -O0):
<flip_page>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
xor    %esi,%esi
lea    0xede(%rip),%rdx
call   1030 <mp_msg@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<flip_page>:
lea    0xee9(%rip),%rdx
mov    $0x3,%edi
xor    %esi,%esi
jmp    1030 <mp_msg@plt>

LLVM IR (-O0):
@.str = [46 x i8] c"[xvidix] error: didn't used vidix flip_page!\0A\00"
define void @flip_page() {
%1 = call i32 @mp_msg(i32 3, i32 0, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [46 x i8] c"[xvidix] error: didn't used vidix flip_page!\0A\00"
define void @flip_page() {
%1 = tail call i32 @mp_msg(i32 3, i32 0, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ pixel;
};
typedef TYPE_1__ XColor;

/* Variables and functions */
unsigned long get_XColor_pixel(void *_p) {
  return (unsigned long)((XColor *)_p)->pixel;
}


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

x86 assembly (clang, -O2):
<get_XColor_pixel>:
mov    (%rdi),%rax
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i64 @get_XColor_pixel(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
ret i64 %6
}

LLVM IR (-O2):
define i64 @get_XColor_pixel(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
ret i64 %3
}
void rop3_149_1_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = T & S;
  stk1 = *D ^ stk2;
  stk1 = ~stk1;
  *D = (stk1 & (~S) & (~T)) | (*D & S) | (*D & T);
}


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

x86 assembly (clang, -O2):
<rop3_149_1_1>:
mov    %edx,%eax
and    %sil,%al
mov    (%rdi),%cl
xor    %cl,%al
or     %sil,%dl
or     %dl,%al
not    %al
and    %cl,%dl
or     %al,%dl
mov    %dl,(%rdi)
ret

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

LLVM IR (-O2):
define void @rop3_149_1_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = and i8 %2, %1
%5 = load i8, i8* %0
%6 = xor i8 %5, %4
%7 = or i8 %2, %1
%8 = or i8 %7, %6
%9 = xor i8 %8, -1
%10 = and i8 %5, %7
%11 = or i8 %10, %9
store i8 %11, i8* %0
ret void
}
unsigned rot_amt(unsigned char a[], unsigned n) {
  return (n == 1 ? a[n - 1] % (8 * n) : ((a[n - 2] << 8) | a[n - 1]) % (8 * n));
}


x86 assembly (clang, -O0):
<rot_amt>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    1137 <rot_amt+0x37>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
movzbl (%rax,%rcx,1),%eax
mov    -0xc(%rbp),%ecx
shl    $0x3,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,-0x10(%rbp)
jmp    1169 <rot_amt+0x69>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x2,%ecx
mov    %ecx,%ecx
movzbl (%rax,%rcx,1),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
mov    %edx,%edx
movzbl (%rcx,%rdx,1),%ecx
or     %ecx,%eax
mov    -0xc(%rbp),%ecx
shl    $0x3,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rot_amt>:
cmp    $0x1,%esi
jne    110c <rot_amt+0xc>
movzbl (%rdi),%eax
and    $0x7,%eax
ret
lea    -0x2(%rsi),%eax
movzbl (%rdi,%rax,1),%ecx
shl    $0x8,%ecx
lea    -0x1(%rsi),%eax
movzbl (%rdi,%rax,1),%eax
or     %ecx,%eax
shl    $0x3,%esi
xor    %edx,%edx
div    %esi
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @rot_amt(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %18
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = load i32, i32* %4
%10 = sub i32 %9, 1
%11 = zext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %8, i64 %11
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = load i32, i32* %4
%16 = mul i32 8, %15
%17 = urem i32 %14, %16
br label %38
18: ; preds = %2
%19 = load i8*, i8** %3
%20 = load i32, i32* %4
%21 = sub i32 %20, 2
%22 = zext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %19, i64 %22
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
%26 = shl i32 %25, 8
%27 = load i8*, i8** %3
%28 = load i32, i32* %4
%29 = sub i32 %28, 1
%30 = zext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %27, i64 %30
%32 = load i8, i8* %31
%33 = zext i8 %32 to i32
%34 = or i32 %26, %33
%35 = load i32, i32* %4
%36 = mul i32 8, %35
%37 = urem i32 %34, %36
br label %38
38: ; preds = %18, %7
%39 = phi i32 [ %17, %7 ], [ %37, %18 ]
ret i32 %39
}

LLVM IR (-O2):
define i32 @rot_amt(i8* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i8, i8* %0
%6 = and i8 %5, 7
%7 = zext i8 %6 to i32
br label %23
8: ; preds = %2
%9 = add i32 %1, -2
%10 = zext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = shl nuw nsw i32 %13, 8
%15 = add i32 %1, -1
%16 = zext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %0, i64 %16
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = or i32 %14, %19
%21 = shl i32 %1, 3
%22 = urem i32 %20, %21
br label %23
23: ; preds = %8, %4
%24 = phi i32 [ %7, %4 ], [ %22, %8 ]
ret i32 %24
}
unsigned double_leaf_fn(unsigned value) { return (value); }


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

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

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

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

/* Variables and functions */
uid_t getuid() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @getuid() {
ret i32 0
}
int main(int argc, char **argv) {
  int i = 0;
  typeof(i) j;
  __typeof__(int *) ip;
  typeof(typeof(char *)[4]) y;
  j = 10;
  *ip = j;
  *y[3] = 'a';
  printf("%d\n", *ip);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0xa,-0x18(%rbp)
mov    -0x18(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rax
movb   $0x61,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca [4 x i8*]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 10, i32* %7
%10 = load i32, i32* %7
%11 = load i32*, i32** %8
store i32 %10, i32* %11
%12 = getelementptr inbounds [4 x i8*], [4 x i8*]* %9, i64 0, i64 3
%13 = load i8*, i8** %12
store i8 97, i8* %13
%14 = load i32*, i32** %8
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
ret i32 1
}

LLVM IR (-O2):
int ncluts(unsigned char clm) {
  return ((clm & 1) + ((clm >> 1) & 1) + ((clm >> 2) & 1) + ((clm >> 3) & 1));
}


x86 assembly (clang, -O0):
<ncluts>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0x1,%eax
movzbl -0x1(%rbp),%ecx
sar    $0x1,%ecx
and    $0x1,%ecx
add    %ecx,%eax
movzbl -0x1(%rbp),%ecx
sar    $0x2,%ecx
and    $0x1,%ecx
add    %ecx,%eax
movzbl -0x1(%rbp),%ecx
sar    $0x3,%ecx
and    $0x1,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ncluts>:
mov    %edi,%eax
and    $0x1,%eax
mov    %edi,%ecx
shr    %ecx
and    $0x1,%ecx
add    %eax,%ecx
mov    %edi,%eax
shr    $0x2,%eax
and    $0x1,%eax
add    %ecx,%eax
shr    $0x3,%edi
and    $0x1,%edi
add    %edi,%eax
ret

LLVM IR (-O0):
define i32 @ncluts(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, 1
%6 = load i8, i8* %2
%7 = zext i8 %6 to i32
%8 = ashr i32 %7, 1
%9 = and i32 %8, 1
%10 = add nsw i32 %5, %9
%11 = load i8, i8* %2
%12 = zext i8 %11 to i32
%13 = ashr i32 %12, 2
%14 = and i32 %13, 1
%15 = add nsw i32 %10, %14
%16 = load i8, i8* %2
%17 = zext i8 %16 to i32
%18 = ashr i32 %17, 3
%19 = and i32 %18, 1
%20 = add nsw i32 %15, %19
ret i32 %20
}

LLVM IR (-O2):
define i32 @ncluts(i8 zeroext %0) {
%2 = zext i8 %0 to i32
%3 = and i32 %2, 1
%4 = lshr i32 %2, 1
%5 = and i32 %4, 1
%6 = add nuw nsw i32 %5, %3
%7 = lshr i32 %2, 2
%8 = and i32 %7, 1
%9 = add nuw nsw i32 %6, %8
%10 = lshr i32 %2, 3
%11 = and i32 %10, 1
%12 = add nuw nsw i32 %9, %11
ret i32 %12
}
int is_number(char c) { return c >= '0' && c <= '9'; }


x86 assembly (clang, -O0):
<is_number>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x2(%rbp)
jl     1129 <is_number+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_number>:
add    $0xd0,%dil
xor    %eax,%eax
cmp    $0xa,%dil
setb   %al
ret

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

LLVM IR (-O2):
define i32 @is_number(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int getpid();
int /*<<< orphan*/ printf(char *, int, char);
void consume_item(char item) { printf("Consumed[%d]: %c\n", getpid(), item); }


x86 assembly (clang, -O0):
<consume_item>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
lea    0xec2(%rip),%rdi
movsbl -0x1(%rbp),%edx
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<consume_item>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xecf(%rip),%rdi
mov    %eax,%esi
mov    %ebx,%edx
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"Consumed[%d]: %c\0A\00"
define void @consume_item(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 (...) @getpid()
%4 = load i8, i8* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %3, i8 signext %4)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"Consumed[%d]: %c\0A\00"
define void @consume_item(i8 signext %0) {
%2 = tail call i32 (...) @getpid()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %2, i8 signext %0)
ret void
}