xunge/DecIR huggingface dataset:
int swap_bits(int n, int i, int j) {
  if (((n >> i) & 1) ^ ((n >> j) & 1)) {
    return n ^ ((1 << i) | (1 << j));
  }
  return n;
}


x86 assembly (clang, -O0):
<swap_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%ecx
sar    %cl,%edx
mov    %edx,%ecx
and    $0x1,%ecx
xor    %ecx,%eax
cmp    $0x0,%eax
je     1159 <swap_bits+0x59>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    -0x14(%rbp),%ecx
or     %edx,%ecx
xor    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    115f <swap_bits+0x5f>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_bits>:
mov    %edi,%eax
mov    %esi,%ecx
shr    %cl,%eax
mov    %edx,%ecx
mov    %edi,%edx
shr    %cl,%edx
xor    %eax,%edx
and    $0x1,%edx
mov    $0x1,%eax
shl    %cl,%eax
neg    %edx
bts    %esi,%eax
and    %edx,%eax
xor    %edi,%eax
ret

LLVM IR (-O0):
define i32 @swap_bits(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = ashr i32 %8, %9
%11 = and i32 %10, 1
%12 = load i32, i32* %5
%13 = load i32, i32* %7
%14 = ashr i32 %12, %13
%15 = and i32 %14, 1
%16 = xor i32 %11, %15
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %26
18: ; preds = %3
%19 = load i32, i32* %5
%20 = load i32, i32* %6
%21 = shl i32 1, %20
%22 = load i32, i32* %7
%23 = shl i32 1, %22
%24 = or i32 %21, %23
%25 = xor i32 %19, %24
store i32 %25, i32* %4
br label %28
26: ; preds = %3
%27 = load i32, i32* %5
store i32 %27, i32* %4
br label %28
28: ; preds = %26, %18
%29 = load i32, i32* %4
ret i32 %29
}

LLVM IR (-O2):
define i32 @swap_bits(i32 %0, i32 %1, i32 %2) {
%4 = lshr i32 %0, %1
%5 = lshr i32 %0, %2
%6 = xor i32 %5, %4
%7 = and i32 %6, 1
%8 = icmp eq i32 %7, 0
%9 = shl nuw i32 1, %1
%10 = shl nuw i32 1, %2
%11 = or i32 %10, %9
%12 = select i1 %8, i32 0, i32 %11
%13 = xor i32 %12, %0
ret i32 %13
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int send_event;
};
typedef TYPE_1__ XAnyEvent;

/* Variables and functions */
void set_XAnyEvent_send_event(void *_p, int _v) {
  ((XAnyEvent *)_p)->send_event = (int)_v;
}


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

