xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ cmd_8042(int);
char read_8042_cmd_byte();
int /*<<< orphan*/ write_8042_cmd_byte(char);
void enable_mouse(void) {
  char b;
  b = read_8042_cmd_byte();
  b = (b & 0b11011111);
  b = (b | 0b10);
  write_8042_cmd_byte(b);
  cmd_8042(0xA8);
}


x86 assembly (clang, -O0):
<enable_mouse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <read_8042_cmd_byte@plt>
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
and    $0xdf,%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
or     $0x2,%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1040 <write_8042_cmd_byte@plt>
mov    $0xa8,%edi
call   1030 <cmd_8042@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<enable_mouse>:
push   %rax
xor    %eax,%eax
call   1050 <read_8042_cmd_byte@plt>
and    $0xdd,%al
or     $0x2,%al
movsbl %al,%edi
call   1040 <write_8042_cmd_byte@plt>
mov    $0xa8,%edi
pop    %rax
jmp    1030 <cmd_8042@plt>

LLVM IR (-O0):
define void @enable_mouse() {
%1 = alloca i8
%2 = call signext i8 (...) @read_8042_cmd_byte()
store i8 %2, i8* %1
%3 = load i8, i8* %1
%4 = sext i8 %3 to i32
%5 = and i32 %4, 223
%6 = trunc i32 %5 to i8
store i8 %6, i8* %1
%7 = load i8, i8* %1
%8 = sext i8 %7 to i32
%9 = or i32 %8, 2
%10 = trunc i32 %9 to i8
store i8 %10, i8* %1
%11 = load i8, i8* %1
%12 = call i32 @write_8042_cmd_byte(i8 signext %11)
%13 = call i32 @cmd_8042(i32 168)
ret void
}

LLVM IR (-O2):
define void @enable_mouse() {
%1 = tail call signext i8 (...) @read_8042_cmd_byte()
%2 = and i8 %1, -35
%3 = or i8 %2, 2
%4 = tail call i32 @write_8042_cmd_byte(i8 signext %3)
%5 = tail call i32 @cmd_8042(i32 168)
ret void
}
/* Variables and functions */
int f90(int *);
int f91(int *p) { return f90(p); }


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

x86 assembly (clang, -O2):
<f91>:
jmp    1030 <f90@plt>

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

LLVM IR (-O2):
define i32 @f91(i32* %0) {
%2 = tail call i32 @f90(i32* %0)
ret i32 %2
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ colormap;
};
typedef TYPE_1__ XSetWindowAttributes;

