xunge/DecIR huggingface dataset:
int main(int argc, char *argv[]) {
  const int N = 10000;
  int i, a[N];
#pragma omp parallel for
  for (i = 0; i < N; i++) {
    a[i] = 2 * i;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x9be0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x2710,-0x14(%rbp)
mov    %rsp,%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x2710,-0x18(%rbp)
jge    115a <main+0x5a>
mov    -0x18(%rbp),%ecx
shl    $0x1,%ecx
movslq -0x18(%rbp),%rax
mov    %ecx,-0x9c60(%rbp,%rax,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112e <main+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
add    $0x9be0,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
int fitsShort(int x) {
  int shiftedX = x >> 15;
  return !(~shiftedX) | !shiftedX;
}


x86 assembly (clang, -O0):
<fitsShort>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0xf,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
xor    $0xffffffff,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
cmpl   $0x0,-0x8(%rbp)
setne  %cl
xor    $0xff,%cl
and    $0x1,%cl
movzbl %cl,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fitsShort>:
movswl %di,%ecx
xor    %eax,%eax
cmp    %edi,%ecx
sete   %al
ret

LLVM IR (-O0):
define i32 @fitsShort(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = ashr i32 %4, 15
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = xor i32 %6, -1
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
%11 = load i32, i32* %3
%12 = icmp ne i32 %11, 0
%13 = xor i1 %12, true
%14 = zext i1 %13 to i32
%15 = or i32 %10, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @fitsShort(i32 %0) {
%2 = add i32 %0, 32768
%3 = icmp ult i32 %2, 65536
%4 = zext i1 %3 to i32
ret i32 %4
}
unsigned char port_byte_in(unsigned short port) {
  unsigned char result;
  __asm__("in %%dx, %% al" : "=a"(result) : "d"(port));
  return result;
}


x86 assembly (clang, -O0):
<port_byte_in>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%dx
in     (%dx),%al
mov    %al,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<port_byte_in>:
mov    %edi,%edx
in     (%dx),%al
ret

LLVM IR (-O0):
define zeroext i8 @port_byte_in(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i8
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = call i8 asm "in %dx, % al", "={ax},{dx},~{dirflag},~{fpsr},~{flags}"(i16 %4)
store i8 %5, i8* %3
%6 = load i8, i8* %3
ret i8 %6
}

LLVM IR (-O2):
define zeroext i8 @port_byte_in(i16 zeroext %0) {
%2 = tail call i8 asm "in %dx, % al", "={ax},{dx},~{dirflag},~{fpsr},~{flags}"(i16 %0)
ret i8 %2
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void tcc_free(void *ptr) { free(ptr); }


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

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

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

LLVM IR (-O2):
define void @tcc_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
void foo(unsigned char x) { unsigned char a[5 + x]; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x5,%eax
mov    %eax,%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @foo(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8*
%4 = alloca i64
store i8 %0, i8* %2
%5 = load i8, i8* %2
%6 = zext i8 %5 to i32
%7 = add nsw i32 5, %6
%8 = zext i32 %7 to i64
%9 = call i8* @llvm.stacksave()
store i8* %9, i8** %3
%10 = alloca i8, i64 %8
store i64 %8, i64* %4
%11 = load i8*, i8** %3
ret void
}

LLVM IR (-O2):
define void @foo(i8 zeroext %0) {
ret void
}
void DefaultGaitSetup() {}


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

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

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

LLVM IR (-O2):
define void @DefaultGaitSetup() {
ret void
}
int c6_to_8(int v) {
  int b;
  v &= 0x3f;
  b = v & 1;
  return (v << 2) | (b << 1) | b;
}


x86 assembly (clang, -O0):
<c6_to_8>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x3f,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x2,%eax
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
or     %ecx,%eax
or     -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<c6_to_8>:
mov    %edi,%ecx
and    $0x1,%ecx
and    $0x3f,%edi
lea    (%rcx,%rcx,1),%eax
lea    (%rax,%rdi,4),%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @c6_to_8(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = and i32 %4, 63
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = and i32 %6, 1
store i32 %7, i32* %3
%8 = load i32, i32* %2
%9 = shl i32 %8, 2
%10 = load i32, i32* %3
%11 = shl i32 %10, 1
%12 = or i32 %9, %11
%13 = load i32, i32* %3
%14 = or i32 %12, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @c6_to_8(i32 %0) {
%2 = and i32 %0, 1
%3 = shl i32 %0, 2
%4 = and i32 %3, 252
%5 = shl nuw nsw i32 %2, 1
%6 = or i32 %4, %5
%7 = or i32 %6, %2
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isbdigit(int);
void t_isbdigit_0xd8() {
  Assert_real((isbdigit(216) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isbdigit.c",
              1085, ("isbdigit should be 0 for 0xd8"));
}


x86 assembly (clang, -O0):
<t_isbdigit_0xd8>:
push   %rbp
mov    %rsp,%rbp
mov    $0xd8,%edi
call   1040 <isbdigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x43d,%edx
lea    0xf5c(%rip),%rcx
call   1030 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isbdigit_0xd8>:
push   %rax
mov    $0xd8,%edi
call   1040 <isbdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x43d,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isbdigit.c\00"
@.str.1 = [30 x i8] c"isbdigit should be 0 for 0xd8\00"
define void @t_isbdigit_0xd8() {
%1 = call i64 @isbdigit(i32 216)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 1085, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isbdigit.c\00"
@.str.1 = [30 x i8] c"isbdigit should be 0 for 0xd8\00"
define void @t_isbdigit_0xd8() {
%1 = tail call i64 @isbdigit(i32 216)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 1085, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
struct instrument {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ inst_wrtf(struct instrument *, char *, char *);
void _open_one_relay(struct instrument *gd, char *relay) {
  inst_wrtf(gd, "ROUTE:OPEN %s\n", relay);
}


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

x86 assembly (clang, -O2):
<_open_one_relay>:
mov    %rsi,%rdx
lea    0xee6(%rip),%rsi
jmp    1030 <inst_wrtf@plt>

LLVM IR (-O0):
%struct.instrument = type { i32 }
@.str = [15 x i8] c"ROUTE:OPEN %s\0A\00"
define void @_open_one_relay(%struct.instrument* %0, i8* %1) {
%3 = alloca %struct.instrument*
%4 = alloca i8*
store %struct.instrument* %0, %struct.instrument** %3
store i8* %1, i8** %4
%5 = load %struct.instrument*, %struct.instrument** %3
%6 = load i8*, i8** %4
%7 = call i32 @inst_wrtf(%struct.instrument* %5, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %6)
ret void
}

LLVM IR (-O2):
%struct.instrument = type { i32 }
@.str = [15 x i8] c"ROUTE:OPEN %s\0A\00"
define void @_open_one_relay(%struct.instrument* %0, i8* %1) {
%3 = tail call i32 @inst_wrtf(%struct.instrument* %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}
int all_visited(int *visited, int size) {
  int i = 0;
  for (i = 0; i < size; i++) {
    if (visited[i] == -1) {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<all_visited>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1156 <all_visited+0x56>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
jne    1143 <all_visited+0x43>
movl   $0x0,-0x4(%rbp)
jmp    115d <all_visited+0x5d>
jmp    1148 <all_visited+0x48>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1119 <all_visited+0x19>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<all_visited>:
mov    $0x1,%eax
test   %esi,%esi
jle    111f <all_visited+0x1f>
mov    %esi,%ecx
xor    %edx,%edx
nopl   (%rax)
cmpl   $0xffffffff,(%rdi,%rdx,4)
je     1120 <all_visited+0x20>
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    1110 <all_visited+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @all_visited(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %8
6: ; preds = %8
%7 = icmp eq i64 %13, %5
br i1 %7, label %14, label %8
8: ; preds = %4, %6
%9 = phi i64 [ 0, %4 ], [ %13, %6 ]
%10 = getelementptr inbounds i32, i32* %0, i64 %9
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, -1
%13 = add nuw nsw i64 %9, 1
br i1 %12, label %14, label %6
14: ; preds = %8, %6, %2
%15 = phi i32 [ 1, %2 ], [ 1, %6 ], [ 0, %8 ]
ret i32 %15
}
char *getenv(const char *var) { return ((void *)0); }


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

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

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

LLVM IR (-O2):
define noalias i8* @getenv(i8* nocapture readnone %0) {
ret i8* null
}
/* Variables and functions */
size_t strlen(char *);
char *dirent_name_trim(char *string) {
  size_t len;
  len = strlen(string);
  while (len-- > 0) {
    if (string[len] != ' ') {
      return (string);
    }
    string[len] = '\0';
  }
  return (string);
}


x86 assembly (clang, -O0):
<dirent_name_trim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x18(%rbp)
cmp    $0x0,%rax
jbe    1175 <dirent_name_trim+0x65>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
je     1164 <dirent_name_trim+0x54>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    117d <dirent_name_trim+0x6d>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1129 <dirent_name_trim+0x19>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dirent_name_trim>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
test   %rax,%rax
je     1132 <dirent_name_trim+0x22>
xchg   %ax,%ax
cmpb   $0x20,-0x1(%rbx,%rax,1)
jne    1132 <dirent_name_trim+0x22>
movb   $0x0,-0x1(%rbx,%rax,1)
add    $0xffffffffffffffff,%rax
jne    1120 <dirent_name_trim+0x10>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @dirent_name_trim(i8* returned %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %10
%5 = phi i64 [ %6, %10 ], [ %2, %1 ]
%6 = add i64 %5, -1
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 32
br i1 %9, label %10, label %12
10: ; preds = %4
store i8 0, i8* %7
%11 = icmp eq i64 %6, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %10, %1
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ Die(char *, size_t, char *, int);
void *malloc(size_t);
void *sre_malloc(char *file, int line, size_t size) {
  void *ptr;
  ;
  if ((ptr = malloc(size)) == NULL)
    Die("malloc of %ld bytes failed: file %s line %d", size, file, line);
  return ptr;
}


x86 assembly (clang, -O0):
<sre_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1161 <sre_malloc+0x41>
mov    -0x18(%rbp),%rsi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
lea    0xea4(%rip),%rdi
call   1040 <Die@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sre_malloc>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %esi,%r14d
mov    %rdi,%r15
mov    %rdx,%rdi
call   1030 <malloc@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    1155 <sre_malloc+0x35>
lea    0xeb9(%rip),%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %r14d,%ecx
call   1040 <Die@plt>
mov    %rbp,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [44 x i8] c"malloc of %ld bytes failed: file %s line %d\00"
define i8* @sre_malloc(i8* %0, i32 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i64
%7 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i64 %2, i64* %6
%8 = load i64, i64* %6
%9 = call i8* @malloc(i64 %8)
store i8* %9, i8** %7
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %16
11: ; preds = %3
%12 = load i64, i64* %6
%13 = load i8*, i8** %4
%14 = load i32, i32* %5
%15 = call i32 @Die(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i64 %12, i8* %13, i32 %14)
br label %16
16: ; preds = %11, %3
%17 = load i8*, i8** %7
ret i8* %17
}

LLVM IR (-O2):
@.str = [44 x i8] c"malloc of %ld bytes failed: file %s line %d\00"
define noalias i8* @sre_malloc(i8* %0, i32 %1, i64 %2) {
%4 = tail call i8* @malloc(i64 %2)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @Die(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i64 %2, i8* %0, i32 %1)
br label %8
8: ; preds = %6, %3
ret i8* %4
}
unsigned f2u(float f) {
  union {
    unsigned u;
    float f;
  } v;
  v.u = 0;
  v.f = f;
  return v.u;
}


x86 assembly (clang, -O0):
<f2u>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2u>:
movd   %xmm0,%eax
ret

LLVM IR (-O0):
%union.anon = type { i32 }
define i32 @f2u(float %0) {
%2 = alloca float
%3 = alloca %union.anon
store float %0, float* %2
%4 = bitcast %union.anon* %3 to i32*
store i32 0, i32* %4
%5 = load float, float* %2
%6 = bitcast %union.anon* %3 to float*
store float %5, float* %6
%7 = bitcast %union.anon* %3 to i32*
%8 = load i32, i32* %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @f2u(float %0) {
%2 = bitcast float %0 to i32
ret i32 %2
}
double calcRectVol(float Length, float Breadth, float Height) {
  return Length * Breadth * Height;
}


x86 assembly (clang, -O0):
<calcRectVol>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<calcRectVol>:
mulss  %xmm1,%xmm0
mulss  %xmm2,%xmm0
cvtss2sd %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @calcRectVol(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %5
%9 = fmul float %7, %8
%10 = load float, float* %6
%11 = fmul float %9, %10
%12 = fpext float %11 to double
ret double %12
}

LLVM IR (-O2):
define double @calcRectVol(float %0, float %1, float %2) {
%4 = fmul float %0, %1
%5 = fmul float %4, %2
%6 = fpext float %5 to double
ret double %6
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int openexec_open(char const *, int, int /*<<< orphan*/);
int open(const char *pathname, int flags, mode_t mode) {
  return openexec_open(pathname, flags, mode);
}


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

x86 assembly (clang, -O2):
<open>:
jmp    1030 <openexec_open@plt>

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

LLVM IR (-O2):
define i32 @open(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32 @openexec_open(i8* %0, i32 %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
int swapNibble8(unsigned short);
unsigned short swapNibble16(unsigned short value) {
  return swapNibble8(value >> 8) | (swapNibble8(value) << 8);
}


x86 assembly (clang, -O0):
<swapNibble16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
sar    $0x8,%eax
movzwl %ax,%edi
call   1030 <swapNibble8@plt>
mov    %eax,-0x8(%rbp)
movzwl -0x2(%rbp),%edi
call   1030 <swapNibble8@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
shl    $0x8,%ecx
or     %ecx,%eax
movzwl %ax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<swapNibble16>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
shr    $0x8,%edi
call   1030 <swapNibble8@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1030 <swapNibble8@plt>
shl    $0x8,%eax
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define zeroext i16 @swapNibble16(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = ashr i32 %4, 8
%6 = trunc i32 %5 to i16
%7 = call i32 @swapNibble8(i16 zeroext %6)
%8 = load i16, i16* %2
%9 = call i32 @swapNibble8(i16 zeroext %8)
%10 = shl i32 %9, 8
%11 = or i32 %7, %10
%12 = trunc i32 %11 to i16
ret i16 %12
}

LLVM IR (-O2):
define zeroext i16 @swapNibble16(i16 zeroext %0) {
%2 = lshr i16 %0, 8
%3 = tail call i32 @swapNibble8(i16 zeroext %2)
%4 = tail call i32 @swapNibble8(i16 zeroext %0)
%5 = shl i32 %4, 8
%6 = or i32 %5, %3
%7 = trunc i32 %6 to i16
ret i16 %7
}
int isLessThanNegative90Degrees(double value) { return value < -0.5; }


x86 assembly (clang, -O0):
<isLessThanNegative90Degrees>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isLessThanNegative90Degrees>:
movsd  0xef8(%rip),%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
seta   %al
ret

LLVM IR (-O0):
define i32 @isLessThanNegative90Degrees(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp olt double %3, -5.000000e-01
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @isLessThanNegative90Degrees(double %0) {
%2 = fcmp olt double %0, -5.000000e-01
%3 = zext i1 %2 to i32
ret i32 %3
}
double wd_vi(double redchan, double nirchan) {
  double result;
  double a = 1;
  if ((nirchan + redchan) == 0.0) {
    result = -1.0;
  } else {
    result = (nirchan - a * redchan);
  }
  return result;
}


x86 assembly (clang, -O0):
<wd_vi>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  0xeea(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
addsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    114a <wd_vi+0x4a>
jp     114a <wd_vi+0x4a>
movsd  0xec8(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    117d <wd_vi+0x7d>
movsd  -0x10(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<wd_vi>:
movapd %xmm0,%xmm2
addsd  %xmm1,%xmm2
subsd  %xmm0,%xmm1
xorpd  %xmm3,%xmm3
cmpeqsd %xmm2,%xmm3
movsd  0xee3(%rip),%xmm0
andpd  %xmm3,%xmm0
andnpd %xmm1,%xmm3
orpd   %xmm3,%xmm0
ret

LLVM IR (-O0):
define double @wd_vi(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %3
store double %1, double* %4
store double 1.000000e+00, double* %6
%7 = load double, double* %4
%8 = load double, double* %3
%9 = fadd double %7, %8
%10 = fcmp oeq double %9, 0.000000e+00
br i1 %10, label %11, label %12
11: ; preds = %2
store double -1.000000e+00, double* %5
br label %18
12: ; preds = %2
%13 = load double, double* %4
%14 = load double, double* %6
%15 = load double, double* %3
%16 = fneg double %14
%17 = call double @llvm.fmuladd.f64(double %16, double %15, double %13)
store double %17, double* %5
br label %18
18: ; preds = %12, %11
%19 = load double, double* %5
ret double %19
}

LLVM IR (-O2):
define double @wd_vi(double %0, double %1) {
%3 = fadd double %0, %1
%4 = fcmp oeq double %3, 0.000000e+00
%5 = tail call double @llvm.fmuladd.f64(double %0, double -1.000000e+00, double %1)
%6 = select i1 %4, double -1.000000e+00, double %5
ret double %6
}
int tsPrintTileSetInfo() { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @tsPrintTileSetInfo() {
ret i32 0
}
void ath_debug_stat_tx(struct ath_softc *sc, struct ath_txq *txq,
                       struct ath_buf *bf) {}


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

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

LLVM IR (-O0):
%struct.ath_softc = type opaque
%struct.ath_txq = type opaque
%struct.ath_buf = type opaque
define void @ath_debug_stat_tx(%struct.ath_softc* %0, %struct.ath_txq* %1, %struct.ath_buf* %2) {
%4 = alloca %struct.ath_softc*
%5 = alloca %struct.ath_txq*
%6 = alloca %struct.ath_buf*
store %struct.ath_softc* %0, %struct.ath_softc** %4
store %struct.ath_txq* %1, %struct.ath_txq** %5
store %struct.ath_buf* %2, %struct.ath_buf** %6
ret void
}

LLVM IR (-O2):
%struct.ath_softc = type opaque
%struct.ath_txq = type opaque
%struct.ath_buf = type opaque
define void @ath_debug_stat_tx(%struct.ath_softc* nocapture %0, %struct.ath_txq* nocapture %1, %struct.ath_buf* nocapture %2) {
ret void
}
/* Variables and functions */
int floatToRawIntBits(float);
__attribute__((always_)) const int ilogb2kf(float d) {
  return ((floatToRawIntBits(d) >> 23) & 0xff) - 0x7f;
}


x86 assembly (clang, -O0):
<ilogb2kf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <floatToRawIntBits@plt>
sar    $0x17,%eax
and    $0xff,%eax
sub    $0x7f,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ilogb2kf>:
push   %rax
call   1030 <floatToRawIntBits@plt>
shr    $0x17,%eax
movzbl %al,%eax
add    $0xffffff81,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @ilogb2kf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i32 @floatToRawIntBits(float %3)
%5 = ashr i32 %4, 23
%6 = and i32 %5, 255
%7 = sub nsw i32 %6, 127
ret i32 %7
}

LLVM IR (-O2):
define i32 @ilogb2kf(float %0) {
%2 = tail call i32 @floatToRawIntBits(float %0)
%3 = lshr i32 %2, 23
%4 = and i32 %3, 255
%5 = add nsw i32 %4, -127
ret i32 %5
}
/* Type definitions */
struct pqos_cpuinfo {
  int dummy;
};

/* Variables and functions */
unsigned int *__get_cores_per_topology_obj(struct pqos_cpuinfo const *, int,
                                           unsigned int const, unsigned int *);
unsigned *pqos_cpu_get_cores_l3id(const struct pqos_cpuinfo *cpu,
                                  const unsigned l3_id, unsigned *count) {
  return __get_cores_per_topology_obj(cpu, 3, l3_id, count);
}


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

x86 assembly (clang, -O2):
<pqos_cpu_get_cores_l3id>:
mov    %rdx,%rcx
mov    %esi,%edx
mov    $0x3,%esi
jmp    1030 <__get_cores_per_topology_obj@plt>

LLVM IR (-O0):
%struct.pqos_cpuinfo = type { i32 }
define i32* @pqos_cpu_get_cores_l3id(%struct.pqos_cpuinfo* %0, i32 %1, i32* %2) {
%4 = alloca %struct.pqos_cpuinfo*
%5 = alloca i32
%6 = alloca i32*
store %struct.pqos_cpuinfo* %0, %struct.pqos_cpuinfo** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%7 = load %struct.pqos_cpuinfo*, %struct.pqos_cpuinfo** %4
%8 = load i32, i32* %5
%9 = load i32*, i32** %6
%10 = call i32* @__get_cores_per_topology_obj(%struct.pqos_cpuinfo* %7, i32 3, i32 %8, i32* %9)
ret i32* %10
}

LLVM IR (-O2):
%struct.pqos_cpuinfo = type { i32 }
define i32* @pqos_cpu_get_cores_l3id(%struct.pqos_cpuinfo* %0, i32 %1, i32* %2) {
%4 = tail call i32* @__get_cores_per_topology_obj(%struct.pqos_cpuinfo* %0, i32 3, i32 %1, i32* %2)
ret i32* %4
}
unsigned int s3c2410_get_pll(int pllval, int baseclk) {
  int mdiv, pdiv, sdiv;
  mdiv = pllval >> 12;
  pdiv = pllval >> 4;
  sdiv = pllval >> 0;
  mdiv &= ((1 << (1 + (19 - 12))) - 1);
  pdiv &= ((1 << 5) - 1);
  sdiv &= 3;
  return (baseclk * (mdiv + 8)) / ((pdiv + 2) << sdiv);
}


x86 assembly (clang, -O0):
<s3c2410_get_pll>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0xc,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x4,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x0,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
and    $0x1f,%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
and    $0x3,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    $0x8,%ecx
imul   %ecx,%eax
mov    -0x10(%rbp),%edx
add    $0x2,%edx
mov    -0x14(%rbp),%ecx
shl    %cl,%edx
mov    %edx,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<s3c2410_get_pll>:
mov    %edi,%ecx
mov    %edi,%eax
shr    $0xc,%eax
shr    $0x4,%edi
movzbl %al,%eax
and    $0x1f,%edi
add    $0x2,%edi
and    $0x3,%cl
shl    %cl,%edi
add    $0x8,%eax
imul   %esi,%eax
cltd
idiv   %edi
ret

LLVM IR (-O0):
define i32 @s3c2410_get_pll(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%8 = load i32, i32* %3
%9 = ashr i32 %8, 12
store i32 %9, i32* %5
%10 = load i32, i32* %3
%11 = ashr i32 %10, 4
store i32 %11, i32* %6
%12 = load i32, i32* %3
%13 = ashr i32 %12, 0
store i32 %13, i32* %7
%14 = load i32, i32* %5
%15 = and i32 %14, 255
store i32 %15, i32* %5
%16 = load i32, i32* %6
%17 = and i32 %16, 31
store i32 %17, i32* %6
%18 = load i32, i32* %7
%19 = and i32 %18, 3
store i32 %19, i32* %7
%20 = load i32, i32* %4
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 8
%23 = mul nsw i32 %20, %22
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 2
%26 = load i32, i32* %7
%27 = shl i32 %25, %26
%28 = sdiv i32 %23, %27
ret i32 %28
}

LLVM IR (-O2):
define i32 @s3c2410_get_pll(i32 %0, i32 %1) {
%3 = lshr i32 %0, 12
%4 = lshr i32 %0, 4
%5 = and i32 %3, 255
%6 = and i32 %4, 31
%7 = and i32 %0, 3
%8 = add nuw nsw i32 %5, 8
%9 = mul nsw i32 %8, %1
%10 = add nuw nsw i32 %6, 2
%11 = shl nuw nsw i32 %10, %7
%12 = sdiv i32 %9, %11
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("Usage: test_cgrp2_array_pin [...]\n");
  printf("       -F <file>   File to pin an BPF cgroup array\n");
  printf("       -U <file>   Update an already pinned BPF cgroup array\n");
  printf("       -v <value>  Full path of the cgroup2\n");
  printf("       -h          Display this help\n");
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xefe(%rip),%rdi
call   1030 <puts@plt>
lea    0xf25(%rip),%rdi
call   1030 <puts@plt>
lea    0xf56(%rip),%rdi
call   1030 <puts@plt>
lea    0xf76(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"Usage: test_cgrp2_array_pin [...]\0A\00"
@.str.1 = [52 x i8] c" -F <file> File to pin an BPF cgroup array\0A\00"
@.str.2 = [62 x i8] c" -U <file> Update an already pinned BPF cgroup array\0A\00"
@.str.3 = [45 x i8] c" -v <value> Full path of the cgroup2\0A\00"
@.str.4 = [38 x i8] c" -h Display this help\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [34 x i8] c"Usage: test_cgrp2_array_pin [...]\00"
@str.5 = [51 x i8] c" -F <file> File to pin an BPF cgroup array\00"
@str.6 = [61 x i8] c" -U <file> Update an already pinned BPF cgroup array\00"
@str.7 = [44 x i8] c" -v <value> Full path of the cgroup2\00"
@str.8 = [37 x i8] c" -h Display this help\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.5, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.6, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.7, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.8, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, size_t, void const *);
void *my_malloc_hook(size_t size, const void *caller) {
  printf("%d alloced from %p\n", size, caller);
}


x86 assembly (clang, -O0):
<my_malloc_hook>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_malloc_hook>:
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xee3(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"%d alloced from %p\0A\00"
define i8* @my_malloc_hook(i64 %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i64 %0, i64* %4
store i8* %1, i8** %5
%6 = load i64, i64* %4
%7 = load i8*, i8** %5
%8 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i64 %6, i8* %7)
%9 = load i8*, i8** %3
ret i8* %9
}

LLVM IR (-O2):
@.str = [20 x i8] c"%d alloced from %p\0A\00"
define noalias i8* @my_malloc_hook(i64 %0, i8* %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i64 %0, i8* %1)
ret i8* undef
}
void numa_store_cpu_info(unsigned int cpu) {}


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

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

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

LLVM IR (-O2):
define void @numa_store_cpu_info(i32 %0) {
ret void
}
/* Variables and functions */
int divi(int *, int);
void quicksort(int a[], int n) {
  int index;
  if (n <= 1) {
    return;
  } else {
    index = divi(a, n);
    quicksort(a, index);
    quicksort(a + index + 1, n - index - 1);
  }
}


x86 assembly (clang, -O0):
<quicksort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jg     113e <quicksort+0x1e>
jmp    117a <quicksort+0x5a>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <divi@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1030 <quicksort@plt>
mov    -0x8(%rbp),%rdi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
add    $0x4,%rdi
mov    -0xc(%rbp),%esi
sub    -0x10(%rbp),%esi
sub    $0x1,%esi
call   1030 <quicksort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quicksort>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x2,%esi
jl     115f <quicksort+0x3f>
mov    %esi,%r14d
mov    %rdi,%rbx
nop
mov    %rbx,%rdi
mov    %r14d,%esi
call   1040 <divi@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <quicksort@plt>
movslq %ebp,%rax
lea    (%rbx,%rax,4),%rbx
add    $0x4,%rbx
not    %eax
add    %r14d,%eax
mov    %eax,%r14d
cmp    $0x1,%eax
jg     1130 <quicksort+0x10>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @quicksort(i32* %0, i32 %1) {
%3 = icmp slt i32 %1, 2
br i1 %3, label %14, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %12, %4 ], [ %1, %2 ]
%6 = phi i32* [ %10, %4 ], [ %0, %2 ]
%7 = tail call i32 @divi(i32* %6, i32 %5)
tail call void @quicksort(i32* %6, i32 %7)
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* %6, i64 1
%10 = getelementptr inbounds i32, i32* %9, i64 %8
%11 = xor i32 %7, -1
%12 = add i32 %5, %11
%13 = icmp slt i32 %12, 2
br i1 %13, label %14, label %4
14: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ error(int, int /*<<< orphan*/, char *);
scalar_t__ malloc(unsigned int);
char *xmalloc(unsigned n) {
  char *p;
  p = (char *)malloc(n);
  if (p == 0)
    error(2, 0, "virtual memory exhausted");
  return p;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1155 <xmalloc+0x35>
mov    $0x2,%edi
xor    %esi,%esi
lea    0xeb0(%rip),%rdx
call   1040 <error@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rbx
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1141 <xmalloc+0x21>
lea    0xecb(%rip),%rdx
mov    $0x2,%edi
xor    %esi,%esi
call   1040 <error@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"virtual memory exhausted\00"
define i8* @xmalloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i64 @malloc(i32 %4)
%6 = inttoptr i64 %5 to i8*
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @error(i32 2, i32 0, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %1
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
@.str = [25 x i8] c"virtual memory exhausted\00"
define i8* @xmalloc(i32 %0) {
%2 = tail call i64 @malloc(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @error(i32 2, i32 0, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
%7 = inttoptr i64 %2 to i8*
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
void f1() {
  int x;
  int *p = &x;
  assert(p != 0);
}


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
mov    $0x1,%edi
jmp    1030 <assert@plt>

LLVM IR (-O0):
define void @f1() {
%1 = alloca i32
%2 = alloca i32*
store i32* %1, i32** %2
%3 = load i32*, i32** %2
%4 = icmp ne i32* %3, null
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
ret void
}

LLVM IR (-O2):
define void @f1() {
%1 = tail call i32 @assert(i32 1)
ret void
}
unsigned int __get_literal_address(unsigned char *buf, unsigned int len) {
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @__get_literal_address(i8* nocapture readnone %0, i32 %1) {
ret i32 0
}
long a_cas_l(volatile void *p, long t, long s) {
  __asm__("lock ; cmpxchg %3, %1"
          : "=a"(t), "=m"(*(long *)p)
          : "a"(t), "r"(s)
          : "memory");
  return t;
}


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

x86 assembly (clang, -O2):
<a_cas_l>:
mov    %rsi,%rax
lock cmpxchg %rdx,(%rdi)
ret

LLVM IR (-O0):
define i64 @a_cas_l(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = bitcast i8* %7 to i64*
%9 = load i64, i64* %5
%10 = load i64, i64* %6
%11 = call i64 asm "lock ; cmpxchg $3, $1", "={ax},=*m,{ax},r,~{memory},~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %8, i64 %9, i64 %10)
store i64 %11, i64* %5
%12 = load i64, i64* %5
ret i64 %12
}

LLVM IR (-O2):
define i64 @a_cas_l(i8* %0, i64 %1, i64 %2) {
%4 = bitcast i8* %0 to i64*
%5 = tail call i64 asm "lock ; cmpxchg $3, $1", "={ax},=*m,{ax},r,~{memory},~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %4, i64 %1, i64 %2)
ret i64 %5
}
cbuf2(f, n) { return (cbuf(f, n, 2)); }


x86 assembly (clang, -O0):
<cbuf2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x2,%edx
mov    $0x0,%al
call   1030 <cbuf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cbuf2>:
mov    $0x2,%edx
xor    %eax,%eax
jmp    1030 <cbuf@plt>

LLVM IR (-O0):
define i32 @cbuf2(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @cbuf to i32 (i32, i32, i32, ...)*)(i32 %5, i32 %6, i32 2)
ret i32 %7
}

LLVM IR (-O2):
define i32 @cbuf2(i32 %0, i32 %1) {
%3 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @cbuf to i32 (i32, i32, i32, ...)*)(i32 %0, i32 %1, i32 2)
ret i32 %3
}
int *find_addr(int (*ptrscore)[4], int n) { return *(ptrscore + n); }


x86 assembly (clang, -O0):
<find_addr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_addr>:
movslq %esi,%rax
shl    $0x4,%rax
add    %rdi,%rax
ret

LLVM IR (-O0):
define i32* @find_addr([4 x i32]* %0, i32 %1) {
%3 = alloca [4 x i32]*
%4 = alloca i32
store [4 x i32]* %0, [4 x i32]** %3
store i32 %1, i32* %4
%5 = load [4 x i32]*, [4 x i32]** %3
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 %7
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %8, i64 0, i64 0
ret i32* %9
}

LLVM IR (-O2):
define i32* @find_addr([4 x i32]* readnone %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 %3, i64 0
ret i32* %4
}
/* Variables and functions */
int /*<<< orphan*/ gensym(char const *);
void *get_object(char const *);
int /*<<< orphan*/ pd_symbol(void *, int /*<<< orphan*/);
int libpd_symbol(const char *recv, const char *sym) {
  void *obj = get_object(recv);
  if (obj == NULL)
    return -1;
  pd_symbol(obj, gensym(sym));
  return 0;
}


x86 assembly (clang, -O0):
<libpd_symbol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <get_object@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1164 <libpd_symbol+0x34>
movl   $0xffffffff,-0x4(%rbp)
jmp    1187 <libpd_symbol+0x57>
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <gensym@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%esi
call   1040 <pd_symbol@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<libpd_symbol>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1050 <get_object@plt>
test   %rax,%rax
je     115a <libpd_symbol+0x2a>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <gensym@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <pd_symbol@plt>
xor    %eax,%eax
jmp    115f <libpd_symbol+0x2f>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @libpd_symbol(i8* %0, i8* %1) {
%3 = tail call i8* @get_object(i8* %0)
%4 = icmp eq i8* %3, null
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @gensym(i8* %1)
%7 = tail call i32 @pd_symbol(i8* %3, i32 %6)
br label %8
8: ; preds = %2, %5
%9 = phi i32 [ 0, %5 ], [ -1, %2 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
main() { printf("Hola mundo!\n"); }


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

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

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

LLVM IR (-O2):
@str = [12 x i8] c"Hola mundo!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret i32 0
}