xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, int, int, int, int);
void setcolor(int attr, int fg, int bg) {
  char ControlCmd[13];
  sprintf(ControlCmd, "%c[%d;%d;%dm", 0x1B, attr, fg + 30, bg + 40);
  printf("%s", ControlCmd);
}


x86 assembly (clang, -O0):
<setcolor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
lea    -0x19(%rbp),%rdi
mov    -0x4(%rbp),%ecx
mov    -0x8(%rbp),%r8d
add    $0x1e,%r8d
mov    -0xc(%rbp),%r9d
add    $0x28,%r9d
lea    0xeb1(%rip),%rsi
mov    $0x1b,%edx
call   1040 <sprintf@plt>
lea    -0x19(%rbp),%rsi
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setcolor>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ecx
lea    0x1e(%rsi),%r8d
lea    0x28(%rdx),%r9d
lea    0xeca(%rip),%rsi
lea    0x3(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1b,%edx
call   1040 <sprintf@plt>
lea    0xebe(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"%c[%d;%d;%dm\00"
@.str.1 = [3 x i8] c"%s\00"
define void @setcolor(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [13 x i8]
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 0
%9 = load i32, i32* %4
%10 = load i32, i32* %5
%11 = add nsw i32 %10, 30
%12 = load i32, i32* %6
%13 = add nsw i32 %12, 40
%14 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 27, i32 %9, i32 %11, i32 %13)
%15 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 0
%16 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %15)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"%c[%d;%d;%dm\00"
@.str.1 = [3 x i8] c"%s\00"
define void @setcolor(i32 %0, i32 %1, i32 %2) {
%4 = alloca [13 x i8]
%5 = getelementptr inbounds [13 x i8], [13 x i8]* %4, i64 0, i64 0
%6 = add nsw i32 %1, 30
%7 = add nsw i32 %2, 40
%8 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 27, i32 %0, i32 %6, i32 %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5)
ret void
}
int isascii(const int c) { return c >= 0 && c <= 0x7F; }


x86 assembly (clang, -O0):
<isascii>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1120 <isascii+0x20>
cmpl   $0x7f,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isascii>:
xor    %eax,%eax
cmp    $0x80,%edi
setb   %al
ret

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

LLVM IR (-O2):
define i32 @isascii(i32 %0) {
%2 = icmp ult i32 %0, 128
%3 = zext i1 %2 to i32
ret i32 %3
}
struct cvmx_wqe *cvmx_pow_work_response_async(int scr_addr) {
  struct cvmx_wqe *wqe = (void *)(unsigned long)scr_addr;
  return wqe;
}


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

x86 assembly (clang, -O2):
<cvmx_pow_work_response_async>:
movslq %edi,%rax
ret

LLVM IR (-O0):
%struct.cvmx_wqe = type opaque
define %struct.cvmx_wqe* @cvmx_pow_work_response_async(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.cvmx_wqe*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i8*
%7 = bitcast i8* %6 to %struct.cvmx_wqe*
store %struct.cvmx_wqe* %7, %struct.cvmx_wqe** %3
%8 = load %struct.cvmx_wqe*, %struct.cvmx_wqe** %3
ret %struct.cvmx_wqe* %8
}

LLVM IR (-O2):
%struct.cvmx_wqe = type opaque
define %struct.cvmx_wqe* @cvmx_pow_work_response_async(i32 %0) {
%2 = sext i32 %0 to i64
%3 = inttoptr i64 %2 to %struct.cvmx_wqe*
ret %struct.cvmx_wqe* %3
}
/* Variables and functions */
scalar_t__ dcac_acl_ops(int, int, int, char *, int /*<<< orphan*/ *);
int dcac_set_def_exacl(char *plain_acl) {
  return (int)dcac_acl_ops(22, -1, -1, plain_acl, NULL);
}