x86 assembly (clang, -O2):
<set_XAnyEvent_send_event>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define void @set_XAnyEvent_send_event(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @set_XAnyEvent_send_event(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ delete_line(int);
scalar_t__ is_range_in_range(int, int);
void delete_lines(int start, int end) {
  int i;
  if (is_range_in_range(start, end)) {
    for (i = start; i <= end; i++) {
      delete_line(start);
    }
  }
}


x86 assembly (clang, -O0):
<delete_lines>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <is_range_in_range@plt>
cmp    $0x0,%rax
je     1170 <delete_lines+0x50>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     116b <delete_lines+0x4b>
mov    -0x4(%rbp),%edi
call   1040 <delete_line@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1149 <delete_lines+0x29>
jmp    1170 <delete_lines+0x50>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delete_lines>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1030 <is_range_in_range@plt>
test   %rax,%rax
je     114e <delete_lines+0x2e>
cmp    %ebx,%ebp
jg     114e <delete_lines+0x2e>
add    $0x1,%ebx
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1040 <delete_line@plt>
add    $0xffffffff,%ebx
cmp    %ebx,%ebp
jne    1140 <delete_lines+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @delete_lines(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
%7 = load i32, i32* %4
%8 = call i64 @is_range_in_range(i32 %6, i32 %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %23
10: ; preds = %2
%11 = load i32, i32* %3
store i32 %11, i32* %5
br label %12
12: ; preds = %19, %10
%13 = load i32, i32* %5
%14 = load i32, i32* %4
%15 = icmp sle i32 %13, %14
br i1 %15, label %16, label %22
16: ; preds = %12
%17 = load i32, i32* %3
%18 = call i32 @delete_line(i32 %17)
br label %19
19: ; preds = %16
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %12
22: ; preds = %12
br label %23
23: ; preds = %22, %2
ret void
}

LLVM IR (-O2):
define void @delete_lines(i32 %0, i32 %1) {
%3 = tail call i64 @is_range_in_range(i32 %0, i32 %1)
%4 = icmp eq i64 %3, 0
%5 = icmp sgt i32 %0, %1
%6 = or i1 %4, %5
br i1 %6, label %12, label %7
7: ; preds = %2, %7
%8 = phi i32 [ %10, %7 ], [ %0, %2 ]
%9 = tail call i32 @delete_line(i32 %0)
%10 = add i32 %8, 1
%11 = icmp eq i32 %8, %1
br i1 %11, label %12, label %7
12: ; preds = %7, %2
ret void
}
int radtodeg(float rad) {
  int ret = (int)(rad * 180.f / 3.14159f);
  if (ret < 0)
    ret += 360;
  return ret;
}


x86 assembly (clang, -O0):
<radtodeg>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xef3(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  0xee2(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    113e <radtodeg+0x3e>
mov    -0x8(%rbp),%eax
add    $0x168,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<radtodeg>:
mulss  0xef8(%rip),%xmm0
divss  0xef4(%rip),%xmm0
cvttss2si %xmm0,%ecx
lea    0x168(%rcx),%eax
test   %ecx,%ecx
cmovns %ecx,%eax
ret

LLVM IR (-O0):
define i32 @radtodeg(float %0) {
%2 = alloca float
%3 = alloca i32
store float %0, float* %2
%4 = load float, float* %2
%5 = fmul float %4, 1.800000e+02
%6 = fdiv float %5, 0x400921FA00000000
%7 = fptosi float %6 to i32
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %1
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 360
store i32 %12, i32* %3
br label %13
13: ; preds = %10, %1
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @radtodeg(float %0) {
%2 = fmul float %0, 1.800000e+02
%3 = fdiv float %2, 0x400921FA00000000
%4 = fptosi float %3 to i32
%5 = icmp slt i32 %4, 0
%6 = add nsw i32 %4, 360
%7 = select i1 %5, i32 %6, i32 %4
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ interrupt(int, int, int /*<<< orphan*/, int /*<<< orphan*/,
                             int /*<<< orphan*/);
int /*<<< orphan*/ putInMemory(int, int, int);
void clearScreen() {
  int start;
  int i;
  start = 0x8000;
  for (i = 0; i < 25 * 80; i++) {
    putInMemory(0xB000, start, ' ');
    putInMemory(0xB000, start + 1, 0x7);
    start += 2;
  }
  interrupt(0x10, 2 * 256, 0, 0, 0);
}


x86 assembly (clang, -O0):
<clearScreen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x8000,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x7d0,-0x8(%rbp)
jge    1181 <clearScreen+0x61>
mov    -0x4(%rbp),%esi
mov    $0xb000,%edi
mov    $0x20,%edx
call   1030 <putInMemory@plt>
mov    -0x4(%rbp),%esi
add    $0x1,%esi
mov    $0xb000,%edi
mov    $0x7,%edx
call   1030 <putInMemory@plt>
mov    -0x4(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <clearScreen+0x16>
mov    $0x10,%edi
mov    $0x200,%esi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1040 <interrupt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clearScreen>:
push   %rbx
mov    $0x8000,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    $0xb000,%edi
mov    %ebx,%esi
mov    $0x20,%edx
call   1030 <putInMemory@plt>
lea    0x1(%rbx),%esi
mov    $0xb000,%edi
mov    $0x7,%edx
call   1030 <putInMemory@plt>
lea    0x2(%rbx),%eax
cmp    $0x8f9e,%ebx
mov    %eax,%ebx
jne    1130 <clearScreen+0x10>
mov    $0x10,%edi
mov    $0x200,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
pop    %rbx
jmp    1040 <interrupt@plt>

LLVM IR (-O0):
define void @clearScreen() {
%1 = alloca i32
%2 = alloca i32
store i32 32768, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %14, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 2000
br i1 %5, label %6, label %17
6: ; preds = %3
%7 = load i32, i32* %1
%8 = call i32 @putInMemory(i32 45056, i32 %7, i32 32)
%9 = load i32, i32* %1
%10 = add nsw i32 %9, 1
%11 = call i32 @putInMemory(i32 45056, i32 %10, i32 7)
%12 = load i32, i32* %1
%13 = add nsw i32 %12, 2
store i32 %13, i32* %1
br label %14
14: ; preds = %6
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %3
17: ; preds = %3
%18 = call i32 @interrupt(i32 16, i32 512, i32 0, i32 0, i32 0)
ret void
}

LLVM IR (-O2):
define void @clearScreen() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %8, %1 ]
%3 = phi i32 [ 32768, %0 ], [ %7, %1 ]
%4 = tail call i32 @putInMemory(i32 45056, i32 %3, i32 32)
%5 = or i32 %3, 1
%6 = tail call i32 @putInMemory(i32 45056, i32 %5, i32 7)
%7 = add nuw nsw i32 %3, 2
%8 = add nuw nsw i32 %2, 1
%9 = icmp eq i32 %8, 2000
br i1 %9, label %10, label %1
10: ; preds = %1
%11 = tail call i32 @interrupt(i32 16, i32 512, i32 0, i32 0, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ UART_UartInit();
void UART_Init(void) { UART_UartInit(); }


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

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

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

LLVM IR (-O2):
define void @UART_Init() {
%1 = tail call i32 (...) @UART_UartInit()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _exit(int);
int /*<<< orphan*/ write(int, char *, int);
void abort(void) {
  write(2, "Abort called.\n", sizeof("Abort called.\n") - 1);
  _exit(1);
}


x86 assembly (clang, -O0):
<abort>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
lea    0xed0(%rip),%rsi
mov    $0xe,%edx
call   1040 <write@plt>
mov    $0x1,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<abort>:
push   %rax
lea    0xed8(%rip),%rsi
mov    $0x2,%edi
mov    $0xe,%edx
call   1040 <write@plt>
mov    $0x1,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"Abort called.\0A\00"
define void @abort() {
%1 = call i32 @write(i32 2, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 14)
%2 = call i32 @_exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [15 x i8] c"Abort called.\0A\00"
define void @abort() {
%1 = tail call i32 @write(i32 2, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 14)
%2 = tail call i32 @_exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int makeDirectory(char *dir) {
  printf("mkdir(%s)\n", dir);
  return 0;
}


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

x86 assembly (clang, -O2):
<makeDirectory>:
push   %rax
mov    %rdi,%rsi
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"mkdir(%s)\0A\00"
define i32 @makeDirectory(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"mkdir(%s)\0A\00"
define i32 @makeDirectory(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 0
}
int nnint(double x) {
  long int lrint(double x);
  return (int)lrint(x);
}


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

x86 assembly (clang, -O2):
<nnint>:
jmp    1030 <lrint@plt>

LLVM IR (-O0):
define i32 @nnint(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i64 @lrint(double %3)
%5 = trunc i64 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @nnint(double %0) {
%2 = tail call i64 @lrint(double %0)
%3 = trunc i64 %2 to i32
ret i32 %3
}
void QEIVelocityEnable(unsigned long ulBase) {
  ;
  (*((volatile unsigned long *)(ulBase + 0x00000000))) |= 0x00000020;
}


x86 assembly (clang, -O0):
<QEIVelocityEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
or     $0x20,%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<QEIVelocityEnable>:
orq    $0x20,(%rdi)
ret

LLVM IR (-O0):
define void @QEIVelocityEnable(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add i64 %3, 0
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
%7 = or i64 %6, 32
store volatile i64 %7, i64* %5
ret void
}

LLVM IR (-O2):
define void @QEIVelocityEnable(i64 %0) {
%2 = inttoptr i64 %0 to i64*
%3 = load volatile i64, i64* %2
%4 = or i64 %3, 32
store volatile i64 %4, i64* %2
ret void
}
/* Variables and functions */
bool is_lower(const char c) { return c >= 'a' && c <= 'z'; }


x86 assembly (clang, -O0):
<is_lower>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x61,%ecx
mov    %al,-0x2(%rbp)
jl     1129 <is_lower+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x7a,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_lower>:
add    $0x9f,%dil
xor    %eax,%eax
cmp    $0x1a,%dil
setb   %al
ret

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

LLVM IR (-O2):
define i32 @is_lower(i8 signext %0) {
%2 = add i8 %0, -97
%3 = icmp ult i8 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
int compareStrings(void *value1, void *value2) { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @compareStrings(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 -1
}
int del(int x, int y) { return x - y; }


x86 assembly (clang, -O0):
<del>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @del(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 = sub nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @del(i32 %0, i32 %1) {
%3 = sub nsw i32 %0, %1
ret i32 %3
}
void g_param_spec_override() {}


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

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

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

LLVM IR (-O2):
define void @g_param_spec_override() {
ret void
}
/* Variables and functions */
int SPI_In();
int /*<<< orphan*/ SPI_Out(int);
int readdata(int addr) {
  SPI_Out(0x05 | ((addr >> 5) & 0xF8));
  SPI_Out(addr & 0xFF);
  return SPI_In();
}


x86 assembly (clang, -O0):
<readdata>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
sar    $0x5,%edi
and    $0xf8,%edi
or     $0x5,%edi
call   1040 <SPI_Out@plt>
mov    -0x4(%rbp),%edi
and    $0xff,%edi
call   1040 <SPI_Out@plt>
mov    $0x0,%al
call   1030 <SPI_In@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readdata>:
push   %rbx
mov    %edi,%ebx
shr    $0x5,%edi
and    $0xf8,%edi
or     $0x5,%edi
call   1040 <SPI_Out@plt>
movzbl %bl,%edi
call   1040 <SPI_Out@plt>
xor    %eax,%eax
pop    %rbx
jmp    1030 <SPI_In@plt>

LLVM IR (-O0):
define i32 @readdata(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 5
%5 = and i32 %4, 248
%6 = or i32 5, %5
%7 = call i32 @SPI_Out(i32 %6)
%8 = load i32, i32* %2
%9 = and i32 %8, 255
%10 = call i32 @SPI_Out(i32 %9)
%11 = call i32 (...) @SPI_In()
ret i32 %11
}

LLVM IR (-O2):
define i32 @readdata(i32 %0) {
%2 = lshr i32 %0, 5
%3 = and i32 %2, 248
%4 = or i32 %3, 5
%5 = tail call i32 @SPI_Out(i32 %4)
%6 = and i32 %0, 255
%7 = tail call i32 @SPI_Out(i32 %6)
%8 = tail call i32 (...) @SPI_In()
ret i32 %8
}
int main(void) {
  int x = 10, *p = &x;
  return *p + *p + *p + *p + *p + *p;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
add    (%rcx),%eax
mov    -0x10(%rbp),%rcx
add    (%rcx),%eax
mov    -0x10(%rbp),%rcx
add    (%rcx),%eax
mov    -0x10(%rbp),%rcx
add    (%rcx),%eax
mov    -0x10(%rbp),%rcx
add    (%rcx),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 60
}
/* Variables and functions */
double const log(double);
double mag2dB(double lin) {
  const double LOG_2_DB = 8.6858896380650365530225783783321;
  return log(lin) * LOG_2_DB;
}


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

x86 assembly (clang, -O2):
<mag2dB>:
push   %rax
call   1030 <log@plt>
mulsd  0xee2(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @mag2dB(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
store double 0x40215F2CED384F29, double* %3
%4 = load double, double* %2
%5 = call double @log(double %4)
%6 = fmul double %5, 0x40215F2CED384F29
ret double %6
}

LLVM IR (-O2):
define double @mag2dB(double %0) {
%2 = tail call double @log(double %0)
%3 = fmul double %2, 0x40215F2CED384F29
ret double %3
}
/* Variables and functions */
double *malloc(int);
extern double *ReturnADoubleArray() {
  double *foo = malloc(3 * sizeof(double));
  foo[0] = 23.45;
  foo[1] = -99.87;
  foo[2] = 0.25;
  return foo;
}


x86 assembly (clang, -O0):
<ReturnADoubleArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x18,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xede(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0xec6(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movsd  0xead(%rip),%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReturnADoubleArray>:
push   %rax
mov    $0x18,%edi
call   1030 <malloc@plt>
movaps 0xede(%rip),%xmm0
movups %xmm0,(%rax)
movabs $0x3fd0000000000000,%rcx
mov    %rcx,0x10(%rax)
pop    %rcx
ret

LLVM IR (-O0):
define double* @ReturnADoubleArray() {
%1 = alloca double*
%2 = call double* @malloc(i32 24)
store double* %2, double** %1
%3 = load double*, double** %1
%4 = getelementptr inbounds double, double* %3, i64 0
store double 2.345000e+01, double* %4
%5 = load double*, double** %1
%6 = getelementptr inbounds double, double* %5, i64 1
store double -9.987000e+01, double* %6
%7 = load double*, double** %1
%8 = getelementptr inbounds double, double* %7, i64 2
store double 2.500000e-01, double* %8
%9 = load double*, double** %1
ret double* %9
}

LLVM IR (-O2):
define noalias double* @ReturnADoubleArray() {
%1 = tail call double* @malloc(i32 24)
%2 = bitcast double* %1 to <2 x double>*
store <2 x double> <double 2.345000e+01, double -9.987000e+01>, <2 x double>* %2
%3 = getelementptr inbounds double, double* %1, i64 2
store double 2.500000e-01, double* %3
ret double* %1
}
/* Variables and functions */
int /*<<< orphan*/ scrprintf(char *, int);
void csrleft(int n) { scrprintf("\033[%dC", n); }


x86 assembly (clang, -O0):
<csrleft>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <scrprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<csrleft>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <scrprintf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"\1B[%dC\00"
define void @csrleft(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @scrprintf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"\1B[%dC\00"
define void @csrleft(i32 %0) {
%2 = tail call i32 @scrprintf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int tracepoint_probe_unregister(char *, void *);
__attribute__((always_)) int unregister_trace_mm_page_alloc_zone_locked(
    void (*probe)(struct page *page, unsigned int order, int migratetype)) {
  return tracepoint_probe_unregister("mm_page_alloc_zone_locked",
                                     (void *)probe);
}


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

x86 assembly (clang, -O2):
<unregister_trace_mm_page_alloc_zone_locked>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <tracepoint_probe_unregister@plt>

LLVM IR (-O0):
%struct.page = type opaque
@.str = [26 x i8] c"mm_page_alloc_zone_locked\00"
define i32 @unregister_trace_mm_page_alloc_zone_locked(void (%struct.page*, i32, i32)* %0) {
%2 = alloca void (%struct.page*, i32, i32)*
store void (%struct.page*, i32, i32)* %0, void (%struct.page*, i32, i32)** %2
%3 = load void (%struct.page*, i32, i32)*, void (%struct.page*, i32, i32)** %2
%4 = bitcast void (%struct.page*, i32, i32)* %3 to i8*
%5 = call i32 @tracepoint_probe_unregister(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 %5
}

LLVM IR (-O2):
%struct.page = type opaque
@.str = [26 x i8] c"mm_page_alloc_zone_locked\00"
define i32 @unregister_trace_mm_page_alloc_zone_locked(void (%struct.page*, i32, i32)* %0) {
%2 = bitcast void (%struct.page*, i32, i32)* %0 to i8*
%3 = tail call i32 @tracepoint_probe_unregister(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ ES_archivo();
int main(int argc, char **argv) {
  ES_archivo();
  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)
mov    $0x0,%al
call   1030 <ES_archivo@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @ES_archivo()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ u_int8_t;

/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(char *, char *, int);
u_int8_t *swr_fill_str(char *str, int len) {
  u_int8_t *retval = NULL;
  retval = (u_int8_t *)malloc(sizeof(u_int8_t) * len);
  if (retval != NULL) {
    memcpy((char *)retval, str, len);
  }
  return retval;
}


x86 assembly (clang, -O0):
<swr_fill_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1165 <swr_fill_str+0x45>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32* @swr_fill_str(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32*
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32* null, i32** %5
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = mul i64 4, %7
%9 = trunc i64 %8 to i32
%10 = call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to i32*
store i32* %11, i32** %5
%12 = load i32*, i32** %5
%13 = icmp ne i32* %12, null
br i1 %13, label %14, label %20
14: ; preds = %2
%15 = load i32*, i32** %5
%16 = bitcast i32* %15 to i8*
%17 = load i8*, i8** %3
%18 = load i32, i32* %4
%19 = call i32 @memcpy(i8* %16, i8* %17, i32 %18)
br label %20
20: ; preds = %14, %2
%21 = load i32*, i32** %5
ret i32* %21
}

LLVM IR (-O2):
define i32* @swr_fill_str(i8* %0, i32 %1) {
%3 = shl i32 %1, 2
%4 = tail call i64 @malloc(i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = inttoptr i64 %4 to i8*
%8 = tail call i32 @memcpy(i8* %7, i8* %0, i32 %1)
br label %9
9: ; preds = %6, %2
%10 = inttoptr i64 %4 to i32*
ret i32* %10
}
/* Variables and functions */
int /*<<< orphan*/ _FPU_GETCW(unsigned int);
int /*<<< orphan*/ _FPU_SETCW(unsigned int);
int fesetround(int round) {
  unsigned int cw;
  if ((round & ~0x3) != 0)
    return 0;
  _FPU_GETCW(cw);
  cw &= ~0x3;
  cw |= round;
  _FPU_SETCW(cw);
  return 1;
}


x86 assembly (clang, -O0):
<fesetround>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xfffffffc,%eax
cmp    $0x0,%eax
je     1146 <fesetround+0x26>
movl   $0x0,-0x4(%rbp)
jmp    116f <fesetround+0x4f>
mov    -0xc(%rbp),%edi
call   1030 <_FPU_GETCW@plt>
mov    -0xc(%rbp),%eax
and    $0xfffffffc,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <_FPU_SETCW@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fesetround>:
xor    %eax,%eax
cmp    $0x3,%edi
ja     113c <fesetround+0x1c>
push   %rbx
mov    %edi,%ebx
call   1030 <_FPU_GETCW@plt>
mov    %ebx,%edi
call   1040 <_FPU_SETCW@plt>
mov    $0x1,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @fesetround(i32 %0) {
%2 = icmp ult i32 %0, 4
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i32 @_FPU_GETCW(i32 undef)
%5 = tail call i32 @_FPU_SETCW(i32 %0)
br label %6
6: ; preds = %1, %3
%7 = phi i32 [ 1, %3 ], [ 0, %1 ]
ret i32 %7
}
int returni10() { return 10; }


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

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

LLVM IR (-O0):
define i32 @returni10() {
ret i32 10
}

LLVM IR (-O2):
define i32 @returni10() {
ret i32 10
}
/* Variables and functions */
int get_mem(int);
int is_colour_only() { return get_mem(0x143) == 0xC0; }


x86 assembly (clang, -O0):
<is_colour_only>:
push   %rbp
mov    %rsp,%rbp
mov    $0x143,%edi
call   1030 <get_mem@plt>
cmp    $0xc0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_colour_only>:
push   %rax
mov    $0x143,%edi
call   1030 <get_mem@plt>
xor    %ecx,%ecx
cmp    $0xc0,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @is_colour_only() {
%1 = call i32 @get_mem(i32 323)
%2 = icmp eq i32 %1, 192
%3 = zext i1 %2 to i32
ret i32 %3
}

LLVM IR (-O2):
define i32 @is_colour_only() {
%1 = tail call i32 @get_mem(i32 323)
%2 = icmp eq i32 %1, 192
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int);
void get_fname(char *fname, int rank) { sprintf(fname, "out/%d", rank); }


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

x86 assembly (clang, -O2):
<get_fname>:
mov    %esi,%edx
lea    0xee7(%rip),%rsi
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"out/%d\00"
define void @get_fname(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"out/%d\00"
define void @get_fname(i8* nocapture writeonly %0, i32 %1) {
%3 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
int BARRAY_cmp_return(unsigned long a, unsigned long b) {
  return (b + (b < 0 ? -a * 32 : b > 0 ? a * 32 : 0));
}


x86 assembly (clang, -O0):
<BARRAY_cmp_return>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jae    1132 <BARRAY_cmp_return+0x32>
xor    %eax,%eax
sub    -0x8(%rbp),%rax
shl    $0x5,%rax
mov    %rax,-0x20(%rbp)
jmp    1161 <BARRAY_cmp_return+0x61>
cmpq   $0x0,-0x10(%rbp)
jbe    114e <BARRAY_cmp_return+0x4e>
mov    -0x8(%rbp),%rax
shl    $0x5,%rax
mov    %rax,-0x28(%rbp)
jmp    1159 <BARRAY_cmp_return+0x59>
xor    %eax,%eax
mov    %rax,-0x28(%rbp)
jmp    1159 <BARRAY_cmp_return+0x59>
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<BARRAY_cmp_return>:
shl    $0x5,%edi
xor    %eax,%eax
test   %rsi,%rsi
cmovne %edi,%eax
add    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @BARRAY_cmp_return(i64 %0, i64 %1) {
%3 = icmp eq i64 %1, 0
%4 = shl i64 %0, 5
%5 = select i1 %3, i64 0, i64 %4
%6 = add i64 %5, %1
%7 = trunc i64 %6 to i32
ret i32 %7
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  char *p = malloc(16);
  p[-1] = 0;
  printf(p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x10,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x0,-0x1(%rax)
mov    -0x18(%rbp),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x10,%edi
call   1040 <malloc@plt>
movb   $0x0,-0x1(%rax)
mov    %rax,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i8* @malloc(i32 16)
store i8* %7, i8** %6
%8 = load i8*, i8** %6
%9 = getelementptr inbounds i8, i8* %8, i64 -1
store i8 0, i8* %9
%10 = load i8*, i8** %6
%11 = call i32 @printf(i8* %10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call dereferenceable_or_null(16) i8* @malloc(i32 16)
%4 = getelementptr inbounds i8, i8* %3, i64 -1
store i8 0, i8* %4
%5 = tail call i32 @printf(i8* dereferenceable(1) %3)
ret i32 0
}
/* Variables and functions */
int ccnl_ccnb_mkHeader(unsigned char *, int, int);
int /*<<< orphan*/ memcpy(unsigned char *, char *, int);
int ccnl_ccnb_addBlob(unsigned char *out, char *cp, int cnt) {
  int len;
  len = ccnl_ccnb_mkHeader(out, cnt, 5);
  memcpy(out + len, cp, cnt);
  len += cnt;
  return len;
}


x86 assembly (clang, -O0):
<ccnl_ccnb_addBlob>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    $0x5,%edx
call   1040 <ccnl_ccnb_mkHeader@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x18(%rbp),%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ccnl_ccnb_addBlob>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %edx,%esi
mov    $0x5,%edx
call   1040 <ccnl_ccnb_mkHeader@plt>
movslq %eax,%rbp
add    %rbp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1030 <memcpy@plt>
add    %r15d,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ccnl_ccnb_addBlob(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %6
%10 = call i32 @ccnl_ccnb_mkHeader(i8* %8, i32 %9, i32 5)
store i32 %10, i32* %7
%11 = load i8*, i8** %4
%12 = load i32, i32* %7
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = load i8*, i8** %5
%16 = load i32, i32* %6
%17 = call i32 @memcpy(i8* %14, i8* %15, i32 %16)
%18 = load i32, i32* %6
%19 = load i32, i32* %7
%20 = add nsw i32 %19, %18
store i32 %20, i32* %7
%21 = load i32, i32* %7
ret i32 %21
}

LLVM IR (-O2):
define i32 @ccnl_ccnb_addBlob(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @ccnl_ccnb_mkHeader(i8* %0, i32 %2, i32 5)
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = tail call i32 @memcpy(i8* %6, i8* %1, i32 %2)
%8 = add nsw i32 %4, %2
ret i32 %8
}
/* Variables and functions */
scalar_t__ utils_get_random_int(int /*<<< orphan*/, unsigned int);
int _select_starting_player(int nb_players) {
  return (int)utils_get_random_int(0, (unsigned int)nb_players);
}


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

x86 assembly (clang, -O2):
<_select_starting_player>:
mov    %edi,%esi
xor    %edi,%edi
jmp    1030 <utils_get_random_int@plt>

LLVM IR (-O0):
define i32 @_select_starting_player(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @utils_get_random_int(i32 0, i32 %3)
%5 = trunc i64 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @_select_starting_player(i32 %0) {
%2 = tail call i64 @utils_get_random_int(i32 0, i32 %0)
%3 = trunc i64 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ restore_input_buffering();
void handle_interrupt(int signal) {
  restore_input_buffering();
  printf("\n");
  exit(-2);
}


x86 assembly (clang, -O0):
<handle_interrupt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <restore_input_buffering@plt>
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
mov    $0xfffffffe,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<handle_interrupt>:
push   %rax
xor    %eax,%eax
call   1040 <restore_input_buffering@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xfffffffe,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define void @handle_interrupt(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @restore_input_buffering()
%4 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @exit(i32 -2)
unreachable
}

LLVM IR (-O2):
define void @handle_interrupt(i32 %0) {
%2 = tail call i32 (...) @restore_input_buffering()
%3 = tail call i32 @putchar(i32 10)
%4 = tail call i32 @exit(i32 -2)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void runtime_write(size_t len, char *buffer) {
  int i;
  for (i = 0; i < len; i++)
    putchar(buffer[i]);
}


x86 assembly (clang, -O0):
<runtime_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    1154 <runtime_write+0x44>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <putchar@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <runtime_write+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<runtime_write>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     1143 <runtime_write+0x33>
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl (%r14,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <runtime_write+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @runtime_write(i64 %0, i8* nocapture %1) {
%3 = icmp eq i64 %0, 0
br i1 %3, label %11, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %9, %4 ], [ 0, %2 ]
%6 = getelementptr inbounds i8, i8* %1, i64 %5
%7 = load i8, i8* %6
%8 = tail call i32 @putchar(i8 signext %7)
%9 = add nuw i64 %5, 1
%10 = icmp eq i64 %9, %0
br i1 %10, label %11, label %4
11: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stdout;
void ouch(int sig) {
  static int logged = 0;
  if (logged == 0) {
    logged = 1;
    printf("OUCH! - I got signal %d\n", sig);
    fflush(stdout);
  }
}


x86 assembly (clang, -O0):
<ouch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,0x2f02(%rip)
jne    115f <ouch+0x3f>
movl   $0x1,0x2ef2(%rip)
mov    -0x4(%rbp),%esi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ouch>:
push   %rax
cmpb   $0x0,0x2f0c(%rip)
je     112c <ouch+0xc>
pop    %rax
ret
mov    %edi,%esi
movb   $0x1,0x2eff(%rip)
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@ouch.logged = internal global i32 0
@.str = [25 x i8] c"OUCH! - I got signal %d\0A\00"
@stdout = global i32 0
define void @ouch(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @ouch.logged
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %1
store i32 1, i32* @ouch.logged
%6 = load i32, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i32, i32* @stdout
%9 = call i32 @fflush(i32 %8)
br label %10
10: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
@ouch.logged = internal unnamed_addr global i1 false
@.str = [25 x i8] c"OUCH! - I got signal %d\0A\00"
@stdout = global i32 0
define void @ouch(i32 %0) {
%2 = load i1, i1* @ouch.logged
br i1 %2, label %7, label %3
3: ; preds = %1
store i1 true, i1* @ouch.logged
%4 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %0)
%5 = load i32, i32* @stdout
%6 = tail call i32 @fflush(i32 %5)
br label %7
7: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Reserved42_DriverIRQHandler();
__attribute__((weak)) void Reserved42_IRQHandler(void) {
  Reserved42_DriverIRQHandler();
}


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

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

LLVM IR (-O0):
define weak void @Reserved42_IRQHandler() {
%1 = call i32 (...) @Reserved42_DriverIRQHandler()
ret void
}

LLVM IR (-O2):
define weak void @Reserved42_IRQHandler() {
%1 = tail call i32 (...) @Reserved42_DriverIRQHandler()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdout;
void printSpaces(int nb) {
  int spaces;
  for (spaces = 1; spaces <= nb; spaces++) {
    fprintf(stdout, " ");
  }
}


x86 assembly (clang, -O0):
<printSpaces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1151 <printSpaces+0x41>
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
lea    0xec2(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <printSpaces+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printSpaces>:
push   %r15
push   %r14
push   %rbx
test   %edi,%edi
jle    1140 <printSpaces+0x30>
mov    %edi,%ebx
mov    0x2ebe(%rip),%r15
lea    0xed7(%rip),%r14
nopl   0x0(%rax)
mov    (%r15),%edi
mov    %r14,%rsi
call   1030 <fprintf@plt>
add    $0xffffffff,%ebx
jne    1130 <printSpaces+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [2 x i8] c" \00"
define void @printSpaces(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
br label %4
4: ; preds = %11, %1
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = icmp sle i32 %5, %6
br i1 %7, label %8, label %14
8: ; preds = %4
%9 = load i32, i32* @stdout
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %8
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %4
14: ; preds = %4
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [2 x i8] c" \00"
define void @printSpaces(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 1, %1 ]
%5 = load i32, i32* @stdout
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = add nuw i32 %4, 1
%8 = icmp eq i32 %4, %0
br i1 %8, label %9, label %3
9: ; preds = %3, %1
ret void
}
/* Variables and functions */
int waitpid(int, int *, int);
int wait3(int *statusp, int options, void *rusage) {
  return waitpid(-1, statusp, options);
}


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

x86 assembly (clang, -O2):
<wait3>:
mov    %esi,%edx
mov    %rdi,%rsi
mov    $0xffffffff,%edi
jmp    1030 <waitpid@plt>

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

LLVM IR (-O2):
define i32 @wait3(i32* %0, i32 %1, i8* nocapture readnone %2) {
%4 = tail call i32 @waitpid(i32 -1, i32* %0, i32 %1)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ VIM_SIF_I2cReadWord(unsigned char, unsigned short *);
void SensorGetReg_MT9V111(unsigned char uAddr, unsigned short *uVal) {
  VIM_SIF_I2cReadWord((unsigned char)uAddr, (unsigned short *)uVal);
}


x86 assembly (clang, -O0):
<SensorGetReg_MT9V111>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x1(%rbp),%al
mov    -0x10(%rbp),%rsi
movzbl %al,%edi
call   1030 <VIM_SIF_I2cReadWord@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SensorGetReg_MT9V111>:
jmp    1030 <VIM_SIF_I2cReadWord@plt>

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

LLVM IR (-O2):
define void @SensorGetReg_MT9V111(i8 zeroext %0, i16* %1) {
%3 = tail call i32 @VIM_SIF_I2cReadWord(i8 zeroext %0, i16* %1)
ret void
}
void action() {}


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

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

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

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