xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ writebit(int);
void writeregisteraddress(uint8_t which) {
  int i;
  for (i = 0; i < 4; i++) {
    writebit((which >> i) & 1);
  }
}


x86 assembly (clang, -O0):
<writeregisteraddress>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    114a <writeregisteraddress+0x3a>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%ecx
sar    %cl,%edi
and    $0x1,%edi
call   1030 <writebit@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <writeregisteraddress+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeregisteraddress>:
push   %rbx
mov    %edi,%ebx
and    $0x1,%edi
call   1030 <writebit@plt>
mov    %ebx,%edi
shr    %edi
and    $0x1,%edi
call   1030 <writebit@plt>
mov    %ebx,%edi
shr    $0x2,%edi
and    $0x1,%edi
call   1030 <writebit@plt>
shr    $0x3,%ebx
and    $0x1,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <writebit@plt>

LLVM IR (-O0):
define void @writeregisteraddress(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %13, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 4
br i1 %6, label %7, label %16
7: ; preds = %4
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = ashr i32 %8, %9
%11 = and i32 %10, 1
%12 = call i32 @writebit(i32 %11)
br label %13
13: ; preds = %7
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
br label %4
16: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @writeregisteraddress(i32 %0) {
%2 = and i32 %0, 1
%3 = tail call i32 @writebit(i32 %2)
%4 = lshr i32 %0, 1
%5 = and i32 %4, 1
%6 = tail call i32 @writebit(i32 %5)
%7 = lshr i32 %0, 2
%8 = and i32 %7, 1
%9 = tail call i32 @writebit(i32 %8)
%10 = lshr i32 %0, 3
%11 = and i32 %10, 1
%12 = tail call i32 @writebit(i32 %11)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *getprogname();
int /*<<< orphan*/ stderr;
void usage(void) {
  (void)fprintf(stderr, "Usage: %s [-d] -s <file>\n", getprogname());
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getprogname@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rdx
lea    0xea8(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    0x2ea8(%rip),%rax
mov    (%rax),%ebx
xor    %eax,%eax
call   1030 <getprogname@plt>
lea    0xeb8(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [26 x i8] c"Usage: %s [-d] -s <file>\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i8* (...) @getprogname()
%3 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [26 x i8] c"Usage: %s [-d] -s <file>\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i8* (...) @getprogname()
%3 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = tail call i32 @exit(i32 1)
unreachable
}
int test_imm_11uint32_mem(unsigned int *val) {
  return ((*val) & (0x11 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_11uint32_mem(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = and i32 %4, 17
%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_11uint32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 17
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
char *strchr(const char *s, int c) {
  while (1) {
    if (*s == (char)c) {
      return (char *)s;
    } else if (*s == '\0') {
      break;
    }
    s++;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x14(%rbp),%ecx
movsbl %cl,%ecx
cmp    %ecx,%eax
jne    112d <strchr+0x2d>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1160 <strchr+0x60>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1142 <strchr+0x42>
jmp    1158 <strchr+0x58>
jmp    1147 <strchr+0x47>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110b <strchr+0xb>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchr>:
mov    %rdi,%rax
movsbl %sil,%ecx
movsbl (%rdi),%edx
cmp    %edx,%ecx
je     1120 <strchr+0x20>
xchg   %ax,%ax
test   %dl,%dl
je     1121 <strchr+0x21>
movsbl 0x1(%rax),%edx
add    $0x1,%rax
cmp    %edx,%ecx
jne    1110 <strchr+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @strchr(i8* %0, i32 %1) {
%3 = shl i32 %1, 24
%4 = ashr exact i32 %3, 24
%5 = load i8, i8* %0
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %4, %6
br i1 %7, label %17, label %8
8: ; preds = %2, %12
%9 = phi i8 [ %14, %12 ], [ %5, %2 ]
%10 = phi i8* [ %13, %12 ], [ %0, %2 ]
%11 = icmp eq i8 %9, 0
br i1 %11, label %17, label %12
12: ; preds = %8
%13 = getelementptr inbounds i8, i8* %10, i64 1
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %4, %15
br i1 %16, label %17, label %8
17: ; preds = %12, %8, %2
%18 = phi i8* [ %0, %2 ], [ null, %8 ], [ %13, %12 ]
ret i8* %18
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ putc(int, int /*<<< orphan*/ *);
void crash_putc() {
  FILE *f;
  f = fopen("this_file_doesnt_exist", "r");
  putc(42, f);
  fclose(f);
}


x86 assembly (clang, -O0):
<crash_putc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xed1(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0x2a,%edi
call   1040 <putc@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crash_putc>:
push   %rbx
lea    0xec8(%rip),%rdi
lea    0xed8(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
mov    $0x2a,%edi
mov    %rax,%rsi
call   1040 <putc@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"this_file_doesnt_exist\00"
@.str.1 = [2 x i8] c"r\00"
define void @crash_putc() {
%1 = alloca i32*
%2 = call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = call i32 @putc(i32 42, i32* %3)
%5 = load i32*, i32** %1
%6 = call i32 @fclose(i32* %5)
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"this_file_doesnt_exist\00"
@.str.1 = [2 x i8] c"r\00"
define void @crash_putc() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @putc(i32 42, i32* %1)
%3 = tail call i32 @fclose(i32* %1)
ret void
}
/* Variables and functions */
int __builtin_btf_type_id(int, int /*<<< orphan*/);
unsigned test1(int a) { return __builtin_btf_type_id(a, 0); }


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

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

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

LLVM IR (-O2):
define i32 @test1(i32 %0) {
%2 = tail call i32 @__builtin_btf_type_id(i32 %0, i32 0)
ret i32 %2
}
/* Variables and functions */
char getchar();
scalar_t__ isspace(int);
int getfirst(void) {
  int ch;
  ch = getchar();
  while (isspace(ch))
    ch = getchar();
  while (getchar() != '\n')
    continue;
  return ch;
}


x86 assembly (clang, -O0):
<getfirst>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <getchar@plt>
movsbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     1159 <getfirst+0x39>
mov    $0x0,%al
call   1040 <getchar@plt>
movsbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1135 <getfirst+0x15>
jmp    115e <getfirst+0x3e>
mov    $0x0,%al
call   1040 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     1176 <getfirst+0x56>
jmp    115e <getfirst+0x3e>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getfirst>:
push   %rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
movsbl %al,%ebx
mov    %ebx,%edi
call   1030 <isspace@plt>
test   %rax,%rax
jne    1130 <getfirst+0x10>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
jne    1150 <getfirst+0x30>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @getfirst() {
%1 = tail call signext i8 (...) @getchar()
%2 = sext i8 %1 to i32
%3 = tail call i64 @isspace(i32 %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %7, %0
%6 = phi i32 [ %2, %0 ], [ %9, %7 ]
br label %12
7: ; preds = %0, %7
%8 = tail call signext i8 (...) @getchar()
%9 = sext i8 %8 to i32
%10 = tail call i64 @isspace(i32 %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %5, label %7
12: ; preds = %5, %12
%13 = tail call signext i8 (...) @getchar()
%14 = icmp eq i8 %13, 10
br i1 %14, label %15, label %12
15: ; preds = %12
ret i32 %6
}
void __dbgui_setup(int sample_count) { (void)(sample_count); }


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

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

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

LLVM IR (-O2):
define void @__dbgui_setup(i32 %0) {
ret void
}
int digit2int(char c) { return c - '0'; }


x86 assembly (clang, -O0):
<digit2int>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
sub    $0x30,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<digit2int>:
lea    -0x30(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @digit2int(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = sub nsw i32 %4, 48
ret i32 %5
}

LLVM IR (-O2):
define i32 @digit2int(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, -48
ret i32 %3
}
unsigned long calc_weighted(unsigned long delta, unsigned long weight,
                            int shift) {
  return delta * weight >> shift;
}


x86 assembly (clang, -O0):
<calc_weighted>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
imul   -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
shr    %cl,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_weighted>:
mov    %edx,%ecx
mov    %rdi,%rax
imul   %rsi,%rax
shr    %cl,%rax
ret

LLVM IR (-O0):
define i64 @calc_weighted(i64 %0, i64 %1, i32 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i32
store i64 %0, i64* %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%7 = load i64, i64* %4
%8 = load i64, i64* %5
%9 = mul i64 %7, %8
%10 = load i32, i32* %6
%11 = zext i32 %10 to i64
%12 = lshr i64 %9, %11
ret i64 %12
}

LLVM IR (-O2):
define i64 @calc_weighted(i64 %0, i64 %1, i32 %2) {
%4 = mul i64 %1, %0
%5 = zext i32 %2 to i64
%6 = lshr i64 %4, %5
ret i64 %6
}
int asic_check(int event) {
  int n = event >> 5;
  unsigned int mask = (1 << (event & 0x1f));
  return ((*((volatile unsigned long *)((0xA05F6000 + 0x900 + (n << 2))))) &
          mask) != 0;
}


x86 assembly (clang, -O0):
<asic_check>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x5,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%ecx
and    $0x1f,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x2,%eax
add    $0xa05f6900,%eax
mov    %eax,%eax
mov    (%rax),%rax
mov    -0xc(%rbp),%ecx
and    %rcx,%rax
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<asic_check>:
mov    %edi,%eax
sar    $0x3,%eax
add    $0xa05f6900,%eax
and    $0xfffffffc,%eax
mov    (%rax),%rcx
xor    %eax,%eax
bt     %edi,%ecx
setb   %al
ret

LLVM IR (-O0):
define i32 @asic_check(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = ashr i32 %5, 5
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = and i32 %7, 31
%9 = shl i32 1, %8
store i32 %9, i32* %4
%10 = load i32, i32* %3
%11 = shl i32 %10, 2
%12 = add i32 -1604359936, %11
%13 = zext i32 %12 to i64
%14 = inttoptr i64 %13 to i64*
%15 = load volatile i64, i64* %14
%16 = load i32, i32* %4
%17 = zext i32 %16 to i64
%18 = and i64 %15, %17
%19 = icmp ne i64 %18, 0
%20 = zext i1 %19 to i32
ret i32 %20
}

LLVM IR (-O2):
define i32 @asic_check(i32 %0) {
%2 = and i32 %0, 31
%3 = shl nuw i32 1, %2
%4 = ashr i32 %0, 3
%5 = add nsw i32 %4, -1604359936
%6 = and i32 %5, -4
%7 = zext i32 %6 to i64
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = zext i32 %3 to i64
%11 = and i64 %9, %10
%12 = icmp ne i64 %11, 0
%13 = zext i1 %12 to i32
ret i32 %13
}
int test_imm_36uint32_mem(unsigned int *val) {
  return ((*val) & (0x36 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_36uint32_mem(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = and i32 %4, 54
%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_36uint32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 54
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int GL_COLOR_BUFFER_BIT;
int GL_DEPTH_BUFFER_BIT;
int /*<<< orphan*/ auxSolidTeapot(double);
int /*<<< orphan*/ glClear(int);
int /*<<< orphan*/ glFlush();
int /*<<< orphan*/ glPopMatrix();
int /*<<< orphan*/ glPushMatrix();
int /*<<< orphan*/ glRotatef(double, double, double, double);
void display(void) {
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glPushMatrix();
  glRotatef(45.0, 0.0, 0.0, 1.0);
  auxSolidTeapot(2.0);
  glPopMatrix();
  glFlush();
}


x86 assembly (clang, -O0):
<display>:
push   %rbp
mov    %rsp,%rbp
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
mov    0x2e74(%rip),%rax
or     (%rax),%edi
call   1030 <glClear@plt>
mov    $0x0,%al
call   1060 <glPushMatrix@plt>
movsd  0xe7e(%rip),%xmm0
xorps  %xmm2,%xmm2
movsd  0xe7b(%rip),%xmm3
movaps %xmm2,%xmm1
call   1080 <glRotatef@plt>
movsd  0xe5b(%rip),%xmm0
call   1070 <auxSolidTeapot@plt>
mov    $0x0,%al
call   1040 <glPopMatrix@plt>
mov    $0x0,%al
call   1050 <glFlush@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<display>:
push   %rax
mov    0x2e70(%rip),%rax
mov    0x2e79(%rip),%rcx
mov    (%rcx),%edi
or     (%rax),%edi
call   1030 <glClear@plt>
xor    %eax,%eax
call   1060 <glPushMatrix@plt>
movsd  0xe79(%rip),%xmm0
movsd  0xe79(%rip),%xmm3
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
call   1080 <glRotatef@plt>
movsd  0xe6e(%rip),%xmm0
call   1070 <auxSolidTeapot@plt>
xor    %eax,%eax
call   1040 <glPopMatrix@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <glFlush@plt>

LLVM IR (-O0):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_DEPTH_BUFFER_BIT = global i32 0
define void @display() {
%1 = load i32, i32* @GL_COLOR_BUFFER_BIT
%2 = load i32, i32* @GL_DEPTH_BUFFER_BIT
%3 = or i32 %1, %2
%4 = call i32 @glClear(i32 %3)
%5 = call i32 (...) @glPushMatrix()
%6 = call i32 @glRotatef(double 4.500000e+01, double 0.000000e+00, double 0.000000e+00, double 1.000000e+00)
%7 = call i32 @auxSolidTeapot(double 2.000000e+00)
%8 = call i32 (...) @glPopMatrix()
%9 = call i32 (...) @glFlush()
ret void
}

LLVM IR (-O2):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_DEPTH_BUFFER_BIT = global i32 0
define void @display() {
%1 = load i32, i32* @GL_COLOR_BUFFER_BIT
%2 = load i32, i32* @GL_DEPTH_BUFFER_BIT
%3 = or i32 %2, %1
%4 = tail call i32 @glClear(i32 %3)
%5 = tail call i32 (...) @glPushMatrix()
%6 = tail call i32 @glRotatef(double 4.500000e+01, double 0.000000e+00, double 0.000000e+00, double 1.000000e+00)
%7 = tail call i32 @auxSolidTeapot(double 2.000000e+00)
%8 = tail call i32 (...) @glPopMatrix()
%9 = tail call i32 (...) @glFlush()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ emit_cmovne_imm(int, int);
int /*<<< orphan*/ emit_mov(int, int);
int /*<<< orphan*/ emit_test(int, int);
void emit_set_nz32(int rs, int rt) {
  if (rs != rt)
    emit_mov(rs, rt);
  emit_test(rs, rs);
  emit_cmovne_imm(1, rt);
}


x86 assembly (clang, -O0):
<emit_set_nz32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
je     1155 <emit_set_nz32+0x25>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <emit_mov@plt>
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1050 <emit_test@plt>
mov    -0x8(%rbp),%esi
mov    $0x1,%edi
call   1040 <emit_cmovne_imm@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_set_nz32>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
cmp    %esi,%edi
je     1144 <emit_set_nz32+0x14>
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <emit_mov@plt>
mov    %ebp,%edi
mov    %ebp,%esi
call   1050 <emit_test@plt>
mov    $0x1,%edi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <emit_cmovne_imm@plt>

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

LLVM IR (-O2):
define void @emit_set_nz32(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, %1
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @emit_mov(i32 %0, i32 %1)
br label %6
6: ; preds = %4, %2
%7 = tail call i32 @emit_test(i32 %0, i32 %0)
%8 = tail call i32 @emit_cmovne_imm(i32 1, i32 %1)
ret void
}
long double __fabsl(long double x) { return __builtin_fabsl(x); }


x86 assembly (clang, -O0):
<__fabsl>:
push   %rbp
mov    %rsp,%rbp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
fabs
pop    %rbp
ret

x86 assembly (clang, -O2):
<__fabsl>:
fldt   0x8(%rsp)
fabs
ret

LLVM IR (-O0):
define x86_fp80 @__fabsl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = call x86_fp80 @llvm.fabs.f80(x86_fp80 %3)
ret x86_fp80 %4
}

LLVM IR (-O2):
define x86_fp80 @__fabsl(x86_fp80 %0) {
%2 = tail call x86_fp80 @llvm.fabs.f80(x86_fp80 %0)
ret x86_fp80 %2
}
/* Variables and functions */
int /*<<< orphan*/ cblas_zdotc_sub(int const, void const *, int const,
                                   void const *, int const, void *);
void acc_zdotc_sub_(const int *N, const void *X, const int *incX, const void *Y,
                    const int *incY, void *dotc) {
  cblas_zdotc_sub(*N, X, *incX, Y, *incY, dotc);
}


x86 assembly (clang, -O0):
<acc_zdotc_sub_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    (%rax),%r8d
mov    -0x30(%rbp),%r9
call   1030 <cblas_zdotc_sub@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<acc_zdotc_sub_>:
mov    (%rdi),%edi
mov    (%rdx),%edx
mov    (%r8),%r8d
jmp    1030 <cblas_zdotc_sub@plt>

LLVM IR (-O0):
define void @acc_zdotc_sub_(i32* %0, i8* %1, i32* %2, i8* %3, i32* %4, i8* %5) {
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i8*
%11 = alloca i32*
%12 = alloca i8*
store i32* %0, i32** %7
store i8* %1, i8** %8
store i32* %2, i32** %9
store i8* %3, i8** %10
store i32* %4, i32** %11
store i8* %5, i8** %12
%13 = load i32*, i32** %7
%14 = load i32, i32* %13
%15 = load i8*, i8** %8
%16 = load i32*, i32** %9
%17 = load i32, i32* %16
%18 = load i8*, i8** %10
%19 = load i32*, i32** %11
%20 = load i32, i32* %19
%21 = load i8*, i8** %12
%22 = call i32 @cblas_zdotc_sub(i32 %14, i8* %15, i32 %17, i8* %18, i32 %20, i8* %21)
ret void
}

LLVM IR (-O2):
define void @acc_zdotc_sub_(i32* nocapture %0, i8* %1, i32* nocapture %2, i8* %3, i32* nocapture %4, i8* %5) {
%7 = load i32, i32* %0
%8 = load i32, i32* %2
%9 = load i32, i32* %4
%10 = tail call i32 @cblas_zdotc_sub(i32 %7, i8* %1, i32 %8, i8* %3, i32 %9, i8* %5)
ret void
}
/* Type definitions */
struct pager {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ pager_show_page(struct pager *, int);
void pager_down(struct pager *p) { pager_show_page(p, 1); }


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

x86 assembly (clang, -O2):
<pager_down>:
mov    $0x1,%esi
jmp    1030 <pager_show_page@plt>

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

LLVM IR (-O2):
%struct.pager = type { i32 }
define void @pager_down(%struct.pager* %0) {
%2 = tail call i32 @pager_show_page(%struct.pager* %0, i32 1)
ret void
}
unsigned xrop3_108_1_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  stk2 = D & T;
  stk1 = S ^ stk2;
  return (stk1 & (~S) & (~T)) | (D & S) | (D & T);
}


x86 assembly (clang, -O0):
<xrop3_108_1_1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
and    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x10(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0x10(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @xrop3_108_1_1(i8 zeroext %0, i8 zeroext %1) {
%3 = or i8 %1, %0
%4 = zext i8 %3 to i32
ret i32 %4
}
/* Variables and functions */
int read(int, char *, int);
int ax_web_socket_read(int socket_fd, char *buffer, int expectlen) {
  return read(socket_fd, buffer, expectlen);
}


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

x86 assembly (clang, -O2):
<ax_web_socket_read>:
jmp    1030 <read@plt>

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

LLVM IR (-O2):
define i32 @ax_web_socket_read(i32 %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @read(i32 %0, i8* %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ ta_oom_b(int /*<<< orphan*/);
char *ta_strndup(void *, char const *, size_t);
char *ta_xstrndup(void *ta_parent, const char *str, size_t n) {
  char *res = ta_strndup(ta_parent, str, n);
  ta_oom_b(res || !str);
  return res;
}


x86 assembly (clang, -O0):
<ta_xstrndup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <ta_strndup@plt>
mov    %rax,-0x20(%rbp)
mov    $0x1,%al
cmpq   $0x0,-0x20(%rbp)
mov    %al,-0x21(%rbp)
jne    1166 <ta_xstrndup+0x46>
cmpq   $0x0,-0x10(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <ta_oom_b@plt>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ta_xstrndup>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
call   1030 <ta_strndup@plt>
mov    %rax,%r14
test   %rax,%rax
setne  %al
test   %rbx,%rbx
sete   %cl
or     %al,%cl
movzbl %cl,%edi
call   1040 <ta_oom_b@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @ta_xstrndup(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = call i8* @ta_strndup(i8* %8, i8* %9, i64 %10)
store i8* %11, i8** %7
%12 = load i8*, i8** %7
%13 = icmp ne i8* %12, null
br i1 %13, label %18, label %14
14: ; preds = %3
%15 = load i8*, i8** %5
%16 = icmp ne i8* %15, null
%17 = xor i1 %16, true
br label %18
18: ; preds = %14, %3
%19 = phi i1 [ true, %3 ], [ %17, %14 ]
%20 = zext i1 %19 to i32
%21 = call i32 @ta_oom_b(i32 %20)
%22 = load i8*, i8** %7
ret i8* %22
}

LLVM IR (-O2):
define i8* @ta_xstrndup(i8* %0, i8* %1, i64 %2) {
%4 = tail call i8* @ta_strndup(i8* %0, i8* %1, i64 %2)
%5 = icmp ne i8* %4, null
%6 = icmp eq i8* %1, null
%7 = or i1 %6, %5
%8 = zext i1 %7 to i32
%9 = tail call i32 @ta_oom_b(i32 %8)
ret i8* %4
}
void pthread_rwlock_rdlock() {}


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

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

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

LLVM IR (-O2):
define void @pthread_rwlock_rdlock() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ inputfloat(char *);
int /*<<< orphan*/ visualizza(int /*<<< orphan*/, int /*<<< orphan*/);
int main() {
  visualizza(inputfloat("inserisci il primo numero"),
             inputfloat("inserisci il secondo numero"));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <inputfloat@plt>
mov    %eax,-0x4(%rbp)
lea    0xedc(%rip),%rdi
call   1030 <inputfloat@plt>
mov    -0x4(%rbp),%edi
mov    %eax,%esi
call   1040 <visualizza@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rdi
call   1030 <inputfloat@plt>
mov    %eax,%ebx
lea    0xee4(%rip),%rdi
call   1030 <inputfloat@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1040 <visualizza@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"inserisci il primo numero\00"
@.str.1 = [28 x i8] c"inserisci il secondo numero\00"
define i32 @main() {
%1 = call i32 @inputfloat(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @inputfloat(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @visualizza(i32 %1, i32 %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"inserisci il primo numero\00"
@.str.1 = [28 x i8] c"inserisci il secondo numero\00"
define i32 @main() {
%1 = tail call i32 @inputfloat(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @inputfloat(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @visualizza(i32 %1, i32 %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void lfs2_free(void *p) { free(p); }


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

x86 assembly (clang, -O2):
<lfs2_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @lfs2_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
int execute_geteuid() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @execute_geteuid() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ showMenu();
int main() {
  showMenu();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @showMenu()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int /*<<< orphan*/ __send_to_ppe(int, int, int /*<<< orphan*/ *);
mode_t umask(mode_t mask) { return __send_to_ppe(0x2101, 62, &mask); }


x86 assembly (clang, -O0):
<umask>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x2101,%edi
mov    $0x3e,%esi
lea    -0x4(%rbp),%rdx
call   1030 <__send_to_ppe@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<umask>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rdx
mov    $0x2101,%edi
mov    $0x3e,%esi
call   1030 <__send_to_ppe@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @umask(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @__send_to_ppe(i32 8449, i32 62, i32* %2)
ret i32 %3
}

LLVM IR (-O2):
define i32 @umask(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @__send_to_ppe(i32 8449, i32 62, i32* %2)
ret i32 %3
}
int test_imm_FFuint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0xFF << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_FFuint64_highword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
shr    $0x20,%rdx
and    $0xff,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_FFuint64_highword_mem>:
cmpb   $0x0,0x4(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_FFuint64_highword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 32
%6 = and i64 %5, 255
%7 = icmp ne i64 %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_FFuint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 1095216660480
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
char *copystring(char const *);
int /*<<< orphan*/ free(char *);
char *replacestring(char *dest, const char *src) {
  if (!src)
    return 0;
  if (dest)
    free(dest);
  dest = copystring(src);
  return dest;
}


x86 assembly (clang, -O0):
<replacestring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1148 <replacestring+0x28>
movq   $0x0,-0x8(%rbp)
jmp    1171 <replacestring+0x51>
cmpq   $0x0,-0x10(%rbp)
je     115c <replacestring+0x3c>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1040 <copystring@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<replacestring>:
test   %rsi,%rsi
je     113c <replacestring+0x1c>
push   %rbx
mov    %rsi,%rbx
test   %rdi,%rdi
je     1133 <replacestring+0x13>
call   1030 <free@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <copystring@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @replacestring(i8* %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = icmp eq i8* %0, null
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = tail call i32 @free(i8* %0)
br label %8
8: ; preds = %6, %4
%9 = tail call i8* @copystring(i8* %1)
br label %10
10: ; preds = %2, %8
%11 = phi i8* [ %9, %8 ], [ null, %2 ]
ret i8* %11
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *malloc(size_t);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
int /*<<< orphan*/ stderr;
void *malloc_safe(size_t s) {
  void *p = malloc(s);
  if (p == NULL) {
    fprintf(stderr, "Insufficient Memory.\n");
    exit(1);
  }
  memset(p, 0, s);
  return p;
}


x86 assembly (clang, -O0):
<malloc_safe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1183 <malloc_safe+0x43>
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
lea    0xe8c(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<malloc_safe>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <malloc@plt>
test   %rax,%rax
je     116c <malloc_safe+0x2c>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1030 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
lea    0xe84(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [22 x i8] c"Insufficient Memory.\0A\00"
define i8* @malloc_safe(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %1
%13 = load i8*, i8** %3
%14 = load i64, i64* %2
%15 = call i32 @memset(i8* %13, i32 0, i64 %14)
%16 = load i8*, i8** %3
ret i8* %16
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [22 x i8] c"Insufficient Memory.\0A\00"
define i8* @malloc_safe(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1
%9 = tail call i32 @memset(i8* %2, i32 0, i64 %0)
ret i8* %2
}
int cro_AvgBits(int n1, int n2, int n3, int n4, int bitShifts) {
  int byte1 = (n1 >> bitShifts) & 0xff;
  int byte2 = (n2 >> bitShifts) & 0xff;
  int byte3 = (n3 >> bitShifts) & 0xff;
  int byte4 = (n4 >> bitShifts) & 0xff;
  return (byte1 + byte2 + byte3 + byte4) >> 2;
}


x86 assembly (clang, -O0):
<cro_AvgBits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x14(%rbp),%ecx
sar    %cl,%eax
and    $0xff,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x14(%rbp),%ecx
sar    %cl,%eax
and    $0xff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
sar    %cl,%eax
and    $0xff,%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x14(%rbp),%ecx
sar    %cl,%eax
and    $0xff,%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
add    -0x24(%rbp),%eax
sar    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cro_AvgBits>:
mov    %ecx,%eax
mov    %r8d,%ecx
sar    %cl,%edi
movzbl %dil,%edi
sar    %cl,%esi
movzbl %sil,%esi
add    %edi,%esi
sar    %cl,%edx
movzbl %dl,%edx
sar    %cl,%eax
add    %esi,%edx
movzbl %al,%eax
add    %edx,%eax
shr    $0x2,%eax
ret

LLVM IR (-O0):
define i32 @cro_AvgBits(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%15 = load i32, i32* %6
%16 = load i32, i32* %10
%17 = ashr i32 %15, %16
%18 = and i32 %17, 255
store i32 %18, i32* %11
%19 = load i32, i32* %7
%20 = load i32, i32* %10
%21 = ashr i32 %19, %20
%22 = and i32 %21, 255
store i32 %22, i32* %12
%23 = load i32, i32* %8
%24 = load i32, i32* %10
%25 = ashr i32 %23, %24
%26 = and i32 %25, 255
store i32 %26, i32* %13
%27 = load i32, i32* %9
%28 = load i32, i32* %10
%29 = ashr i32 %27, %28
%30 = and i32 %29, 255
store i32 %30, i32* %14
%31 = load i32, i32* %11
%32 = load i32, i32* %12
%33 = add nsw i32 %31, %32
%34 = load i32, i32* %13
%35 = add nsw i32 %33, %34
%36 = load i32, i32* %14
%37 = add nsw i32 %35, %36
%38 = ashr i32 %37, 2
ret i32 %38
}

LLVM IR (-O2):
define i32 @cro_AvgBits(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = ashr i32 %0, %4
%7 = and i32 %6, 255
%8 = ashr i32 %1, %4
%9 = and i32 %8, 255
%10 = ashr i32 %2, %4
%11 = and i32 %10, 255
%12 = ashr i32 %3, %4
%13 = and i32 %12, 255
%14 = add nuw nsw i32 %7, %9
%15 = add nuw nsw i32 %14, %11
%16 = add nuw nsw i32 %15, %13
%17 = lshr i32 %16, 2
ret i32 %17
}
/* Variables and functions */
int _execute_ret(char *, int, char const *);
int execute_ret_url_encoded(char *msg, int msg_len, const char *cmd) {
  return _execute_ret(msg, msg_len, cmd);
}


x86 assembly (clang, -O0):
<execute_ret_url_encoded>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <_execute_ret@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<execute_ret_url_encoded>:
jmp    1030 <_execute_ret@plt>

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

LLVM IR (-O2):
define i32 @execute_ret_url_encoded(i8* %0, i32 %1, i8* %2) {
%4 = tail call i32 @_execute_ret(i8* %0, i32 %1, i8* %2)
ret i32 %4
}
void hashTable() {}


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

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

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

LLVM IR (-O2):
define void @hashTable() {
ret void
}
long long foo(int *b, int *c) {
  long long tmp = (long long)*b * *c;
  return 10 + tmp;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq (%rax),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
imul   %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0xa,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
movslq (%rdi),%rcx
movslq (%rsi),%rax
imul   %rcx,%rax
add    $0xa,%rax
ret

LLVM IR (-O0):
define i64 @foo(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i64
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %3
%7 = load i32, i32* %6
%8 = sext i32 %7 to i64
%9 = load i32*, i32** %4
%10 = load i32, i32* %9
%11 = sext i32 %10 to i64
%12 = mul nsw i64 %8, %11
store i64 %12, i64* %5
%13 = load i64, i64* %5
%14 = add nsw i64 10, %13
ret i64 %14
}

LLVM IR (-O2):
define i64 @foo(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = sext i32 %3 to i64
%5 = load i32, i32* %1
%6 = sext i32 %5 to i64
%7 = mul nsw i64 %6, %4
%8 = add nsw i64 %7, 10
ret i64 %8
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
int *malloc(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ reverse_bytes(int *);
int main() {
  int *x = malloc(1 * sizeof(int));
  *x = 1;
  char *y = (char *)x;
  printf("%d\n", y[0]);
  free(x);
  int z = 256;
  reverse_bytes(&z);
  printf("%d\n", z);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%esi
lea    0xe8a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
movl   $0x100,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
call   1060 <reverse_bytes@plt>
mov    -0x14(%rbp),%esi
lea    0xe62(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
movl   $0x1,(%rax)
lea    0xea2(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
movl   $0x100,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1060 <reverse_bytes@plt>
mov    0x4(%rsp),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32*
%2 = alloca i8*
%3 = alloca i32
%4 = call i32* @malloc(i32 4)
store i32* %4, i32** %1
%5 = load i32*, i32** %1
store i32 1, i32* %5
%6 = load i32*, i32** %1
%7 = bitcast i32* %6 to i8*
store i8* %7, i8** %2
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 0
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i32*, i32** %1
%14 = call i32 @free(i32* %13)
store i32 256, i32* %3
%15 = call i32 @reverse_bytes(i32* %3)
%16 = load i32, i32* %3
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = tail call i32* @malloc(i32 4)
store i32 1, i32* %2
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = tail call i32 @free(i32* %2)
%5 = bitcast i32* %1 to i8*
store i32 256, i32* %1
%6 = call i32 @reverse_bytes(i32* %1)
%7 = load i32, i32* %1
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}
void fun_v_in_so() { return; }


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

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

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

LLVM IR (-O2):
define void @fun_v_in_so() {
ret void
}