/* Variables and functions */
unsigned long get_XSetWindowAttributes_colormap(void *_p) {
  return (unsigned long)((XSetWindowAttributes *)_p)->colormap;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i64 @get_XSetWindowAttributes_colormap(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_XSetWindowAttributes_colormap(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
ret i64 %3
}
int emac2_etherstatspkts512to1023octets_set(
    unsigned int dev_id, union emac2_etherstatspkts512to1023octets_u *value) {
  return 1;
}


x86 assembly (clang, -O0):
<emac2_etherstatspkts512to1023octets_set>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
%union.emac2_etherstatspkts512to1023octets_u = type opaque
define i32 @emac2_etherstatspkts512to1023octets_set(i32 %0, %union.emac2_etherstatspkts512to1023octets_u* nocapture readnone %1) {
ret i32 1
}
/* Type definitions */
struct can_frame {
  int dummy;
};

/* Variables and functions */
scalar_t__ cs(struct can_frame);
int is_upload_segment_response(struct can_frame frame) {
  return cs(frame) == 0;
}


x86 assembly (clang, -O0):
<is_upload_segment_response>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <cs@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.can_frame = type { i32 }
define i32 @is_upload_segment_response(i32 %0) {
%2 = alloca %struct.can_frame
%3 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %2, i32 0, i32 0
store i32 %0, i32* %3
%4 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %2, i32 0, i32 0
%5 = load i32, i32* %4
%6 = call i64 @cs(i32 %5)
%7 = icmp eq i64 %6, 0
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @is_upload_segment_response(i32 %0) {
%2 = tail call i64 @cs(i32 %0)
%3 = icmp eq i64 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
int IsTagBmc(char *dstr, int dlen) { return (1); }


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

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

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

LLVM IR (-O2):
define i32 @IsTagBmc(i8* nocapture readnone %0, i32 %1) {
ret i32 1
}
int test_case2() {
  int a = 3;
  switch (a) {
  case 0:
    return -1;
  case 1:
  case 2:
  case 3:
    return 0;
  default:
    return 1;
  }
}


x86 assembly (clang, -O0):
<test_case2>:
push   %rbp
mov    %rsp,%rbp
movl   $0x3,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     1132 <test_case2+0x32>
jmp    111e <test_case2+0x1e>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
sub    $0x3,%eax
jb     113e <test_case2+0x3e>
jmp    114a <test_case2+0x4a>
movl   $0xffffffff,-0x4(%rbp)
jmp    1151 <test_case2+0x51>
movl   $0x0,-0x4(%rbp)
jmp    1151 <test_case2+0x51>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_case2() {
%1 = alloca i32
%2 = alloca i32
store i32 3, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %6 [
i32 0, label %4
i32 1, label %5
i32 2, label %5
i32 3, label %5
]
4: ; preds = %0
store i32 -1, i32* %1
br label %7
5: ; preds = %0, %0, %0
store i32 0, i32* %1
br label %7
6: ; preds = %0
store i32 1, i32* %1
br label %7
7: ; preds = %6, %5, %4
%8 = load i32, i32* %1
ret i32 %8
}

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

/* Variables and functions */
int /*<<< orphan*/ EACCES;
int /*<<< orphan*/ errno;
int mkfifo(const char *path, mode_t mode) {
  errno = EACCES;
  return -1;
}


x86 assembly (clang, -O0):
<mkfifo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2ed6(%rip),%rax
mov    (%rax),%ecx
mov    0x2ebd(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@EACCES = global i32 0
@errno = global i32 0
define i32 @mkfifo(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @EACCES
store i32 %5, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@EACCES = global i32 0
@errno = global i32 0
define i32 @mkfifo(i8* nocapture readnone %0, i32 %1) {
%3 = load i32, i32* @EACCES
store i32 %3, i32* @errno
ret i32 -1
}
char pfCharToUpper(char c) {
  return (char)(((c >= 'a') && (c <= 'z')) ? (c - ('a' - 'A')) : c);
}


x86 assembly (clang, -O0):
<pfCharToUpper>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x61,%eax
jl     1133 <pfCharToUpper+0x33>
movsbl -0x1(%rbp),%eax
cmp    $0x7a,%eax
jg     1133 <pfCharToUpper+0x33>
movsbl -0x1(%rbp),%eax
sub    $0x20,%eax
mov    %eax,-0x8(%rbp)
jmp    113a <pfCharToUpper+0x3a>
movsbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pfCharToUpper>:
lea    -0x61(%rdi),%eax
lea    -0x20(%rdi),%ecx
cmp    $0x1a,%al
movzbl %cl,%eax
cmovae %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @pfCharToUpper(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, 97
br i1 %5, label %6, label %14
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 122
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = sub nsw i32 %12, 32
br label %17
14: ; preds = %6, %1
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
br label %17
17: ; preds = %14, %10
%18 = phi i32 [ %13, %10 ], [ %16, %14 ]
%19 = trunc i32 %18 to i8
ret i8 %19
}

LLVM IR (-O2):
define signext i8 @pfCharToUpper(i8 signext %0) {
%2 = add i8 %0, -97
%3 = icmp ult i8 %2, 26
%4 = add i8 %0, -32
%5 = select i1 %3, i8 %4, i8 %0
ret i8 %5
}
regx0adr1_set(r0, r1, x0, x1, p0, p1) float r0, r1;
float *p0, *p1;
{ (p0[x0]) = (*((float *)11111111)); }


x86 assembly (clang, -O0):
<regx0adr1_set>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm1,-0x30(%rbp)
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
cvtsd2ss %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm0
movss  %xmm1,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    $0xa98ac7,%eax
movss  (%rax),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x10(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<regx0adr1_set>:
movss  0xa98ac7,%xmm0
movslq %edi,%rax
movss  %xmm0,(%rdx,%rax,4)
ret

LLVM IR (-O0):
define i32 @regx0adr1_set(double %0, double %1, i32 %2, i32 %3, float* %4, float* %5) {
%7 = alloca i32
%8 = alloca float
%9 = alloca float
%10 = alloca i32
%11 = alloca i32
%12 = alloca float*
%13 = alloca float*
%14 = fptrunc double %0 to float
%15 = fptrunc double %1 to float
store float %14, float* %8
store float %15, float* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store float* %4, float** %12
store float* %5, float** %13
%16 = load float, float* inttoptr (i64 11111111 to float*)
%17 = load float*, float** %12
%18 = load i32, i32* %10
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds float, float* %17, i64 %19
store float %16, float* %20
%21 = load i32, i32* %7
ret i32 %21
}

LLVM IR (-O2):
define i32 @regx0adr1_set(double %0, double %1, i32 %2, i32 %3, float* nocapture writeonly %4, float* nocapture readnone %5) {
%7 = load float, float* inttoptr (i64 11111111 to float*)
%8 = sext i32 %2 to i64
%9 = getelementptr inbounds float, float* %4, i64 %8
store float %7, float* %9
ret i32 undef
}
/* Variables and functions */
int start(int, char **);
int main(int argc, char *argv[]) { return start(argc, argv); }


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    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <start@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
jmp    1030 <start@plt>

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @start(i32 %0, i8** %1)
ret i32 %3
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int rndu32();
uint32_t rndu32_ranged(uint32_t range) {
  uint32_t max, r;
  r = rndu32();
  if (range == 0) {
    return r;
  }
  max = -(((uint32_t)-range) % range);
  if (max) {
    while (r >= max) {
      r = rndu32();
    }
  }
  return r % range;
}


x86 assembly (clang, -O0):
<rndu32_ranged>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rndu32@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    113a <rndu32_ranged+0x2a>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1183 <rndu32_ranged+0x73>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
cltd
idivl  -0x8(%rbp)
xor    %eax,%eax
sub    %edx,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1179 <rndu32_ranged+0x69>
jmp    1159 <rndu32_ranged+0x49>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     1174 <rndu32_ranged+0x64>
mov    $0x0,%al
call   1030 <rndu32@plt>
mov    %eax,-0x10(%rbp)
jmp    1159 <rndu32_ranged+0x49>
jmp    1179 <rndu32_ranged+0x69>
mov    -0x10(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rndu32_ranged>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rndu32@plt>
test   %ebx,%ebx
je     1123 <rndu32_ranged+0x13>
cltd
idiv   %ebx
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @rndu32_ranged(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
%6 = call i32 (...) @rndu32()
store i32 %6, i32* %5
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i32, i32* %5
store i32 %10, i32* %2
br label %31
11: ; preds = %1
%12 = load i32, i32* %3
%13 = sub nsw i32 0, %12
%14 = load i32, i32* %3
%15 = srem i32 %13, %14
%16 = sub nsw i32 0, %15
store i32 %16, i32* %4
%17 = load i32, i32* %4
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %27
19: ; preds = %11
br label %20
20: ; preds = %24, %19
%21 = load i32, i32* %5
%22 = load i32, i32* %4
%23 = icmp sge i32 %21, %22
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = call i32 (...) @rndu32()
store i32 %25, i32* %5
br label %20
26: ; preds = %20
br label %27
27: ; preds = %26, %11
%28 = load i32, i32* %5
%29 = load i32, i32* %3
%30 = srem i32 %28, %29
store i32 %30, i32* %2
br label %31
31: ; preds = %27, %9
%32 = load i32, i32* %2
ret i32 %32
}

LLVM IR (-O2):
define i32 @rndu32_ranged(i32 %0) {
%2 = tail call i32 (...) @rndu32()
%3 = icmp eq i32 %0, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = srem i32 %2, %0
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ %2, %1 ]
ret i32 %7
}
int test_imm_CEuint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0xCE << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_CEuint64_highword_reg>:
movabs $0xce00000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_CEuint64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 32
%5 = and i64 %4, 206
%6 = icmp ne i64 %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_CEuint64_highword_reg(i64 %0) {
%2 = and i64 %0, 884763262976
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void __DELETE_java_util_Dictionary(void *me, void *client_data) {}


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

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

LLVM IR (-O0):
define void @__DELETE_java_util_Dictionary(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
ret void
}

LLVM IR (-O2):
define void @__DELETE_java_util_Dictionary(i8* nocapture %0, i8* nocapture %1) {
ret void
}
void pcp_def_net_etcp_metrics(void) {}


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

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

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

LLVM IR (-O2):
define void @pcp_def_net_etcp_metrics() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void putstring(char s[]) { fputs(s, stdout); }


x86 assembly (clang, -O0):
<putstring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eb9(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putstring>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
jmp    1030 <fputs@plt>

LLVM IR (-O0):
@stdout = global i32 0
define void @putstring(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @stdout
%5 = call i32 @fputs(i8* %3, i32 %4)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
define void @putstring(i8* %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @fputs(i8* %0, i32 %2)
ret void
}
unsigned long strLen(char *str, unsigned long maxLength) {
  unsigned long i;
  for (i = 0; i < maxLength && str[i] != '\0'; i++) {
    ;
  }
  return i;
}


x86 assembly (clang, -O0):
<strLen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
xor    %eax,%eax
cmp    -0x10(%rbp),%rcx
mov    %al,-0x19(%rbp)
jae    113c <strLen+0x3c>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    114c <strLen+0x4c>
jmp    1162 <strLen+0x62>
jmp    1151 <strLen+0x51>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1114 <strLen+0x14>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strLen>:
xor    %eax,%eax
test   %rsi,%rsi
je     1122 <strLen+0x22>
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,(%rdi,%rax,1)
je     1122 <strLen+0x22>
add    $0x1,%rax
cmp    %rax,%rsi
jne    1110 <strLen+0x10>
mov    %rsi,%rax
ret

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

LLVM IR (-O2):
define i64 @strLen(i8* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %12, label %4
4: ; preds = %2, %9
%5 = phi i64 [ %10, %9 ], [ 0, %2 ]
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %4
%10 = add nuw i64 %5, 1
%11 = icmp eq i64 %10, %1
br i1 %11, label %12, label %4
12: ; preds = %4, %9, %2
%13 = phi i64 [ 0, %2 ], [ %1, %9 ], [ %5, %4 ]
ret i64 %13
}
/* Variables and functions */
int tcpDelayCtl(char *, int, int);
int enableTcpNoDelay(char *err, int fd) { return tcpDelayCtl(err, fd, 1); }


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

x86 assembly (clang, -O2):
<enableTcpNoDelay>:
mov    $0x1,%edx
jmp    1030 <tcpDelayCtl@plt>

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

LLVM IR (-O2):
define i32 @enableTcpNoDelay(i8* %0, i32 %1) {
%3 = tail call i32 @tcpDelayCtl(i8* %0, i32 %1, i32 1)
ret i32 %3
}
/* Variables and functions */
int AddTwo(int);
int main() {
  int x = 3;
  x = AddTwo(x);
  return x;
}


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

x86 assembly (clang, -O2):
<main>:
mov    $0x3,%edi
jmp    1030 <AddTwo@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @AddTwo(i32 3)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
int parse_encoding2(char *);
int parse_encoding(char *encoding) {
  int retval = parse_encoding2(encoding);
  free(encoding);
  return retval;
}


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

x86 assembly (clang, -O2):
<parse_encoding>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <parse_encoding2@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @parse_encoding(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @parse_encoding2(i8* %4)
store i32 %5, i32* %3
%6 = load i8*, i8** %2
%7 = call i32 @free(i8* %6)
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
define i32 @parse_encoding(i8* %0) {
%2 = tail call i32 @parse_encoding2(i8* %0)
%3 = tail call i32 @free(i8* %0)
ret i32 %2
}
int main(int argc, const char **argv) { return argc; }


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

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

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

LLVM IR (-O2):
define i32 @main(i32 returned %0, i8** nocapture readnone %1) {
ret i32 %0
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;
typedef int /*<<< orphan*/ gid_t;

/* Variables and functions */
gid_t getgid(void) { return (uid_t)1; }


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

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

LLVM IR (-O0):
define i32 @getgid() {
ret i32 1
}

LLVM IR (-O2):
define i32 @getgid() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ output(int, int /*<<< orphan*/);
void left_stop() {
  output(4, 0);
  output(18, 0);
}


x86 assembly (clang, -O0):
<left_stop>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4,%edi
xor    %esi,%esi
call   1030 <output@plt>
mov    $0x12,%edi
xor    %esi,%esi
call   1030 <output@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<left_stop>:
push   %rax
mov    $0x4,%edi
xor    %esi,%esi
call   1030 <output@plt>
mov    $0x12,%edi
xor    %esi,%esi
pop    %rax
jmp    1030 <output@plt>

LLVM IR (-O0):
define void @left_stop() {
%1 = call i32 @output(i32 4, i32 0)
%2 = call i32 @output(i32 18, i32 0)
ret void
}

LLVM IR (-O2):
define void @left_stop() {
%1 = tail call i32 @output(i32 4, i32 0)
%2 = tail call i32 @output(i32 18, i32 0)
ret void
}
/* Variables and functions */
char makeAttr(char, char);
void clear(char bg) {
  bg = makeAttr(bg, bg);
  char *p_video_mem = (char *)0xB8000;
  unsigned int offset = 0;
  while (offset < 80 * 25 * 2) {
    *p_video_mem = ' ';
    *p_video_mem = bg;
    p_video_mem++;
    offset++;
  }
}


x86 assembly (clang, -O0):
<clear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
movsbl %al,%edi
movsbl -0x1(%rbp),%esi
call   1030 <makeAttr@plt>
mov    %al,-0x1(%rbp)
mov    $0xb8000,%eax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xfa0,-0x14(%rbp)
jae    1177 <clear+0x67>
mov    -0x10(%rbp),%rax
movb   $0x20,(%rax)
mov    -0x1(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1140 <clear+0x30>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear>:
push   %rax
mov    %edi,%esi
call   1030 <makeAttr@plt>
movzbl %al,%esi
mov    $0xb8000,%edi
mov    $0xfa0,%edx
call   1040 <memset@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @clear(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8*
%4 = alloca i32
store i8 %0, i8* %2
%5 = load i8, i8* %2
%6 = load i8, i8* %2
%7 = call signext i8 @makeAttr(i8 signext %5, i8 signext %6)
store i8 %7, i8* %2
store i8* inttoptr (i64 753664 to i8*), i8** %3
store i32 0, i32* %4
br label %8
8: ; preds = %11, %1
%9 = load i32, i32* %4
%10 = icmp ult i32 %9, 4000
br i1 %10, label %11, label %19
11: ; preds = %8
%12 = load i8*, i8** %3
store i8 32, i8* %12
%13 = load i8, i8* %2
%14 = load i8*, i8** %3
store i8 %13, i8* %14
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %3
%17 = load i32, i32* %4
%18 = add i32 %17, 1
store i32 %18, i32* %4
br label %8
19: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @clear(i8 signext %0) {
%2 = tail call signext i8 @makeAttr(i8 signext %0, i8 signext %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ OS_Exit();
int /*<<< orphan*/ OS_Write0(char *);
int main(void) {
  OS_Write0("Hello, World!\n");
  OS_Exit();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <OS_Write0@plt>
mov    $0x0,%al
call   1030 <OS_Exit@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <OS_Write0@plt>
xor    %eax,%eax
call   1030 <OS_Exit@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Hello, World!\0A\00"
define i32 @main() {
%1 = call i32 @OS_Write0(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @OS_Exit()
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Hello, World!\0A\00"
define i32 @main() {
%1 = tail call i32 @OS_Write0(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @OS_Exit()
ret i32 0
}
/* Variables and functions */
double asin(double);
double aCsc(double x) { return asin(1.0 / x); }


x86 assembly (clang, -O0):
<aCsc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xedb(%rip),%xmm0
divsd  -0x8(%rbp),%xmm0
call   1030 <asin@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aCsc>:
movsd  0xee8(%rip),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
jmp    1030 <asin@plt>

LLVM IR (-O0):
define double @aCsc(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fdiv double 1.000000e+00, %3
%5 = call double @asin(double %4)
ret double %5
}

LLVM IR (-O2):
define double @aCsc(double %0) {
%2 = fdiv double 1.000000e+00, %0
%3 = tail call double @asin(double %2)
ret double %3
}
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int e_flags;
};
typedef TYPE_1__ Elf32_Ehdr;

/* Variables and functions */
int elf_is_fdpic(Elf32_Ehdr *hdr) { return hdr->e_flags & 0x00001000; }


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

x86 assembly (clang, -O2):
<elf_is_fdpic>:
mov    $0x1000,%eax
and    (%rdi),%eax
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32 }
define i32 @elf_is_fdpic(%struct.TYPE_3__* %0) {
%2 = alloca %struct.TYPE_3__*
store %struct.TYPE_3__* %0, %struct.TYPE_3__** %2
%3 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%4 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 0
%5 = load i32, i32* %4
%6 = and i32 %5, 4096
ret i32 %6
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32 }
define i32 @elf_is_fdpic(%struct.TYPE_3__* nocapture %0) {
%2 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = and i32 %3, 4096
ret i32 %4
}
void protocol_basic_free_topic_data(struct topic *t) {}


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

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

LLVM IR (-O0):
%struct.topic = type opaque
define void @protocol_basic_free_topic_data(%struct.topic* %0) {
%2 = alloca %struct.topic*
store %struct.topic* %0, %struct.topic** %2
ret void
}

LLVM IR (-O2):
%struct.topic = type opaque
define void @protocol_basic_free_topic_data(%struct.topic* nocapture %0) {
ret void
}
void XtAppAddSignal() {}


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

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

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

LLVM IR (-O2):
define void @XtAppAddSignal() {
ret void
}
/* Variables and functions */
int stress_cache_set_flag(int);
int stress_cache_set_fence(const char *opt) {
  (void)opt;
  return stress_cache_set_flag((0x04));
}


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

x86 assembly (clang, -O2):
<stress_cache_set_fence>:
mov    $0x4,%edi
jmp    1030 <stress_cache_set_flag@plt>

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

LLVM IR (-O2):
define i32 @stress_cache_set_fence(i8* nocapture readnone %0) {
%2 = tail call i32 @stress_cache_set_flag(i32 4)
ret i32 %2
}
/* Variables and functions */
int strtod(char const *, char **);
int myatoi(const char *str, int *ret) {
  char *p;
  int i;
  i = strtod(str, &p);
  if (p == str)
    return 0;
  *ret = i;
  return 1;
}


x86 assembly (clang, -O0):
<myatoi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <strtod@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    114a <myatoi+0x3a>
movl   $0x0,-0x4(%rbp)
jmp    115a <myatoi+0x4a>
mov    -0x24(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myatoi>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsp,%rsi
call   1030 <strtod@plt>
cmp    %rbx,(%rsp)
je     1132 <myatoi+0x22>
mov    %eax,(%r14)
mov    $0x1,%eax
jmp    1134 <myatoi+0x24>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @myatoi(i8* %0, i32* nocapture writeonly %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = call i32 @strtod(i8* %0, i8** %3)
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, %0
br i1 %7, label %9, label %8
8: ; preds = %2
store i32 %5, i32* %1
br label %9
9: ; preds = %2, %8
%10 = phi i32 [ 1, %8 ], [ 0, %2 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void error(int val, int errno) {
  switch (errno) {
  default:
    fprintf(stderr, "unknown err");
  }
  exit(errno);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
lea    0xec2(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rbx
mov    %esi,%ebx
mov    0x2eb6(%rip),%rax
mov    (%rax),%edi
lea    0xecd(%rip),%rsi
call   1030 <fprintf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [12 x i8] c"unknown err\00"
define void @error(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
switch i32 %5, label %6 [
]
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %6
%10 = load i32, i32* %4
%11 = call i32 @exit(i32 %10)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [12 x i8] c"unknown err\00"
define void @error(i32 %0, i32 %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @exit(i32 %1)
unreachable
}
int main() {
  char *invalid = (char *)0x12345678;
  char c = *invalid;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x12345678,%eax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x9(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
void ulog(const char *fmt, ...) {}


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

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

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

LLVM IR (-O2):
define void @ulog(i8* nocapture %0, ...) {
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint8_t negative(signed char b) {
  uint32_t x = b;
  x >>= 31;
  return x;
}


x86 assembly (clang, -O0):
<negative>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x1f,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<negative>:
sar    $0x7,%dil
movsbl %dil,%eax
ret

LLVM IR (-O0):
define i32 @negative(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = ashr i32 %6, 31
store i32 %7, i32* %3
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
define i32 @negative(i8 signext %0) {
%2 = ashr i8 %0, 7
%3 = sext i8 %2 to i32
ret i32 %3
}
int UINT_TO_DINT(unsigned short var) {
  int newvar;
  newvar = (int)var;
  return newvar;
}


x86 assembly (clang, -O0):
<UINT_TO_DINT>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @UINT_TO_DINT(i16 zeroext %0) {
%2 = zext i16 %0 to i32
ret i32 %2
}
/* Variables and functions */
double asin(double);
double asin_wrapper(double *arg_list) { return (asin(arg_list[0])); }


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

x86 assembly (clang, -O2):
<asin_wrapper>:
movsd  (%rdi),%xmm0
jmp    1030 <asin@plt>

LLVM IR (-O0):
define double @asin_wrapper(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = getelementptr inbounds double, double* %3, i64 0
%5 = load double, double* %4
%6 = call double @asin(double %5)
ret double %6
}

LLVM IR (-O2):
define double @asin_wrapper(double* nocapture %0) {
%2 = load double, double* %0
%3 = tail call double @asin(double %2)
ret double %3
}
/* Type definitions */
typedef int wchar_t;

/* Variables and functions */
unsigned int _hash(wchar_t *s) {
  unsigned int hash = 0;
  while (*s) {
    hash = *s + hash * 31;
    s++;
  }
  hash %= 101;
  return hash;
}


x86 assembly (clang, -O0):
<_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
je     113c <_hash+0x3c>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
imul   $0x1f,-0xc(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <_hash+0xf>
mov    -0xc(%rbp),%eax
mov    $0x65,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_hash>:
mov    (%rdi),%ecx
test   %ecx,%ecx
je     1143 <_hash+0x43>
add    $0x4,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
mov    %eax,%edx
shl    $0x5,%edx
sub    %eax,%edx
mov    %edx,%eax
add    %ecx,%eax
mov    (%rdi),%ecx
add    $0x4,%rdi
test   %ecx,%ecx
jne    1110 <_hash+0x10>
mov    %eax,%ecx
imul   $0x446f8657,%rcx,%rcx
shr    $0x20,%rcx
mov    %eax,%edx
sub    %ecx,%edx
shr    %edx
add    %ecx,%edx
shr    $0x6,%edx
imul   $0x65,%edx,%ecx
sub    %ecx,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @_hash(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
br label %4
4: ; preds = %8, %1
%5 = load i32*, i32** %2
%6 = load i32, i32* %5
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %16
8: ; preds = %4
%9 = load i32*, i32** %2
%10 = load i32, i32* %9
%11 = load i32, i32* %3
%12 = mul i32 %11, 31
%13 = add i32 %10, %12
store i32 %13, i32* %3
%14 = load i32*, i32** %2
%15 = getelementptr inbounds i32, i32* %14, i32 1
store i32* %15, i32** %2
br label %4
16: ; preds = %4
%17 = load i32, i32* %3
%18 = urem i32 %17, 101
store i32 %18, i32* %3
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
define i32 @_hash(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp eq i32 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %11, %4 ], [ %2, %1 ]
%6 = phi i32 [ %9, %4 ], [ 0, %1 ]
%7 = phi i32* [ %10, %4 ], [ %0, %1 ]
%8 = mul i32 %6, 31
%9 = add i32 %5, %8
%10 = getelementptr inbounds i32, i32* %7, i64 1
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4
%14 = urem i32 %9, 101
br label %15
15: ; preds = %13, %1
%16 = phi i32 [ 0, %1 ], [ %14, %13 ]
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ err(int, char *, char const *);
int check(int res, const char *msg) {
  if (res == -1)
    err(1, "%s", msg);
  return res;
}


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jne    113e <check+0x2e>
mov    -0x10(%rbp),%rdx
mov    $0x1,%edi
lea    0xec7(%rip),%rsi
call   1030 <err@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
push   %rbx
mov    %edi,%ebx
cmp    $0xffffffff,%edi
jne    112c <check+0x1c>
mov    %rsi,%rdx
lea    0xede(%rip),%rsi
mov    $0x1,%edi
call   1030 <err@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @check(i32 returned %0, i8* %1) {
%3 = icmp eq i32 %0, -1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @err(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %6
6: ; preds = %4, %2
ret i32 %0
}
void __CUT_TAKEDOWN__arr() {}


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

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

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

LLVM IR (-O2):
define void @__CUT_TAKEDOWN__arr() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void test1() { printf("running in test1!\n"); }


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

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

LLVM IR (-O0):
@.str = [19 x i8] c"running in test1!\0A\00"
define void @test1() {
%1 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [18 x i8] c"running in test1!\00"
define void @test1() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
ret void
}
int main() {
  int *x, *y;
  int *res = &x;
  res = noprotofun(5, 6);
  {
    printf("Success\n");
    exit(0);
  };
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    $0x5,%edi
mov    $0x6,%esi
mov    $0x0,%al
call   1030 <noprotofun@plt>
cltq
mov    %rax,-0x20(%rbp)
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x5,%edi
mov    $0x6,%esi
xor    %eax,%eax
call   1040 <noprotofun@plt>
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"Success\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
store i32 0, i32* %1
%5 = bitcast i32** %2 to i32*
store i32* %5, i32** %4
%6 = call i32 (i32, i32, ...) bitcast (i32 (...)* @noprotofun to i32 (i32, i32, ...)*)(i32 5, i32 6)
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
store i32* %8, i32** %4
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
unreachable
}

LLVM IR (-O2):
@str = [8 x i8] c"Success\00"
define i32 @main() {
%1 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @noprotofun to i32 (i32, i32, ...)*)(i32 5, i32 6)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
tail call void @exit(i32 0)
unreachable
}
float ceil_fast(float x) {
  if (x <= 0.f) {
    return (float)(int)x;
  } else {
    return -((float)(int)-x) + 1.f;
  }
}


x86 assembly (clang, -O0):
<ceil_fast>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x8(%rbp),%xmm0
jb     1129 <ceil_fast+0x29>
cvttss2si -0x8(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1161 <ceil_fast+0x61>
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
cvttss2si %xmm0,%eax
cvtsi2ss %eax,%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xea8(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ceil_fast>:
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
jae    1123 <ceil_fast+0x23>
xorps  0xef1(%rip),%xmm0
cvttps2dq %xmm0,%xmm0
cvtdq2ps %xmm0,%xmm1
movss  0xef2(%rip),%xmm0
subss  %xmm1,%xmm0
ret
cvttps2dq %xmm0,%xmm0
cvtdq2ps %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @ceil_fast(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %3
%4 = load float, float* %3
%5 = fcmp ole float %4, 0.000000e+00
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load float, float* %3
%8 = fptosi float %7 to i32
%9 = sitofp i32 %8 to float
store float %9, float* %2
br label %17
10: ; preds = %1
%11 = load float, float* %3
%12 = fneg float %11
%13 = fptosi float %12 to i32
%14 = sitofp i32 %13 to float
%15 = fneg float %14
%16 = fadd float %15, 1.000000e+00
store float %16, float* %2
br label %17
17: ; preds = %10, %6
%18 = load float, float* %2
ret float %18
}

LLVM IR (-O2):
define float @ceil_fast(float %0) {
%2 = fcmp ugt float %0, 0.000000e+00
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = fptosi float %0 to i32
%5 = sitofp i32 %4 to float
br label %11
6: ; preds = %1
%7 = fneg float %0
%8 = fptosi float %7 to i32
%9 = sitofp i32 %8 to float
%10 = fsub float 1.000000e+00, %9
br label %11
11: ; preds = %6, %3
%12 = phi float [ %5, %3 ], [ %10, %6 ]
ret float %12
}