x86 assembly (clang, -O0):
<dcac_set_def_exacl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
mov    $0x16,%edi
mov    $0xffffffff,%edx
xor    %eax,%eax
mov    %eax,%r8d
mov    %edx,%esi
call   1030 <dcac_acl_ops@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dcac_set_def_exacl>:
mov    %rdi,%rcx
mov    $0x16,%edi
mov    $0xffffffff,%esi
mov    $0xffffffff,%edx
xor    %r8d,%r8d
jmp    1030 <dcac_acl_ops@plt>

LLVM IR (-O0):
define i32 @dcac_set_def_exacl(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @dcac_acl_ops(i32 22, i32 -1, i32 -1, i8* %3, i32* null)
%5 = trunc i64 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @dcac_set_def_exacl(i8* %0) {
%2 = tail call i64 @dcac_acl_ops(i32 22, i32 -1, i32 -1, i8* %0, i32* null)
%3 = trunc i64 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ zsflagging(char *, char *);
void op_alu_lsr(char regina[], char reginb[], char regouta[], char flags[]) {
  int i;
  for (i = 8 - 1; i >= 1; i--) {
    regouta[i] = regouta[i - 1];
  }
  regouta[0] = '0';
  zsflagging(flags, regouta);
}


x86 assembly (clang, -O0):
<op_alu_lsr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x7,-0x24(%rbp)
cmpl   $0x1,-0x24(%rbp)
jl     1162 <op_alu_lsr+0x52>
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    112f <op_alu_lsr+0x1f>
mov    -0x18(%rbp),%rax
movb   $0x30,(%rax)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <zsflagging@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<op_alu_lsr>:
movzwl 0x4(%rdx),%edi
mov    (%rdx),%esi
mov    %esi,0x1(%rdx)
mov    0x6(%rdx),%al
mov    %di,0x5(%rdx)
mov    %al,0x7(%rdx)
movb   $0x30,(%rdx)
mov    %rcx,%rdi
mov    %rdx,%rsi
jmp    1030 <zsflagging@plt>

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

LLVM IR (-O2):
define void @op_alu_lsr(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* %2, i8* %3) {
%5 = getelementptr i8, i8* %2, i64 1
store i8 48, i8* %2
%6 = tail call i32 @zsflagging(i8* %3, i8* %2)
ret void
}
int zChrSearch(char *token, char s, int len) {
  if (!token)
    return 0;
  for (; *token; token++)
    if (*token == s)
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<zChrSearch>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    %edx,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1128 <zChrSearch+0x28>
movl   $0x0,-0x4(%rbp)
jmp    1176 <zChrSearch+0x76>
jmp    112d <zChrSearch+0x2d>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     116f <zChrSearch+0x6f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    1159 <zChrSearch+0x59>
movl   $0x1,-0x4(%rbp)
jmp    1176 <zChrSearch+0x76>
jmp    115e <zChrSearch+0x5e>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    112d <zChrSearch+0x2d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<zChrSearch>:
xor    %eax,%eax
test   %rdi,%rdi
je     1130 <zChrSearch+0x30>
mov    (%rdi),%cl
test   %cl,%cl
je     1130 <zChrSearch+0x30>
add    $0x1,%rdi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    %sil,%cl
je     1131 <zChrSearch+0x31>
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1120 <zChrSearch+0x20>
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @zChrSearch(i8* %0, i8 signext %1, i32 %2) {
%4 = icmp eq i8* %0, null
br i1 %4, label %16, label %5
5: ; preds = %3
%6 = load i8, i8* %0
%7 = icmp eq i8 %6, 0
br i1 %7, label %16, label %11
8: ; preds = %11
%9 = load i8, i8* %15
%10 = icmp eq i8 %9, 0
br i1 %10, label %16, label %11
11: ; preds = %5, %8
%12 = phi i8 [ %9, %8 ], [ %6, %5 ]
%13 = phi i8* [ %15, %8 ], [ %0, %5 ]
%14 = icmp eq i8 %12, %1
%15 = getelementptr inbounds i8, i8* %13, i64 1
br i1 %14, label %16, label %8
16: ; preds = %11, %8, %5, %3
%17 = phi i32 [ 0, %3 ], [ 0, %5 ], [ 1, %11 ], [ 0, %8 ]
ret i32 %17
}
int test_imm_8Aint8_reg(signed char val) {
  return ((val) & (-0x8A << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_8Aint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xffffff76,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_8Aint8_reg>:
test   $0xffffff76,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_8Aint8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, -138
%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_8Aint8_reg(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = and i32 %2, -138
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t get_hash(const char *s, uint32_t mask) {
  uint32_t hash = 5381;
  int c;
  while ((c = *s++)) {
    hash = ((hash << 5) + hash) ^ c;
  }
  return hash & (mask - 1);
}


x86 assembly (clang, -O0):
<get_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x1505,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     1144 <get_hash+0x44>
mov    -0x10(%rbp),%eax
shl    $0x5,%eax
add    -0x10(%rbp),%eax
xor    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <get_hash+0x12>
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_hash>:
mov    %esi,%eax
mov    (%rdi),%dl
test   %dl,%dl
je     1139 <get_hash+0x39>
add    $0x1,%rdi
mov    $0x1505,%esi
mov    %esi,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %dl,%edx
shl    $0x5,%ecx
add    %esi,%ecx
xor    %edx,%ecx
movzbl (%rdi),%edx
add    $0x1,%rdi
mov    %ecx,%esi
test   %dl,%dl
jne    1120 <get_hash+0x20>
jmp    113e <get_hash+0x3e>
mov    $0x1505,%ecx
add    $0xffffffff,%eax
and    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @get_hash(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %13, %5 ], [ %3, %2 ]
%7 = phi i8* [ %10, %5 ], [ %0, %2 ]
%8 = phi i32 [ %12, %5 ], [ 5381, %2 ]
%9 = sext i8 %6 to i32
%10 = getelementptr inbounds i8, i8* %7, i64 1
%11 = mul i32 %8, 33
%12 = xor i32 %11, %9
%13 = load i8, i8* %10
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
%16 = phi i32 [ 5381, %2 ], [ %12, %5 ]
%17 = add nsw i32 %1, -1
%18 = and i32 %16, %17
ret i32 %18
}
const char *foo(void) { return "foo"; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"foo\00"
define i8* @foo() {
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [4 x i8] c"foo\00"
define i8* @foo() {
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_dev;
};

/* Variables and functions */
int fstat(int, struct stat *);
int gnu_dev_major(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int is_on_physical_device(int fd) {
  struct stat sb;
  int ret;
  ret = fstat(fd, &sb);
  if (ret) {
    perror("fstat");
    return -1;
  }
  return gnu_dev_major(sb.st_dev);
}


x86 assembly (clang, -O0):
<is_on_physical_device>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   1050 <fstat@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     116c <is_on_physical_device+0x3c>
lea    0xea5(%rip),%rdi
call   1040 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1177 <is_on_physical_device+0x47>
mov    -0x10(%rbp),%edi
call   1030 <gnu_dev_major@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_on_physical_device>:
push   %rax
mov    %rsp,%rsi
call   1050 <fstat@plt>
test   %eax,%eax
jne    1146 <is_on_physical_device+0x16>
mov    (%rsp),%edi
pop    %rax
jmp    1030 <gnu_dev_major@plt>
lea    0xeb3(%rip),%rdi
call   1040 <perror@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [6 x i8] c"fstat\00"
define i32 @is_on_physical_device(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.stat
%5 = alloca i32
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = call i32 @fstat(i32 %6, %struct.stat* %4)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %2
br label %16
12: ; preds = %1
%13 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%14 = load i32, i32* %13
%15 = call i32 @gnu_dev_major(i32 %14)
store i32 %15, i32* %2
br label %16
16: ; preds = %12, %10
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [6 x i8] c"fstat\00"
define i32 @is_on_physical_device(i32 %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @fstat(i32 %0, %struct.stat* %2)
%5 = icmp eq i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %12
8: ; preds = %1
%9 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%10 = load i32, i32* %9
%11 = tail call i32 @gnu_dev_major(i32 %10)
br label %12
12: ; preds = %8, %6
%13 = phi i32 [ -1, %6 ], [ %11, %8 ]
ret i32 %13
}
void storeDouble(void *pv) {
  double *pd = pv;
  *pd = 0.3;
}


x86 assembly (clang, -O0):
<storeDouble>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  0xee4(%rip),%xmm0
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<storeDouble>:
movabs $0x3fd3333333333333,%rax
33 d3 3f
mov    %rax,(%rdi)
ret

LLVM IR (-O0):
define void @storeDouble(i8* %0) {
%2 = alloca i8*
%3 = alloca double*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to double*
store double* %5, double** %3
%6 = load double*, double** %3
store double 3.000000e-01, double* %6
ret void
}

LLVM IR (-O2):
define void @storeDouble(i8* nocapture writeonly %0) {
%2 = bitcast i8* %0 to double*
store double 3.000000e-01, double* %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int EAST_CD_6(int in) {
  FILE *fin = fopen("func_header.h.ecov", "a");
  if (fin) {
    fprintf(fin, "CD6:%d\n", in);
  }
  fclose(fin);
  return in;
}


x86 assembly (clang, -O0):
<EAST_CD_6>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xebe(%rip),%rdi
lea    0xeca(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1170 <EAST_CD_6+0x40>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xeaa(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EAST_CD_6>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
lea    0xec4(%rip),%rdi
lea    0xed0(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1161 <EAST_CD_6+0x31>
lea    0xebe(%rip),%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
call   1040 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"func_header.h.ecov\00"
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [8 x i8] c"CD6:%d\0A\00"
define i32 @EAST_CD_6(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
%4 = call i32* @fopen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %4, i32** %3
%5 = load i32*, i32** %3
%6 = icmp ne i32* %5, null
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i32*, i32** %3
%9 = load i32, i32* %2
%10 = call i32 @fprintf(i32* %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %9)
br label %11
11: ; preds = %7, %1
%12 = load i32*, i32** %3
%13 = call i32 @fclose(i32* %12)
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@.str = [19 x i8] c"func_header.h.ecov\00"
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [8 x i8] c"CD6:%d\0A\00"
define i32 @EAST_CD_6(i32 returned %0) {
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @fprintf(i32* %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %0)
br label %6
6: ; preds = %4, %1
%7 = tail call i32 @fclose(i32* %2)
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, int, ...);
int parse_error(char *filename, char *line, int ln, char *bad_word) {
  if (bad_word)
    printf("Error at line %s:%d at %s\n", filename, ln, bad_word);
  else
    printf("Error at line %s:%d\n", filename, ln);
  return -1;
}


x86 assembly (clang, -O0):
<parse_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1150 <parse_error+0x40>
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1165 <parse_error+0x55>
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_error>:
push   %rax
mov    %rdi,%rsi
test   %rcx,%rcx
je     1129 <parse_error+0x19>
lea    0xee0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1137 <parse_error+0x27>
lea    0xeeb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Error at line %s:%d at %s\0A\00"
@.str.1 = [21 x i8] c"Error at line %s:%d\0A\00"
define i32 @parse_error(i8* %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%9 = load i8*, i8** %8
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %16
11: ; preds = %4
%12 = load i8*, i8** %5
%13 = load i32, i32* %7
%14 = load i8*, i8** %8
%15 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %12, i32 %13, i8* %14)
br label %20
16: ; preds = %4
%17 = load i8*, i8** %5
%18 = load i32, i32* %7
%19 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %17, i32 %18)
br label %20
20: ; preds = %16, %11
ret i32 -1
}

LLVM IR (-O2):
@.str = [27 x i8] c"Error at line %s:%d at %s\0A\00"
@.str.1 = [21 x i8] c"Error at line %s:%d\0A\00"
define i32 @parse_error(i8* %0, i8* nocapture readnone %1, i32 %2, i8* %3) {
%5 = icmp eq i8* %3, null
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %2, i8* %3)
br label %10
8: ; preds = %4
%9 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 %2)
br label %10
10: ; preds = %8, %6
ret i32 -1
}
void function_in_other_file(void) {}


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

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

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

LLVM IR (-O2):
define void @function_in_other_file() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ R_INTC0_Start();
void enable_spi(void) { R_INTC0_Start(); }


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

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

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

LLVM IR (-O2):
define void @enable_spi() {
%1 = tail call i32 (...) @R_INTC0_Start()
ret void
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
scalar_t__ dci_format0_sizeof_(scalar_t__);
scalar_t__ dci_format1A_sizeof(scalar_t__);
uint32_t dci_format0_sizeof(uint32_t nof_prb) {
  uint32_t n = dci_format0_sizeof_(nof_prb);
  while (n < dci_format1A_sizeof(nof_prb)) {
    n++;
  }
  return n;
}


x86 assembly (clang, -O0):
<dci_format0_sizeof>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <dci_format0_sizeof_@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <dci_format1A_sizeof@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
jge    116b <dci_format0_sizeof+0x4b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1139 <dci_format0_sizeof+0x19>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dci_format0_sizeof>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <dci_format0_sizeof_@plt>
mov    %rax,%rbx
add    $0xffffffffffffffff,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
call   1040 <dci_format1A_sizeof@plt>
add    $0x1,%rbx
cmp    %rax,%rbx
jl     1140 <dci_format0_sizeof+0x20>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i64 @dci_format0_sizeof(i64 %0) {
%2 = tail call i64 @dci_format0_sizeof_(i64 %0)
br label %3
3: ; preds = %3, %1
%4 = phi i64 [ %2, %1 ], [ %7, %3 ]
%5 = tail call i64 @dci_format1A_sizeof(i64 %0)
%6 = icmp slt i64 %4, %5
%7 = add nsw i64 %4, 1
br i1 %6, label %3, label %8
8: ; preds = %3
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ strcat(char *, char *);
int count_cat(char *pid, char *calg, char *count) {
  strcat(pid, count);
  strcat(pid, calg);
  return 0;
}


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

x86 assembly (clang, -O2):
<count_cat>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rdx,%rsi
call   1030 <strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcat@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @count_cat(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @strcat(i8* %0, i8* %2)
%5 = tail call i32 @strcat(i8* %0, i8* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char *, int);
void f1() {
  int size = 12;
  char src[12] = "helloworld";
  char dest[12];
  memcpy(dest, src, size);
}


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0xc,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xed8(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x1c(%rbp),%rdi
lea    -0x10(%rbp),%rsi
mov    -0x4(%rbp),%edx
call   1030 <memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
sub    $0x18,%rsp
movabs $0x726f776f6c6c6568,%rax
77 6f 72
mov    %rax,(%rsp)
movl   $0x646c,0x8(%rsp)
lea    0xc(%rsp),%rdi
mov    %rsp,%rsi
mov    $0xc,%edx
call   1030 <memcpy@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.f1.src = [12 x i8] c"helloworld\00\00"
define void @f1() {
%1 = alloca i32
%2 = alloca [12 x i8]
%3 = alloca [12 x i8]
store i32 12, i32* %1
%4 = bitcast [12 x i8]* %2 to i8*
%5 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%7 = load i32, i32* %1
%8 = call i32 @memcpy(i8* %5, i8* %6, i32 %7)
ret void
}

LLVM IR (-O2):
@__const.f1.src = [12 x i8] c"helloworld\00\00"
define void @f1() {
%1 = alloca [12 x i8]
%2 = alloca [12 x i8]
%3 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%5 = call i32 @memcpy(i8* %4, i8* %3, i32 12)
ret void
}
int __attribute__((always_)) abs(int i) { return i < 0 ? -i : i; }


x86 assembly (clang, -O0):
<abs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    111e <abs+0x1e>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <abs+0x24>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @abs(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = sub nsw i32 0, %6
br label %10
8: ; preds = %1
%9 = load i32, i32* %2
br label %10
10: ; preds = %8, %5
%11 = phi i32 [ %7, %5 ], [ %9, %8 ]
ret i32 %11
}

LLVM IR (-O2):
define i32 @abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
int cmp(void const *e1, void const *e2) {
  int i = *(*((int **)e1));
  int j = *(*((int **)e2));
  if (i < j)
    return -1;
  if (i > j)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    113c <cmp+0x3c>
movl   $0xffffffff,-0x4(%rbp)
jmp    115b <cmp+0x5b>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    1154 <cmp+0x54>
movl   $0x1,-0x4(%rbp)
jmp    115b <cmp+0x5b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32**
%4 = load i32*, i32** %3
%5 = load i32, i32* %4
%6 = bitcast i8* %1 to i32**
%7 = load i32*, i32** %6
%8 = load i32, i32* %7
%9 = icmp slt i32 %5, %8
%10 = icmp sgt i32 %5, %8
%11 = zext i1 %10 to i32
%12 = select i1 %9, i32 -1, i32 %11
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ FREE(void *);
void FREEIF(void *ptr) {
  if (ptr)
    FREE(ptr);
}


x86 assembly (clang, -O0):
<FREEIF>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <FREEIF+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <FREE@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FREEIF>:
test   %rdi,%rdi
je     111a <FREEIF+0xa>
jmp    1030 <FREE@plt>
ret

LLVM IR (-O0):
define void @FREEIF(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @FREE(i8* %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @FREEIF(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @FREE(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
void inclass_element2OCTAL(char c) {}


x86 assembly (clang, -O0):
<inclass_element2OCTAL>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @inclass_element2OCTAL(i8 signext %0) {
ret void
}
/* Type definitions */
struct sk_buff {
  int dummy;
};
struct nlmsghdr {
  int dummy;
};

/* Variables and functions */
int nlmsg_trim(struct sk_buff *, struct nlmsghdr *);
int nlmsg_cancel(struct sk_buff *skb, struct nlmsghdr *nlh) {
  return nlmsg_trim(skb, nlh);
}


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

x86 assembly (clang, -O2):
<nlmsg_cancel>:
jmp    1030 <nlmsg_trim@plt>

LLVM IR (-O0):
%struct.sk_buff = type { i32 }
%struct.nlmsghdr = type { i32 }
define i32 @nlmsg_cancel(%struct.sk_buff* %0, %struct.nlmsghdr* %1) {
%3 = alloca %struct.sk_buff*
%4 = alloca %struct.nlmsghdr*
store %struct.sk_buff* %0, %struct.sk_buff** %3
store %struct.nlmsghdr* %1, %struct.nlmsghdr** %4
%5 = load %struct.sk_buff*, %struct.sk_buff** %3
%6 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%7 = call i32 @nlmsg_trim(%struct.sk_buff* %5, %struct.nlmsghdr* %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.sk_buff = type { i32 }
%struct.nlmsghdr = type { i32 }
define i32 @nlmsg_cancel(%struct.sk_buff* %0, %struct.nlmsghdr* %1) {
%3 = tail call i32 @nlmsg_trim(%struct.sk_buff* %0, %struct.nlmsghdr* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ WARN_ONCE(int, char *);
int scm_is_mc_boot_available(void) {
  WARN_ONCE(1, "CONFIG_MSM_SCM disabled, SCM call will fail silently\n");
  return 0;
}


x86 assembly (clang, -O0):
<scm_is_mc_boot_available>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
lea    0xee0(%rip),%rsi
call   1030 <WARN_ONCE@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<scm_is_mc_boot_available>:
push   %rax
lea    0xee8(%rip),%rsi
mov    $0x1,%edi
call   1030 <WARN_ONCE@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [54 x i8] c"CONFIG_MSM_SCM disabled, SCM call will fail silently\0A\00"
define i32 @scm_is_mc_boot_available() {
%1 = call i32 @WARN_ONCE(i32 1, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [54 x i8] c"CONFIG_MSM_SCM disabled, SCM call will fail silently\0A\00"
define i32 @scm_is_mc_boot_available() {
%1 = tail call i32 @WARN_ONCE(i32 1, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void version(char **argv) {
  fprintf(stderr, "%s-v.%d.%d ", argv[0], 0, 1);
  fprintf(stderr, "- (c) 2004-2006 "
                  "Martin Vuagnoux"
                  " <"
                  "autodafe@vuagnoux.com"
                  ">\n\n");
}


x86 assembly (clang, -O0):
<version>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
lea    0xecd(%rip),%rsi
xor    %ecx,%ecx
mov    $0x1,%r8d
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
lea    0xeba(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<version>:
push   %rbx
mov    0x2ec8(%rip),%rbx
mov    (%rbx),%eax
mov    (%rdi),%rdx
lea    0xedc(%rip),%rsi
mov    %eax,%edi
xor    %ecx,%ecx
mov    $0x1,%r8d
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xece(%rip),%rsi
xor    %eax,%eax
pop    %rbx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [12 x i8] c"%s-v.%d.%d \00"
@.str.1 = [58 x i8] c"- (c) 2004-2006 Martin Vuagnoux <autodafe@vuagnoux.com>\0A\0A\00"
define void @version(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i32, i32* @stderr
%4 = load i8**, i8*** %2
%5 = getelementptr inbounds i8*, i8** %4, i64 0
%6 = load i8*, i8** %5
%7 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %6, i32 0, i32 1)
%8 = load i32, i32* @stderr
%9 = call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [12 x i8] c"%s-v.%d.%d \00"
@.str.1 = [58 x i8] c"- (c) 2004-2006 Martin Vuagnoux <autodafe@vuagnoux.com>\0A\0A\00"
define void @version(i8** nocapture %0) {
%2 = load i32, i32* @stderr
%3 = load i8*, i8** %0
%4 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %3, i32 0, i32 1)
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int cmpf_int(const void *key1, const void *key2) {
  return (*(const int *)key1 != *(const int *)key2);
}


x86 assembly (clang, -O0):
<cmpf_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmpf_int>:
mov    (%rdi),%ecx
xor    %eax,%eax
cmp    (%rsi),%ecx
setne  %al
ret

LLVM IR (-O0):
define i32 @cmpf_int(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = icmp ne i32 %7, %10
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @cmpf_int(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp ne i32 %4, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void putusage(const char *s) {
  printf("usage: %s file ... host:target, or\n", s);
  printf("       %s file ... target (when already connected)\n", s);
}


x86 assembly (clang, -O0):
<putusage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xeed(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putusage>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0xefa(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"usage: %s file ... host:target, or\0A\00"
@.str.1 = [52 x i8] c" %s file ... target (when already connected)\0A\00"
define void @putusage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = load i8*, i8** %2
%6 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0), i8* %5)
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"usage: %s file ... host:target, or\0A\00"
@.str.1 = [52 x i8] c" %s file ... target (when already connected)\0A\00"
define void @putusage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gui_send_data(char *);
void gui_start() { gui_send_data("start"); }


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"start\00"
define void @gui_start() {
%1 = call i32 @gui_send_data(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"start\00"
define void @gui_start() {
%1 = tail call i32 @gui_send_data(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
void XtCvtStringToInt() {}


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

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

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

LLVM IR (-O2):
define void @XtCvtStringToInt() {
ret void
}
/* Variables and functions */
int *malloc(int);
int *copia(int *vet, int tam) {
  int *retorno = malloc(tam * sizeof(int));
  for (int i = 0; i < tam; i++)
    retorno[i] = vet[i];
  return retorno;
}


x86 assembly (clang, -O0):
<copia>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1169 <copia+0x59>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1139 <copia+0x29>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copia>:
push   %r15
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %rdi,%r14
lea    0x0(,%rbx,4),%edi
call   1040 <malloc@plt>
mov    %rax,%r15
test   %ebx,%ebx
jle    114e <copia+0x2e>
mov    %ebx,%edx
shl    $0x2,%rdx
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <memcpy@plt>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define noalias i32* @copia(i32* nocapture %0, i32 %1) {
%3 = shl i32 %1, 2
%4 = tail call i32* @malloc(i32 %3)
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = bitcast i32* %4 to i8*
%8 = bitcast i32* %0 to i8*
%9 = zext i32 %1 to i64
%10 = shl nuw nsw i64 %9, 2
br label %11
11: ; preds = %6, %2
ret i32* %4
}
int ft_isprint(int c) {
  if ((c >= 32 && c <= 126))
    return (1);
  else
    return (0);
}


x86 assembly (clang, -O0):
<ft_isprint>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
jl     1127 <ft_isprint+0x27>
cmpl   $0x7e,-0x8(%rbp)
jg     1127 <ft_isprint+0x27>
movl   $0x1,-0x4(%rbp)
jmp    112e <ft_isprint+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_isprint>:
add    $0xffffffe0,%edi
xor    %eax,%eax
cmp    $0x5f,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @ft_isprint(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 32
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 126
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 1, i32* %2
br label %11
10: ; preds = %6, %1
store i32 0, i32* %2
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @ft_isprint(i32 %0) {
%2 = add i32 %0, -32
%3 = icmp ult i32 %2, 95
%4 = zext i1 %3 to i32
ret i32 %4
}
int f(int a, int *b) { return *(b + a); }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
movslq %edi,%rax
mov    (%rsi,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @f(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
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %5, i64 %7
%9 = load i32, i32* %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @f(i32 %0, i32* nocapture %1) {
%3 = sext i32 %0 to i64
%4 = getelementptr inbounds i32, i32* %1, i64 %3
%5 = load i32, i32* %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ etp_set_max_parallel(unsigned int);
void eio_set_max_parallel(unsigned int nthreads) {
  etp_set_max_parallel(nthreads);
}


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

x86 assembly (clang, -O2):
<eio_set_max_parallel>:
jmp    1030 <etp_set_max_parallel@plt>

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

LLVM IR (-O2):
define void @eio_set_max_parallel(i32 %0) {
%2 = tail call i32 @etp_set_max_parallel(i32 %0)
ret void
}
void start_mutex(volatile int *lock) {
  while (__sync_val_compare_and_swap(lock, 0, 1) == 1) {
  }
}


x86 assembly (clang, -O0):
<start_mutex>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
mov    $0x1,%edx
lock cmpxchg %edx,(%rcx)
sete   %cl
cmp    $0x1,%eax
jne    1128 <start_mutex+0x28>
jmp    1108 <start_mutex+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<start_mutex>:
mov    $0x1,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
lock cmpxchg %ecx,(%rdi)
cmp    $0x1,%eax
je     1110 <start_mutex+0x10>
ret

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

LLVM IR (-O2):
define void @start_mutex(i32* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = cmpxchg i32* %0, i32 0, i32 1 seq_cst seq_cst
%4 = extractvalue { i32, i1 } %3, 0
%5 = icmp eq i32 %4, 1
br i1 %5, label %2, label %6
6: ; preds = %2
ret void
}