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

/* Variables and functions */
uint32_t get32le(const uint8_t *bytes) {
  return (bytes[0]) | (bytes[1] << 8) | (bytes[2] << 16) | (bytes[3] << 24);
}


x86 assembly (clang, -O0):
<get32le>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%rcx
mov    0x4(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x8(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0xc(%rcx),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get32le>:
mov    0x4(%rdi),%ecx
mov    0x8(%rdi),%edx
shl    $0x8,%ecx
or     (%rdi),%ecx
shl    $0x10,%edx
mov    0xc(%rdi),%eax
shl    $0x18,%eax
or     %edx,%eax
or     %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @get32le(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = load i32, i32* %3
%5 = shl i32 %4, 8
%6 = or i32 %5, %2
%7 = getelementptr inbounds i32, i32* %0, i64 2
%8 = load i32, i32* %7
%9 = shl i32 %8, 16
%10 = or i32 %6, %9
%11 = getelementptr inbounds i32, i32* %0, i64 3
%12 = load i32, i32* %11
%13 = shl i32 %12, 24
%14 = or i32 %10, %13
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ cmaes_FATAL(char const *, char const *, char const *,
                               char const *);
void FATAL(char const *s1, char const *s2, char const *s3, char const *s4) {
  cmaes_FATAL(s1, s2, s3, s4);
}


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

x86 assembly (clang, -O2):
<FATAL>:
jmp    1030 <cmaes_FATAL@plt>

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

LLVM IR (-O2):
define void @FATAL(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call i32 @cmaes_FATAL(i8* %0, i8* %1, i8* %2, i8* %3)
ret void
}
void X509_REQ_INFO_new(void) {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ sn3218a_write_reg_triple(int, int /*<<< orphan*/,
                                            int /*<<< orphan*/,
                                            int /*<<< orphan*/);
void sn3218a_set_brightness_triplet(int ch, uint8_t brightness1,
                                    uint8_t brightness2, uint8_t brightness3) {
  sn3218a_write_reg_triple(0x01 + ch, brightness1, brightness2, brightness3);
}


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

x86 assembly (clang, -O2):
<sn3218a_set_brightness_triplet>:
add    $0x1,%edi
jmp    1030 <sn3218a_write_reg_triple@plt>

LLVM IR (-O0):
define void @sn3218a_set_brightness_triplet(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = add nsw i32 1, %9
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = call i32 @sn3218a_write_reg_triple(i32 %10, i32 %11, i32 %12, i32 %13)
ret void
}

LLVM IR (-O2):
define void @sn3218a_set_brightness_triplet(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = add nsw i32 %0, 1
%6 = tail call i32 @sn3218a_write_reg_triple(i32 %5, i32 %1, i32 %2, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int *foo(int *);
int main() {
  int i;
  int *p = foo(&i);
  if (i != 3 || *p != 2)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <foo@plt>
mov    %rax,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    1153 <main+0x33>
mov    -0x10(%rbp),%rax
cmpl   $0x2,(%rax)
je     115a <main+0x3a>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x4(%rsp),%rdi
call   1040 <foo@plt>
cmpl   $0x3,0x4(%rsp)
jne    113b <main+0x1b>
cmpl   $0x2,(%rax)
jne    113b <main+0x1b>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
store i32 0, i32* %1
%4 = call i32* @foo(i32* %2)
store i32* %4, i32** %3
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 3
br i1 %6, label %11, label %7
7: ; preds = %0
%8 = load i32*, i32** %3
%9 = load i32, i32* %8
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %13
11: ; preds = %7, %0
%12 = call i32 (...) @abort()
unreachable
13: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32* @foo(i32* %1)
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 3
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 2
br i1 %8, label %11, label %9
9: ; preds = %6, %0
%10 = call i32 (...) @abort()
unreachable
11: ; preds = %6
ret i32 0
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
scalar_t__ stat(char const *, struct stat *);
int file_exists(const char *path) {
  struct stat s;
  if (path == NULL)
    return 0;
  if (stat(path, &s) != 0)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<file_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <file_exists+0x23>
movl   $0x0,-0x4(%rbp)
jmp    115d <file_exists+0x4d>
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
je     1156 <file_exists+0x46>
movl   $0x0,-0x4(%rbp)
jmp    115d <file_exists+0x4d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_exists>:
test   %rdi,%rdi
je     112e <file_exists+0x1e>
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
add    $0x8,%rsp
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @file_exists(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 0, i32* %2
br label %14
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i64 @stat(i8* %9, %struct.stat* %4)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
store i32 0, i32* %2
br label %14
13: ; preds = %8
store i32 1, i32* %2
br label %14
14: ; preds = %13, %12, %7
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @file_exists(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = icmp eq i8* %0, null
br i1 %4, label %9, label %5
5: ; preds = %1
%6 = call i64 @stat(i8* %0, %struct.stat* %2)
%7 = icmp eq i64 %6, 0
%8 = zext i1 %7 to i32
br label %9
9: ; preds = %5, %1
%10 = phi i32 [ 0, %1 ], [ %8, %5 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void printFactors(int n) {
  int i = 1;
  int sum = 0;
  while (sum < n) {
    sum += i;
    printf("%d ", i);
    i++;
  }
  printf("= %d\n", n);
}


x86 assembly (clang, -O0):
<printFactors>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    115b <printFactors+0x4b>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1129 <printFactors+0x19>
mov    -0x4(%rbp),%esi
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printFactors>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%r15d
test   %edi,%edi
jle    1144 <printFactors+0x34>
mov    $0x1,%ebp
xor    %ebx,%ebx
lea    0xed4(%rip),%r14
nopl   0x0(%rax)
add    %ebp,%ebx
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    %r15d,%ebx
jl     1130 <printFactors+0x20>
lea    0xeb9(%rip),%rdi
mov    %r15d,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
@.str.1 = [6 x i8] c"= %d\0A\00"
define void @printFactors(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %10
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = phi i32 [ %8, %3 ], [ 1, %1 ]
%6 = add nuw nsw i32 %4, %5
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%8 = add nuw nsw i32 %5, 1
%9 = icmp slt i32 %6, %0
br i1 %9, label %3, label %10
10: ; preds = %3, %1
%11 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %0)
ret void
}
float ftoc(int fahr) {
  float celsius;
  celsius = (5.0 / 9.0) * (fahr - 32.0);
  return celsius;
}


x86 assembly (clang, -O0):
<ftoc>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xef4(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xee0(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ftoc>:
cvtsi2sd %edi,%xmm0
addsd  0xef4(%rip),%xmm0
mulsd  0xef4(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @ftoc(i32 %0) {
%2 = alloca i32
%3 = alloca float
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sitofp i32 %4 to double
%6 = fsub double %5, 3.200000e+01
%7 = fmul double 0x3FE1C71C71C71C72, %6
%8 = fptrunc double %7 to float
store float %8, float* %3
%9 = load float, float* %3
ret float %9
}

LLVM IR (-O2):
define float @ftoc(i32 %0) {
%2 = sitofp i32 %0 to double
%3 = fadd double %2, -3.200000e+01
%4 = fmul double %3, 0x3FE1C71C71C71C72
%5 = fptrunc double %4 to float
ret float %5
}
/* Type definitions */
typedef int /*<<< orphan*/ seq;

/* Variables and functions */
int /*<<< orphan*/ Dijkstra(int /*<<< orphan*/);
int /*<<< orphan*/ matrix_display();
int /*<<< orphan*/ matrix_init(int **, int);
int main() {
  int seq[][3] = {{0, 1, 10}, {0, 3, 30}, {0, 4, 100}, {1, 2, 50},
                  {2, 4, 10}, {3, 2, 20}, {3, 4, 60}};
  int num = sizeof(seq) / sizeof(*seq);
  matrix_init(seq, num);
  matrix_display();
  Dijkstra(0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xea6(%rip),%rsi
mov    $0x54,%edx
call   1050 <memcpy@plt>
movl   $0x7,-0x64(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x64(%rbp),%esi
call   1040 <matrix_init@plt>
mov    $0x0,%al
call   1060 <matrix_display@plt>
xor    %edi,%edi
call   1030 <Dijkstra@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x58,%rsp
mov    0xf16(%rip),%eax
mov    %eax,0x50(%rsp)
movaps 0xefb(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xedf(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xec3(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xea7(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe8b(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x7,%esi
call   1040 <matrix_init@plt>
xor    %eax,%eax
call   1050 <matrix_display@plt>
xor    %edi,%edi
call   1030 <Dijkstra@plt>
xor    %eax,%eax
add    $0x58,%rsp
ret

LLVM IR (-O0):
@__const.main.seq = [7 x [3 x i32]] [[3 x i32] [i32 0, i32 1, i32 10], [3 x i32] [i32 0, i32 3, i32 30], [3 x i32] [i32 0, i32 4, i32 100], [3 x i32] [i32 1, i32 2, i32 50], [3 x i32] [i32 2, i32 4, i32 10], [3 x i32] [i32 3, i32 2, i32 20], [3 x i32] [i32 3, i32 4, i32 60]]
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x [3 x i32]]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [7 x [3 x i32]]* %2 to i8*
store i32 7, i32* %3
%5 = getelementptr inbounds [7 x [3 x i32]], [7 x [3 x i32]]* %2, i64 0, i64 0
%6 = bitcast [3 x i32]* %5 to i32**
%7 = load i32, i32* %3
%8 = call i32 @matrix_init(i32** %6, i32 %7)
%9 = call i32 (...) @matrix_display()
%10 = call i32 @Dijkstra(i32 0)
ret i32 0
}

LLVM IR (-O2):
@__const.main.seq = [7 x [3 x i32]] [[3 x i32] [i32 0, i32 1, i32 10], [3 x i32] [i32 0, i32 3, i32 30], [3 x i32] [i32 0, i32 4, i32 100], [3 x i32] [i32 1, i32 2, i32 50], [3 x i32] [i32 2, i32 4, i32 10], [3 x i32] [i32 3, i32 2, i32 20], [3 x i32] [i32 3, i32 4, i32 60]]
define i32 @main() {
%1 = alloca [7 x [3 x i32]]
%2 = bitcast [7 x [3 x i32]]* %1 to i8*
%3 = bitcast [7 x [3 x i32]]* %1 to i32**
%4 = call i32 @matrix_init(i32** %3, i32 7)
%5 = call i32 (...) @matrix_display()
%6 = call i32 @Dijkstra(i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char const *);
void sys_err(const char *msg) {
  perror(msg);
  exit(1);
}


x86 assembly (clang, -O0):
<sys_err>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<sys_err>:
push   %rax
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @sys_err(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @sys_err(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usageSim() {
  printf("Usage Sim (Simulateur Impression):\n./sim_impr -t tube_in -n nom\n");
}


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

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

LLVM IR (-O0):
@.str = [65 x i8] c"Usage Sim (Simulateur Impression):\0A./sim_impr -t tube_in -n nom\0A\00"
define void @usageSim() {
%1 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [64 x i8] c"Usage Sim (Simulateur Impression):\0A./sim_impr -t tube_in -n nom\00"
define void @usageSim() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sscanf(char *, char *, int *);
int build_day() {
  int day;
  sscanf("Mar 17 2022", "%*s %d %*d", &day);
  return day;
}


x86 assembly (clang, -O0):
<build_day>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
lea    0xee6(%rip),%rsi
lea    -0x4(%rbp),%rdx
call   1030 <sscanf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<build_day>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xeed(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1030 <sscanf@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Mar 17 2022\00"
@.str.1 = [11 x i8] c"%*s %d %*d\00"
define i32 @build_day() {
%1 = alloca i32
%2 = call i32 @sscanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [12 x i8] c"Mar 17 2022\00"
@.str.1 = [11 x i8] c"%*s %d %*d\00"
define i32 @build_day() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @sscanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
ret i32 %4
}
void TMTimerFromNano(void) {}


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

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

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

LLVM IR (-O2):
define void @TMTimerFromNano() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ func(void **);
void *i;
void *j;
void *k;
void *l;
int main() {
  void *i = (i = 0, func(&i), (void *)0);
  void *j = (j = 0, func(&j), (void *)0, &i);
  void *k = (k = 0, func(&k), (void *)0) + 0x42;
  void *l = (l = 0, func(&l), l) + 0x42;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movq   $0x0,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <func@plt>
movq   $0x0,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <func@plt>
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
call   1030 <func@plt>
xor    %eax,%eax
add    $0x42,%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <func@plt>
mov    -0x20(%rbp),%rax
add    $0x42,%rax
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movq   $0x0,0x10(%rsp)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <func@plt>
movq   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <func@plt>
mov    %rbx,0x8(%rsp)
movq   $0x0,(%rsp)
mov    %rsp,%rdi
call   1030 <func@plt>
movq   $0x42,(%rsp)
movq   $0x0,0x18(%rsp)
lea    0x18(%rsp),%rdi
call   1030 <func@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@i = global i8* null
@j = global i8* null
@k = global i8* null
@l = global i8* null
define i32 @main() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* null, i8** %1
%5 = call i32 @func(i8** %1)
store i8* null, i8** %1
store i8* null, i8** %2
%6 = call i32 @func(i8** %2)
%7 = bitcast i8** %1 to i8*
store i8* %7, i8** %2
store i8* null, i8** %3
%8 = call i32 @func(i8** %3)
store i8* getelementptr (i8, i8* null, i64 66), i8** %3
store i8* null, i8** %4
%9 = call i32 @func(i8** %4)
%10 = load i8*, i8** %4
%11 = getelementptr i8, i8* %10, i64 66
store i8* %11, i8** %4
ret i32 0
}

LLVM IR (-O2):
@i = global i8* null
@j = global i8* null
@k = global i8* null
@l = global i8* null
define i32 @main() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = bitcast i8** %1 to i8*
store i8* null, i8** %1
%6 = call i32 @func(i8** %1)
store i8* null, i8** %1
%7 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%8 = call i32 @func(i8** %2)
%9 = bitcast i8** %2 to i8***
store i8** %1, i8*** %9
%10 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%11 = call i32 @func(i8** %3)
store i8* inttoptr (i64 66 to i8*), i8** %3
%12 = bitcast i8** %4 to i8*
store i8* null, i8** %4
%13 = call i32 @func(i8** %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ _pqsort(void *, size_t, size_t,
                           int (*)(void const *, void const *), unsigned char *,
                           unsigned char *);
void pqsort(void *a, size_t n, size_t es,
            int (*cmp)(const void *, const void *), size_t lrange,
            size_t rrange) {
  _pqsort(a, n, es, cmp, ((unsigned char *)a) + (lrange * es),
          ((unsigned char *)a) + ((rrange + 1) * es) - 1);
}


x86 assembly (clang, -O0):
<pqsort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x8(%rbp),%r8
mov    -0x28(%rbp),%rax
imul   -0x18(%rbp),%rax
add    %rax,%r8
mov    -0x8(%rbp),%r9
mov    -0x30(%rbp),%rax
add    $0x1,%rax
imul   -0x18(%rbp),%rax
add    %rax,%r9
add    $0xffffffffffffffff,%r9
call   1030 <_pqsort@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pqsort>:
imul   %rdx,%r8
add    %rdi,%r8
add    $0x1,%r9
imul   %rdx,%r9
add    %rdi,%r9
add    $0xffffffffffffffff,%r9
jmp    1030 <_pqsort@plt>

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

LLVM IR (-O2):
define void @pqsort(i8* %0, i64 %1, i64 %2, i32 (i8*, i8*)* %3, i64 %4, i64 %5) {
%7 = mul i64 %4, %2
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = add i64 %5, 1
%10 = mul i64 %9, %2
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = getelementptr inbounds i8, i8* %11, i64 -1
%13 = tail call i32 @_pqsort(i8* %0, i64 %1, i64 %2, i32 (i8*, i8*)* %3, i8* %8, i8* %12)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ dtype_normalize(char *, char const *);
char dtype_kind(const char *dtype) {
  char ndtype[8];
  dtype_normalize(ndtype, dtype);
  return dtype[1];
}


x86 assembly (clang, -O0):
<dtype_kind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <dtype_normalize@plt>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dtype_kind>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0x8(%rsp),%rdi
mov    %rbx,%rsi
call   1030 <dtype_normalize@plt>
mov    0x1(%rbx),%al
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @dtype_kind(i8* %0) {
%2 = alloca i8*
%3 = alloca [8 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %2
%6 = call i32 @dtype_normalize(i8* %4, i8* %5)
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = load i8, i8* %8
ret i8 %9
}

LLVM IR (-O2):
define signext i8 @dtype_kind(i8* %0) {
%2 = alloca [8 x i8]
%3 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%4 = call i32 @dtype_normalize(i8* %3, i8* %0)
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
ret i8 %6
}
/* Variables and functions */
int /*<<< orphan*/ a_base_encoders_reset();
void pre_auton(void) { a_base_encoders_reset(); }


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

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

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

LLVM IR (-O2):
define void @pre_auton() {
%1 = tail call i32 (...) @a_base_encoders_reset()
ret void
}
double fX1(double x1, double x2, double x3) { return ((9 - x2 - x3) / 4.); }


x86 assembly (clang, -O0):
<fX1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  0xeed(%rip),%xmm0
subsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  0xed3(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fX1>:
movsd  0xef8(%rip),%xmm0
subsd  %xmm1,%xmm0
subsd  %xmm2,%xmm0
mulsd  0xef0(%rip),%xmm0
ret

LLVM IR (-O0):
define double @fX1(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %5
%8 = fsub double 9.000000e+00, %7
%9 = load double, double* %6
%10 = fsub double %8, %9
%11 = fdiv double %10, 4.000000e+00
ret double %11
}

LLVM IR (-O2):
define double @fX1(double %0, double %1, double %2) {
%4 = fsub double 9.000000e+00, %1
%5 = fsub double %4, %2
%6 = fmul double %5, 2.500000e-01
ret double %6
}
int is_odd(int *val) {
  if (*val % 2 == 0)
    return -1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<is_odd>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    112b <is_odd+0x2b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1132 <is_odd+0x32>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_odd>:
mov    (%rdi),%eax
and    $0x1,%eax
add    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @is_odd(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 1
%4 = add nsw i32 %3, -1
ret i32 %4
}
int lcm(int a, int b) {
  int m = a;
  while (m % b) {
    m += a;
  }
  return m;
}


x86 assembly (clang, -O0):
<lcm>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cmp    $0x0,%edx
je     112e <lcm+0x2e>
mov    -0x4(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1110 <lcm+0x10>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcm>:
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    %edi,%ecx
mov    %ecx,%eax
cltd
idiv   %esi
test   %edx,%edx
jne    1110 <lcm+0x10>
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @lcm(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* %3
store i32 %6, i32* %5
br label %7
7: ; preds = %12, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = srem i32 %8, %9
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %7
%13 = load i32, i32* %3
%14 = load i32, i32* %5
%15 = add nsw i32 %14, %13
store i32 %15, i32* %5
br label %7
16: ; preds = %7
%17 = load i32, i32* %5
ret i32 %17
}

LLVM IR (-O2):
define i32 @lcm(i32 %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i32 [ %0, %2 ], [ %7, %3 ]
%5 = srem i32 %4, %1
%6 = icmp eq i32 %5, 0
%7 = add nsw i32 %4, %0
br i1 %6, label %8, label %3
8: ; preds = %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void callback(void) { puts("hoba"); }


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

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"hoba\00"
define void @callback() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ F_RDLCK;
int /*<<< orphan*/ F_SETLKW;
int fd_get_lock(int, int /*<<< orphan*/, int /*<<< orphan*/);
int fd_get_readw_lock(int fd) { return (fd_get_lock(fd, F_SETLKW, F_RDLCK)); }


x86 assembly (clang, -O0):
<fd_get_readw_lock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ec3(%rip),%rax
mov    (%rax),%esi
mov    0x2ea2(%rip),%rax
mov    (%rax),%edx
call   1030 <fd_get_lock@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fd_get_readw_lock>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
mov    0x2eb0(%rip),%rax
mov    (%rax),%edx
jmp    1030 <fd_get_lock@plt>

LLVM IR (-O0):
@F_SETLKW = global i32 0
@F_RDLCK = global i32 0
define i32 @fd_get_readw_lock(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @F_SETLKW
%5 = load i32, i32* @F_RDLCK
%6 = call i32 @fd_get_lock(i32 %3, i32 %4, i32 %5)
ret i32 %6
}

LLVM IR (-O2):
@F_SETLKW = global i32 0
@F_RDLCK = global i32 0
define i32 @fd_get_readw_lock(i32 %0) {
%2 = load i32, i32* @F_SETLKW
%3 = load i32, i32* @F_RDLCK
%4 = tail call i32 @fd_get_lock(i32 %0, i32 %2, i32 %3)
ret i32 %4
}
int unitNeighbours(const int radius) {
  return (radius * 2 + 1) * (radius * 2 + 1);
}


x86 assembly (clang, -O0):
<unitNeighbours>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
imul   %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<unitNeighbours>:
lea    (%rdi,%rdi,1),%eax
add    $0x1,%eax
imul   %eax,%eax
ret

LLVM IR (-O0):
define i32 @unitNeighbours(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 2
%5 = add nsw i32 %4, 1
%6 = load i32, i32* %2
%7 = mul nsw i32 %6, 2
%8 = add nsw i32 %7, 1
%9 = mul nsw i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @unitNeighbours(i32 %0) {
%2 = shl nsw i32 %0, 1
%3 = or i32 %2, 1
%4 = mul nsw i32 %3, %3
ret i32 %4
}
/* Variables and functions */
char *strchr(char *, char);
char *get_name(char **line) {
  char *name = *line;
  char *p = strchr(name, ',');
  *p = '\0';
  *line = p + 1;
  return name;
}


x86 assembly (clang, -O0):
<get_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2c,%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rcx
add    $0x1,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_name>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%r14
mov    %r14,%rdi
mov    $0x2c,%esi
call   1030 <strchr@plt>
movb   $0x0,(%rax)
add    $0x1,%rax
mov    %rax,(%rbx)
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @get_name(i8** %0) {
%2 = alloca i8**
%3 = alloca i8*
%4 = alloca i8*
store i8** %0, i8*** %2
%5 = load i8**, i8*** %2
%6 = load i8*, i8** %5
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = call i8* @strchr(i8* %7, i8 signext 44)
store i8* %8, i8** %4
%9 = load i8*, i8** %4
store i8 0, i8* %9
%10 = load i8*, i8** %4
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8**, i8*** %2
store i8* %11, i8** %12
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
define i8* @get_name(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i8* @strchr(i8* dereferenceable(1) %2, i8 signext 44)
store i8 0, i8* %3
%4 = getelementptr inbounds i8, i8* %3, i64 1
store i8* %4, i8** %0
ret i8* %2
}
/* Variables and functions */
double atan2(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ luaL_check_number(int);
int /*<<< orphan*/ lua_pushnumber(double);
void math_atan2(void) {
  lua_pushnumber(((atan2(luaL_check_number(1), luaL_check_number(2))) *
                  (180.0 / ((double)3.14159265358979323846))));
}


x86 assembly (clang, -O0):
<math_atan2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
call   1040 <luaL_check_number@plt>
mov    %eax,-0x4(%rbp)
mov    $0x2,%edi
call   1040 <luaL_check_number@plt>
mov    -0x4(%rbp),%edi
mov    %eax,%esi
call   1030 <atan2@plt>
movsd  0xe9f(%rip),%xmm1
mulsd  %xmm1,%xmm0
call   1050 <lua_pushnumber@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<math_atan2>:
push   %rbx
mov    $0x1,%edi
call   1040 <luaL_check_number@plt>
mov    %eax,%ebx
mov    $0x2,%edi
call   1040 <luaL_check_number@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1030 <atan2@plt>
mulsd  0xea8(%rip),%xmm0
pop    %rbx
jmp    1050 <lua_pushnumber@plt>

LLVM IR (-O0):
define void @math_atan2() {
%1 = call i32 @luaL_check_number(i32 1)
%2 = call i32 @luaL_check_number(i32 2)
%3 = call double @atan2(i32 %1, i32 %2)
%4 = fmul double %3, 0x404CA5DC1A63C1F8
%5 = call i32 @lua_pushnumber(double %4)
ret void
}

LLVM IR (-O2):
define void @math_atan2() {
%1 = tail call i32 @luaL_check_number(i32 1)
%2 = tail call i32 @luaL_check_number(i32 2)
%3 = tail call double @atan2(i32 %1, i32 %2)
%4 = fmul double %3, 0x404CA5DC1A63C1F8
%5 = tail call i32 @lua_pushnumber(double %4)
ret void
}
void asm_cpuid(void) { asm volatile("cpuid" ::: "rax", "rbx", "rcx", "rdx"); }


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

x86 assembly (clang, -O2):
<asm_cpuid>:
push   %rbx
cpuid
pop    %rbx
ret

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

LLVM IR (-O2):
define void @asm_cpuid() {
tail call void asm sideeffect "cpuid", "~{rax},~{rbx},~{rcx},~{rdx},~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, float *);
float readSensor(char *url) {
  FILE *arq;
  float back;
  arq = fopen(url, "r+");
  if (arq != NULL) {
    fscanf(arq, "%f\n", &back);
    fclose(arq);
  }
  return back;
}


x86 assembly (clang, -O0):
<readSensor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1178 <readSensor+0x48>
mov    -0x10(%rbp),%rdi
lea    0xe9d(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1040 <fscanf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
movss  -0x14(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readSensor>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     116d <readSensor+0x3d>
mov    %rax,%rbx
lea    0xeb3(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %rax,%rdi
call   1040 <fscanf@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
movss  0xc(%rsp),%xmm0
jmp    116d <readSensor+0x3d>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"r+\00"
@.str.1 = [4 x i8] c"%f\0A\00"
define float @readSensor(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca float
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %6, i32** %3
%7 = load i32*, i32** %3
%8 = icmp ne i32* %7, null
br i1 %8, label %9, label %14
9: ; preds = %1
%10 = load i32*, i32** %3
%11 = call i32 @fscanf(i32* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float* %4)
%12 = load i32*, i32** %3
%13 = call i32 @fclose(i32* %12)
br label %14
14: ; preds = %9, %1
%15 = load float, float* %4
ret float %15
}

LLVM IR (-O2):
@.str = [3 x i8] c"r+\00"
@.str.1 = [4 x i8] c"%f\0A\00"
define float @readSensor(i8* nocapture %0) {
%2 = alloca float
%3 = bitcast float* %2 to i8*
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = call i32 @fscanf(i32* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float* %2)
%8 = call i32 @fclose(i32* %4)
%9 = load float, float* %2
br label %10
10: ; preds = %6, %1
%11 = phi float [ %9, %6 ], [ undef, %1 ]
ret float %11
}
unsigned long string_length(const char *s) {
  unsigned long i = 0;
  for (; *s != '\0'; ++i) {
    ;
  }
  return i;
}


x86 assembly (clang, -O0):
<string_length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1136 <string_length+0x36>
jmp    1125 <string_length+0x25>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <string_length+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @string_length(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
store i64 0, i64* %3
br label %4
4: ; preds = %10, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %4
br label %10
10: ; preds = %9
%11 = load i64, i64* %3
%12 = add i64 %11, 1
store i64 %12, i64* %3
br label %4
13: ; preds = %4
%14 = load i64, i64* %3
ret i64 %14
}

LLVM IR (-O2):
define i64 @string_length(i8* nocapture %0) {
ret i64 0
}
/* Type definitions */
struct mngmsg {
  int dummy;
};
struct beststr {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char *build_link_data(char **link_lib_file_p, struct mngmsg *m_msp,
                      struct beststr **bestp_arr, int debug) {
  int i, status;
  char tmp_line[32];
  char link_acc_file[512];
  int link_acc_fd;
  char *link_lib_file;
  char *link_lib_str;
  char link_script[4096];
  int link_lib_type;
  char *bp, *link_bp;
  FILE *link_fd = NULL;
  return NULL;
}


x86 assembly (clang, -O0):
<build_link_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1210,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movq   $0x0,-0x1290(%rbp)
xor    %eax,%eax
add    $0x1210,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.mngmsg = type { i32 }
%struct.beststr = type { i32 }
define i8* @build_link_data(i8** %0, %struct.mngmsg* %1, %struct.beststr** %2, i32 %3) {
%5 = alloca i8**
%6 = alloca %struct.mngmsg*
%7 = alloca %struct.beststr**
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca [32 x i8]
%12 = alloca [512 x i8]
%13 = alloca i32
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca [4096 x i8]
%17 = alloca i32
%18 = alloca i8*
%19 = alloca i8*
%20 = alloca i32*
store i8** %0, i8*** %5
store %struct.mngmsg* %1, %struct.mngmsg** %6
store %struct.beststr** %2, %struct.beststr*** %7
store i32 %3, i32* %8
store i32* null, i32** %20
ret i8* null
}

LLVM IR (-O2):
%struct.mngmsg = type { i32 }
%struct.beststr = type { i32 }
define noalias i8* @build_link_data(i8** nocapture readnone %0, %struct.mngmsg* nocapture readnone %1, %struct.beststr** nocapture readnone %2, i32 %3) {
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ TOSH_CLR_ADC5_PIN();
int /*<<< orphan*/ TOSH_MAKE_ADC5_INPUT();
int /*<<< orphan*/ TOSH_MAKE_ADC5_OUTPUT();
unsigned char TOSH_READ_ADC5_PIN();
int /*<<< orphan*/ TOSH_uwait(int);
unsigned char ds2751_init(void) {
  unsigned char presence;
  TOSH_MAKE_ADC5_OUTPUT();
  TOSH_CLR_ADC5_PIN();
  TOSH_uwait(300);
  TOSH_MAKE_ADC5_INPUT();
  TOSH_uwait(40);
  presence = TOSH_READ_ADC5_PIN();
  TOSH_uwait(250);
  return !presence;
}


x86 assembly (clang, -O0):
<ds2751_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <TOSH_MAKE_ADC5_OUTPUT@plt>
mov    $0x0,%al
call   1060 <TOSH_CLR_ADC5_PIN@plt>
mov    $0x12c,%edi
call   1070 <TOSH_uwait@plt>
mov    $0x0,%al
call   1030 <TOSH_MAKE_ADC5_INPUT@plt>
mov    $0x28,%edi
call   1070 <TOSH_uwait@plt>
mov    $0x0,%al
call   1050 <TOSH_READ_ADC5_PIN@plt>
mov    %al,-0x1(%rbp)
mov    $0xfa,%edi
call   1070 <TOSH_uwait@plt>
cmpb   $0x0,-0x1(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ds2751_init>:
push   %rbx
xor    %eax,%eax
call   1040 <TOSH_MAKE_ADC5_OUTPUT@plt>
xor    %eax,%eax
call   1060 <TOSH_CLR_ADC5_PIN@plt>
mov    $0x12c,%edi
call   1070 <TOSH_uwait@plt>
xor    %eax,%eax
call   1030 <TOSH_MAKE_ADC5_INPUT@plt>
mov    $0x28,%edi
call   1070 <TOSH_uwait@plt>
xor    %eax,%eax
call   1050 <TOSH_READ_ADC5_PIN@plt>
mov    %eax,%ebx
mov    $0xfa,%edi
call   1070 <TOSH_uwait@plt>
test   %bl,%bl
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
define zeroext i8 @ds2751_init() {
%1 = alloca i8
%2 = call i32 (...) @TOSH_MAKE_ADC5_OUTPUT()
%3 = call i32 (...) @TOSH_CLR_ADC5_PIN()
%4 = call i32 @TOSH_uwait(i32 300)
%5 = call i32 (...) @TOSH_MAKE_ADC5_INPUT()
%6 = call i32 @TOSH_uwait(i32 40)
%7 = call zeroext i8 (...) @TOSH_READ_ADC5_PIN()
store i8 %7, i8* %1
%8 = call i32 @TOSH_uwait(i32 250)
%9 = load i8, i8* %1
%10 = icmp ne i8 %9, 0
%11 = xor i1 %10, true
%12 = zext i1 %11 to i32
%13 = trunc i32 %12 to i8
ret i8 %13
}

LLVM IR (-O2):
define zeroext i8 @ds2751_init() {
%1 = tail call i32 (...) @TOSH_MAKE_ADC5_OUTPUT()
%2 = tail call i32 (...) @TOSH_CLR_ADC5_PIN()
%3 = tail call i32 @TOSH_uwait(i32 300)
%4 = tail call i32 (...) @TOSH_MAKE_ADC5_INPUT()
%5 = tail call i32 @TOSH_uwait(i32 40)
%6 = tail call zeroext i8 (...) @TOSH_READ_ADC5_PIN()
%7 = tail call i32 @TOSH_uwait(i32 250)
%8 = icmp eq i8 %6, 0
%9 = zext i1 %8 to i8
ret i8 %9
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ stderr;
void bad_option(char **argv, int badopt) {
  fprintf(stderr, "%s: unknown or incorrectly used option \"%s\".\n", argv[0],
          argv[badopt]);
}


x86 assembly (clang, -O0):
<bad_option>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xebe(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bad_option>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%eax
mov    (%rdi),%rdx
movslq %esi,%rcx
mov    (%rdi,%rcx,8),%rcx
lea    0xed6(%rip),%rsi
mov    %eax,%edi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [46 x i8] c"%s: unknown or incorrectly used option \22%s\22.\0A\00"
define void @bad_option(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
store i8** %0, i8*** %3
store i32 %1, i32* %4
%5 = load i32, i32* @stderr
%6 = load i8**, i8*** %3
%7 = getelementptr inbounds i8*, i8** %6, i64 0
%8 = load i8*, i8** %7
%9 = load i8**, i8*** %3
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8*, i8** %9, i64 %11
%13 = load i8*, i8** %12
%14 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %13)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [46 x i8] c"%s: unknown or incorrectly used option \22%s\22.\0A\00"
define void @bad_option(i8** nocapture %0, i32 %1) {
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %0
%5 = sext i32 %1 to i64
%6 = getelementptr inbounds i8*, i8** %0, i64 %5
%7 = load i8*, i8** %6
%8 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %7)
ret void
}
unsigned short swapBytes16(unsigned short x) { return (x >> 8) | (x << 8); }


x86 assembly (clang, -O0):
<swapBytes16>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
sar    $0x8,%eax
movzwl -0x2(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swapBytes16>:
mov    %edi,%eax
rol    $0x8,%ax
ret

LLVM IR (-O0):
define zeroext i16 @swapBytes16(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 = load i16, i16* %2
%7 = zext i16 %6 to i32
%8 = shl i32 %7, 8
%9 = or i32 %5, %8
%10 = trunc i32 %9 to i16
ret i16 %10
}

LLVM IR (-O2):
define zeroext i16 @swapBytes16(i16 zeroext %0) {
%2 = tail call i16 @llvm.bswap.i16(i16 %0)
ret i16 %2
}
/* Variables and functions */
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ test();
int main(int argc, char **argv) {
  if (argc == 2 && strcmp(argv[1], "test") == 0)
    test();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    1165 <main+0x45>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xeb1(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1165 <main+0x45>
mov    $0x0,%al
call   1040 <test@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1142 <main+0x22>
mov    0x8(%rsi),%rdi
lea    0xecf(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    1142 <main+0x22>
xor    %eax,%eax
call   1040 <test@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"test\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = tail call i32 (...) @test()
br label %11
11: ; preds = %9, %4, %2
ret i32 0
}
int foo1() { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @foo1() {
ret i32 1
}