xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;
typedef int /*<<< orphan*/ level;
typedef int /*<<< orphan*/ channel;

/* Variables and functions */
int /*<<< orphan*/ dac_set_output(int /*<<< orphan*/, int /*<<< orphan*/);
size_t usart_in_waiting();
int /*<<< orphan*/ usart_read(int /*<<< orphan*/ *, int);
void rpc_dac_set_output(void) {
  uint8_t channel;
  uint16_t level;
  size_t argsize = sizeof(channel) + sizeof(level);
  while (usart_in_waiting() < argsize)
    ;
  usart_read(&channel, sizeof(channel));
  usart_read(&level, sizeof(level));
  dac_set_output(channel, level);
}


x86 assembly (clang, -O0):
<rpc_dac_set_output>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x8,-0x10(%rbp)
mov    $0x0,%al
call   1050 <usart_in_waiting@plt>
cmp    -0x10(%rbp),%rax
jae    1156 <rpc_dac_set_output+0x26>
jmp    1140 <rpc_dac_set_output+0x10>
lea    -0x4(%rbp),%rdi
mov    $0x4,%esi
call   1040 <usart_read@plt>
lea    -0x8(%rbp),%rdi
mov    $0x4,%esi
call   1040 <usart_read@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <dac_set_output@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rpc_dac_set_output>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <usart_in_waiting@plt>
cmp    $0x8,%rax
jb     1140 <rpc_dac_set_output+0x10>
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
call   1040 <usart_read@plt>
mov    %rsp,%rdi
mov    $0x4,%esi
call   1040 <usart_read@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1030 <dac_set_output@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @rpc_dac_set_output() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64
store i64 8, i64* %3
br label %4
4: ; preds = %8, %0
%5 = call i64 (...) @usart_in_waiting()
%6 = load i64, i64* %3
%7 = icmp ult i64 %5, %6
br i1 %7, label %8, label %9
8: ; preds = %4
br label %4
9: ; preds = %4
%10 = call i32 @usart_read(i32* %1, i32 4)
%11 = call i32 @usart_read(i32* %2, i32 4)
%12 = load i32, i32* %1
%13 = load i32, i32* %2
%14 = call i32 @dac_set_output(i32 %12, i32 %13)
ret void
}

LLVM IR (-O2):
define void @rpc_dac_set_output() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
br label %5
5: ; preds = %5, %0
%6 = tail call i64 (...) @usart_in_waiting()
%7 = icmp ult i64 %6, 8
br i1 %7, label %5, label %8
8: ; preds = %5
%9 = call i32 @usart_read(i32* %1, i32 4)
%10 = call i32 @usart_read(i32* %2, i32 4)
%11 = load i32, i32* %1
%12 = load i32, i32* %2
%13 = call i32 @dac_set_output(i32 %11, i32 %12)
ret void
}
void I2C1_EV_IRQHandler() {}


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

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

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

LLVM IR (-O2):
define void @I2C1_EV_IRQHandler() {
ret void
}
unsigned char mirror(unsigned char n) {
  unsigned char m;
  int i;
  m = 0;
  for (i = 0; i < 8; i++) {
    m <<= 1;
    if (n & 1) {
      m |= 1;
    }
    n >>= 1;
  }
  return m;
}


x86 assembly (clang, -O0):
<mirror>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movb   $0x0,-0x2(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x8,-0x8(%rbp)
jge    115b <mirror+0x5b>
movzbl -0x2(%rbp),%eax
shl    $0x1,%eax
mov    %al,-0x2(%rbp)
movzbl -0x1(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1143 <mirror+0x43>
movzbl -0x2(%rbp),%eax
or     $0x1,%eax
mov    %al,-0x2(%rbp)
movzbl -0x1(%rbp),%eax
sar    $0x1,%eax
mov    %al,-0x1(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1115 <mirror+0x15>
movzbl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mirror>:
rol    $0x4,%dil
mov    %edi,%eax
and    $0x33,%al
shl    $0x2,%al
shr    $0x2,%dil
and    $0x33,%dil
or     %dil,%al
mov    %eax,%ecx
and    $0x55,%cl
add    %cl,%cl
shr    %al
and    $0x55,%al
or     %cl,%al
ret

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

LLVM IR (-O2):
define zeroext i8 @mirror(i8 zeroext %0) {
%2 = call i8 @llvm.bitreverse.i8(i8 %0)
ret i8 %2
}
/* Variables and functions */
int /*<<< orphan*/ MOTOR_ON_OFF_RestoreConfig();
void MOTOR_ON_OFF_Wakeup(void) { MOTOR_ON_OFF_RestoreConfig(); }


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

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

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

LLVM IR (-O2):
define void @MOTOR_ON_OFF_Wakeup() {
%1 = tail call i32 (...) @MOTOR_ON_OFF_RestoreConfig()
ret void
}
/* Variables and functions */
int strlen(char *);
int /*<<< orphan*/ write(int, char *, int);
void send_message(int socket, char *message) {
  int size = 0;
  size = strlen(message);
  message[size] = '\n';
  if (size < 1024)
    size++;
  write(socket, message, size);
}


x86 assembly (clang, -O0):
<send_message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0xa,(%rax,%rcx,1)
cmpl   $0x400,-0x14(%rbp)
jge    1164 <send_message+0x44>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_message>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
call   1040 <strlen@plt>
cltq
movb   $0xa,(%rbx,%rax,1)
xor    %edx,%edx
cmp    $0x400,%eax
setl   %dl
add    %eax,%edx
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <write@plt>

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

LLVM IR (-O2):
define void @send_message(i32 %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %1, i64 %4
store i8 10, i8* %5
%6 = icmp slt i32 %3, 1024
%7 = zext i1 %6 to i32
%8 = add nsw i32 %3, %7
%9 = tail call i32 @write(i32 %0, i8* %1, i32 %8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
scalar_t__ malloc(int);
int main() {
  int *p = (int *)malloc(1024);
  free(p);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x400,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @malloc(i32 1024)
%2 = inttoptr i64 %1 to i32*
%3 = tail call i32 @free(i32* %2)
ret i32 0
}
/* Type definitions */
typedef int uint32_t;
typedef int uint16_t;

/* Variables and functions */
uint32_t USBLPMEndpointGet(uint32_t ui32Base) {
  uint32_t ui32Endpoint;
  ;
  ui32Endpoint =
      ((*((volatile uint16_t *)(ui32Base + 0x00000360))) & 0x0000F000) >> 12;
  return (((ui32Endpoint) << 4));
}


x86 assembly (clang, -O0):
<USBLPMEndpointGet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x360,%eax
cltq
mov    (%rax),%eax
and    $0xf000,%eax
sar    $0xc,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x4,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBLPMEndpointGet>:
movslq %edi,%rax
mov    0x360(%rax),%eax
shr    $0x8,%eax
and    $0xf0,%eax
ret

LLVM IR (-O0):
define i32 @USBLPMEndpointGet(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 864
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
%8 = load volatile i32, i32* %7
%9 = and i32 %8, 61440
%10 = ashr i32 %9, 12
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = shl i32 %11, 4
ret i32 %12
}

LLVM IR (-O2):
define i32 @USBLPMEndpointGet(i32 %0) {
%2 = add nsw i32 %0, 864
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i32*
%5 = load volatile i32, i32* %4
%6 = lshr i32 %5, 8
%7 = and i32 %6, 240
ret i32 %7
}
/* Variables and functions */
scalar_t__ getpid();
int /*<<< orphan*/ getuser();
int /*<<< orphan*/ newgame();
int /*<<< orphan*/ play();
int /*<<< orphan*/ replay();
int /*<<< orphan*/ srand(scalar_t__);
scalar_t__ time(int /*<<< orphan*/ *);
main(void) {
  getuser();
  (srand(time(NULL) + getpid()));
  newgame();
  play();
  replay();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1080 <getuser@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x10(%rbp),%rdi
add    %rax,%rdi
call   1040 <srand@plt>
mov    $0x0,%al
call   1090 <newgame@plt>
mov    $0x0,%al
call   1050 <play@plt>
mov    $0x0,%al
call   1070 <replay@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1080 <getuser@plt>
xor    %edi,%edi
call   1060 <time@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <getpid@plt>
add    %rax,%rbx
mov    %rbx,%rdi
call   1040 <srand@plt>
xor    %eax,%eax
call   1090 <newgame@plt>
xor    %eax,%eax
call   1050 <play@plt>
xor    %eax,%eax
call   1070 <replay@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @getuser()
%3 = call i64 @time(i32* null)
%4 = call i64 (...) @getpid()
%5 = add nsw i64 %3, %4
%6 = call i32 @srand(i64 %5)
%7 = call i32 (...) @newgame()
%8 = call i32 (...) @play()
%9 = call i32 (...) @replay()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @getuser()
%2 = tail call i64 @time(i32* null)
%3 = tail call i64 (...) @getpid()
%4 = add nsw i64 %3, %2
%5 = tail call i32 @srand(i64 %4)
%6 = tail call i32 (...) @newgame()
%7 = tail call i32 (...) @play()
%8 = tail call i32 (...) @replay()
ret i32 0
}
__attribute__((no)) __attribute__((optnone)) void test_collatz(int a) {
  while (a != 1) {
    if ((a & 1) == 0) {
      a = a >> 1;
    } else {
      a = 3 * a + 1;
    }
  }
}


x86 assembly (clang, -O0):
<test_collatz>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
je     113d <test_collatz+0x3d>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    112e <test_collatz+0x2e>
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1138 <test_collatz+0x38>
imul   $0x3,-0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1107 <test_collatz+0x7>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_collatz>:
mov    %edi,-0x4(%rsp)
cmpl   $0x1,-0x4(%rsp)
je     1132 <test_collatz+0x32>
mov    -0x4(%rsp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    1124 <test_collatz+0x24>
mov    -0x4(%rsp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rsp)
jmp    1130 <test_collatz+0x30>
imul   $0x3,-0x4(%rsp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rsp)
jmp    1104 <test_collatz+0x4>
ret

LLVM IR (-O0):
define void @test_collatz(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %17, %1
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 1
br i1 %5, label %6, label %18
6: ; preds = %3
%7 = load i32, i32* %2
%8 = and i32 %7, 1
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %6
%11 = load i32, i32* %2
%12 = ashr i32 %11, 1
store i32 %12, i32* %2
br label %17
13: ; preds = %6
%14 = load i32, i32* %2
%15 = mul nsw i32 3, %14
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %17
17: ; preds = %13, %10
br label %3
18: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @test_collatz(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %17, %1
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 1
br i1 %5, label %6, label %18
6: ; preds = %3
%7 = load i32, i32* %2
%8 = and i32 %7, 1
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %6
%11 = load i32, i32* %2
%12 = ashr i32 %11, 1
store i32 %12, i32* %2
br label %17
13: ; preds = %6
%14 = load i32, i32* %2
%15 = mul nsw i32 3, %14
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %17
17: ; preds = %13, %10
br label %3
18: ; preds = %3
ret void
}
void f(void *p, int n) {
  if (n <= 4)
    __builtin_memset(p, 0, n);
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jg     1138 <f+0x28>
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
cmp    $0x4,%esi
jg     111f <f+0xf>
movslq %esi,%rdx
xor    %esi,%esi
jmp    1030 <memset@plt>
ret

LLVM IR (-O0):
define void @f(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 = icmp sle i32 %5, 4
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = load i32, i32* %4
%10 = sext i32 %9 to i64
br label %11
11: ; preds = %7, %2
ret void
}

LLVM IR (-O2):
define void @f(i8* nocapture writeonly %0, i32 %1) {
%3 = icmp slt i32 %1, 5
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = sext i32 %1 to i64
tail call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 %5, i1 false)
br label %6
6: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ mintaka_state_synch();
void mintaka_state_synch_() { mintaka_state_synch(); }


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

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

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

LLVM IR (-O2):
define void @mintaka_state_synch_() {
%1 = tail call i32 (...) @mintaka_state_synch()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void testInternalError() {
  perror("Internal error occurred inside testing framework.");
  exit(-1);
}


x86 assembly (clang, -O0):
<testInternalError>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <perror@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<testInternalError>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <perror@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [50 x i8] c"Internal error occurred inside testing framework.\00"
define void @testInternalError() {
%1 = call i32 @perror(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@.str = [50 x i8] c"Internal error occurred inside testing framework.\00"
define void @testInternalError() {
%1 = tail call i32 @perror(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 -1)
unreachable
}
double z0m(double lai) { return (0.018 * lai); }


x86 assembly (clang, -O0):
<z0m>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<z0m>:
mulsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @z0m(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double 1.800000e-02, %3
ret double %4
}

LLVM IR (-O2):
define double @z0m(double %0) {
%2 = fmul double %0, 1.800000e-02
ret double %2
}
/* Variables and functions */
int japi_progressbar(int, int);
int j_progressbar(int arg0, int arg1) { return (japi_progressbar(arg0, arg1)); }


x86 assembly (clang, -O0):
<j_progressbar>:
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 <japi_progressbar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<j_progressbar>:
jmp    1030 <japi_progressbar@plt>

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

LLVM IR (-O2):
define i32 @j_progressbar(i32 %0, i32 %1) {
%3 = tail call i32 @japi_progressbar(i32 %0, i32 %1)
ret i32 %3
}
/* Type definitions */
struct ber_element {
  int dummy;
};

/* Variables and functions */
struct ber_element *ber_get_element(int);
int /*<<< orphan*/ ber_link_elements(struct ber_element *,
                                     struct ber_element *);
struct ber_element *ber_add_set(struct ber_element *prev) {
  struct ber_element *elm;
  if ((elm = ber_get_element(17)) == NULL)
    return NULL;
  ber_link_elements(prev, elm);
  return elm;
}


x86 assembly (clang, -O0):
<ber_add_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x11,%edi
call   1030 <ber_get_element@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1151 <ber_add_set+0x31>
movq   $0x0,-0x8(%rbp)
jmp    1166 <ber_add_set+0x46>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <ber_link_elements@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ber_add_set>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x11,%edi
call   1030 <ber_get_element@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1144 <ber_add_set+0x24>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <ber_link_elements@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
%struct.ber_element = type { i32 }
define %struct.ber_element* @ber_add_set(%struct.ber_element* %0) {
%2 = tail call %struct.ber_element* @ber_get_element(i32 17)
%3 = icmp eq %struct.ber_element* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @ber_link_elements(%struct.ber_element* %0, %struct.ber_element* %2)
br label %6
6: ; preds = %1, %4
ret %struct.ber_element* %2
}
int test_imm_C6int8_mem(signed char *val) {
  return ((*val) & (0xC6 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_C6int8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
and    $0xc6,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_C6int8_mem>:
testb  $0xc6,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_C6int8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, 198
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_C6int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -58
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
double getRealTime(void) { return -1.0; }


x86 assembly (clang, -O0):
<getRealTime>:
push   %rbp
mov    %rsp,%rbp
movsd  0xef4(%rip),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<getRealTime>:
movsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @getRealTime() {
ret double -1.000000e+00
}

LLVM IR (-O2):
define double @getRealTime() {
ret double -1.000000e+00
}
int ft_count_if(char **tab, int (*f)(char *)) {
  int count;
  count = 0;
  while (*tab)
    count += (1 == f(*tab++));
  return (count);
}


x86 assembly (clang, -O0):
<ft_count_if>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1159 <ft_count_if+0x59>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x8,%rdx
mov    %rdx,-0x8(%rbp)
mov    (%rcx),%rdi
call   *%rax
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1117 <ft_count_if+0x17>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_count_if>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     113b <ft_count_if+0x3b>
mov    %rsi,%r14
add    $0x8,%rbx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
call   *%r14
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
add    %ecx,%ebp
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1120 <ft_count_if+0x20>
jmp    113d <ft_count_if+0x3d>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @ft_count_if(i8** nocapture %0, i32 (i8*)* nocapture %1) {
%3 = load i8*, i8** %0
%4 = icmp eq i8* %3, null
br i1 %4, label %16, label %5
5: ; preds = %2, %5
%6 = phi i8* [ %14, %5 ], [ %3, %2 ]
%7 = phi i32 [ %13, %5 ], [ 0, %2 ]
%8 = phi i8** [ %9, %5 ], [ %0, %2 ]
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = tail call i32 %1(i8* %6)
%11 = icmp eq i32 %10, 1
%12 = zext i1 %11 to i32
%13 = add nuw nsw i32 %7, %12
%14 = load i8*, i8** %9
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %5
16: ; preds = %5, %2
%17 = phi i32 [ 0, %2 ], [ %13, %5 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ test_hatem_fusion();
int main() {
  printf("==================== TEST ALEX =================\n\n");
  printf("\n\n\n");
  printf("================== TEST HATHEM =================\n\n\n");
  test_hatem_fusion();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1040 <printf@plt>
lea    0xf21(%rip),%rdi
call   1040 <printf@plt>
lea    0xee5(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <test_hatem_fusion@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [51 x i8] c"==================== TEST ALEX =================\0A\0A\00"
@.str.1 = [4 x i8] c"\0A\0A\0A\00"
@.str.2 = [52 x i8] c"================== TEST HATHEM =================\0A\0A\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 (...) @test_hatem_fusion()
ret i32 0
}

LLVM IR (-O2):
@str = [50 x i8] c"==================== TEST ALEX =================\0A\00"
@str.3 = [3 x i8] c"\0A\0A\00"
@str.4 = [51 x i8] c"================== TEST HATHEM =================\0A\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.4, i64 0, i64 0))
%4 = tail call i32 (...) @test_hatem_fusion()
ret i32 0
}
int checkAlive(int *current, int length) {
  for (int i = 0; i < length - 1; i++)
    if (current[i] != 0)
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<checkAlive>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1154 <checkAlive+0x54>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     1141 <checkAlive+0x41>
movl   $0x0,-0x4(%rbp)
jmp    115b <checkAlive+0x5b>
jmp    1146 <checkAlive+0x46>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1112 <checkAlive+0x12>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkAlive>:
mov    $0x1,%eax
cmp    $0x2,%esi
jl     1111 <checkAlive+0x11>
xor    %eax,%eax
cmpl   $0x0,(%rdi)
je     1112 <checkAlive+0x12>
ret
add    $0xffffffff,%esi
mov    %esi,%ecx
mov    $0x1,%eax
nopl   0x0(%rax)
mov    %rax,%rdx
cmp    %rax,%rcx
je     1132 <checkAlive+0x32>
lea    0x1(%rdx),%rax
cmpl   $0x0,(%rdi,%rdx,4)
je     1120 <checkAlive+0x20>
xor    %eax,%eax
cmp    %rcx,%rdx
setae  %al
ret

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

LLVM IR (-O2):
define i32 @checkAlive(i32* nocapture %0, i32 %1) {
%3 = add i32 %1, -1
%4 = icmp sgt i32 %1, 1
br i1 %4, label %5, label %21
5: ; preds = %2
%6 = zext i32 %3 to i64
%7 = zext i32 %3 to i64
%8 = load i32, i32* %0
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %21
10: ; preds = %5, %13
%11 = phi i64 [ %17, %13 ], [ 1, %5 ]
%12 = icmp eq i64 %11, %7
br i1 %12, label %18, label %13
13: ; preds = %10
%14 = getelementptr inbounds i32, i32* %0, i64 %11
%15 = load i32, i32* %14
%16 = icmp eq i32 %15, 0
%17 = add nuw nsw i64 %11, 1
br i1 %16, label %10, label %18
18: ; preds = %10, %13
%19 = icmp uge i64 %11, %6
%20 = zext i1 %19 to i32
br label %21
21: ; preds = %18, %5, %2
%22 = phi i32 [ 1, %2 ], [ 0, %5 ], [ %20, %18 ]
ret i32 %22
}
double lon_mm_to_deg(double x) { return x / (0.017453292 * 6356752.3142); }


x86 assembly (clang, -O0):
<lon_mm_to_deg>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<lon_mm_to_deg>:
divsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @lon_mm_to_deg(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fdiv double %3, 0x40FB162411A8D6DD
ret double %4
}

LLVM IR (-O2):
define double @lon_mm_to_deg(double %0) {
%2 = fdiv double %0, 0x40FB162411A8D6DD
ret double %2
}
void ASN1_STRING_set0(void) {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ ESPIPE;
int /*<<< orphan*/ errno;
void rewind(FILE *stream) { errno = ESPIPE; }


x86 assembly (clang, -O0):
<rewind>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    0x2ed9(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec0(%rip),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

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

LLVM IR (-O0):
@ESPIPE = global i32 0
@errno = global i32 0
define void @rewind(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32, i32* @ESPIPE
store i32 %3, i32* @errno
ret void
}

LLVM IR (-O2):
@ESPIPE = global i32 0
@errno = global i32 0
define void @rewind(i32* nocapture readnone %0) {
%2 = load i32, i32* @ESPIPE
store i32 %2, i32* @errno
ret void
}
/* Variables and functions */
int /*<<< orphan*/ res_hl(int);
void opcb_be() { res_hl(7); }


x86 assembly (clang, -O0):
<opcb_be>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7,%edi
call   1030 <res_hl@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<opcb_be>:
mov    $0x7,%edi
jmp    1030 <res_hl@plt>

LLVM IR (-O0):
define void @opcb_be() {
%1 = call i32 @res_hl(i32 7)
ret void
}

LLVM IR (-O2):
define void @opcb_be() {
%1 = tail call i32 @res_hl(i32 7)
ret void
}
int test_imm_BBint32_reg(int val) { return ((val) & (0xBB << 0)) ? -20 : -40; }


x86 assembly (clang, -O0):
<test_imm_BBint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0xbb,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_BBint32_reg>:
test   $0xbb,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_BBint32_reg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 187
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 -20, i32 -40
ret i32 %7
}

LLVM IR (-O2):
define i32 @test_imm_BBint32_reg(i32 %0) {
%2 = and i32 %0, 187
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ send_freq_to_ICR10(double);
void plugin_set_uplink_frequency(double frequency) {
  send_freq_to_ICR10(frequency);
}


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

x86 assembly (clang, -O2):
<plugin_set_uplink_frequency>:
jmp    1030 <send_freq_to_ICR10@plt>

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

LLVM IR (-O2):
define void @plugin_set_uplink_frequency(double %0) {
%2 = tail call i32 @send_freq_to_ICR10(double %0)
ret void
}
/* Variables and functions */
int add(int, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  printf("2 + 3 = %d", add(2, 3));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x2,%edi
mov    $0x3,%esi
call   1030 <add@plt>
mov    %eax,%esi
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2,%edi
mov    $0x3,%esi
call   1030 <add@plt>
lea    0xec9(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"2 + 3 = %d\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @add(i32 2, i32 3)
%3 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"2 + 3 = %d\00"
define i32 @main() {
%1 = tail call i32 @add(i32 2, i32 3)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Type definitions */
struct timespec {
  double tv_sec;
  double tv_nsec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_PROCESS_CPUTIME_ID;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
double getTime() {
  struct timespec spec;
  clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &spec);
  double s = spec.tv_sec;
  double ms = spec.tv_nsec;
  return (s * 1000 + ms / 1000000);
}


x86 assembly (clang, -O0):
<getTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xeb8(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  0xea4(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getTime>:
sub    $0x18,%rsp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1030 <clock_gettime@plt>
movsd  0x10(%rsp),%xmm1
divsd  0xecb(%rip),%xmm1
movsd  0x8(%rsp),%xmm0
mulsd  0xec5(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { double, double }
@CLOCK_PROCESS_CPUTIME_ID = global i32 0
define double @getTime() {
%1 = alloca %struct.timespec
%2 = alloca double
%3 = alloca double
%4 = load i32, i32* @CLOCK_PROCESS_CPUTIME_ID
%5 = call i32 @clock_gettime(i32 %4, %struct.timespec* %1)
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%7 = load double, double* %6
store double %7, double* %2
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 1
%9 = load double, double* %8
store double %9, double* %3
%10 = load double, double* %2
%11 = load double, double* %3
%12 = fdiv double %11, 1.000000e+06
%13 = call double @llvm.fmuladd.f64(double %10, double 1.000000e+03, double %12)
ret double %13
}

LLVM IR (-O2):
%struct.timespec = type { double, double }
@CLOCK_PROCESS_CPUTIME_ID = global i32 0
define double @getTime() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_PROCESS_CPUTIME_ID
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%6 = load double, double* %5
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%8 = load double, double* %7
%9 = fdiv double %8, 1.000000e+06
%10 = call double @llvm.fmuladd.f64(double %6, double 1.000000e+03, double %9)
ret double %10
}
/* Variables and functions */
int /*<<< orphan*/ beep();
int /*<<< orphan*/ died(int);
int /*<<< orphan*/ lprcat(char *);
int /*<<< orphan*/ nap(int);
void obottomless(void) {
  lprcat("\nYou fell into a bottomless pit!");
  beep();
  nap(3000);
  died(262);
}


x86 assembly (clang, -O0):
<obottomless>:
push   %rbp
mov    %rsp,%rbp
lea    0xeb5(%rip),%rdi
call   1060 <lprcat@plt>
mov    $0x0,%al
call   1050 <beep@plt>
mov    $0xbb8,%edi
call   1030 <nap@plt>
mov    $0x106,%edi
call   1040 <died@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<obottomless>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1060 <lprcat@plt>
xor    %eax,%eax
call   1050 <beep@plt>
mov    $0xbb8,%edi
call   1030 <nap@plt>
mov    $0x106,%edi
pop    %rax
jmp    1040 <died@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"\0AYou fell into a bottomless pit!\00"
define void @obottomless() {
%1 = call i32 @lprcat(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @beep()
%3 = call i32 @nap(i32 3000)
%4 = call i32 @died(i32 262)
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"\0AYou fell into a bottomless pit!\00"
define void @obottomless() {
%1 = tail call i32 @lprcat(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @beep()
%3 = tail call i32 @nap(i32 3000)
%4 = tail call i32 @died(i32 262)
ret void
}
void cond_gp_update(const struct XCSF *xcsf, const struct Cl *c,
                    const double *x, const double *y) {
  (void)xcsf;
  (void)c;
  (void)x;
  (void)y;
}


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

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

LLVM IR (-O0):
%struct.XCSF = type opaque
%struct.Cl = type opaque
define void @cond_gp_update(%struct.XCSF* %0, %struct.Cl* %1, double* %2, double* %3) {
%5 = alloca %struct.XCSF*
%6 = alloca %struct.Cl*
%7 = alloca double*
%8 = alloca double*
store %struct.XCSF* %0, %struct.XCSF** %5
store %struct.Cl* %1, %struct.Cl** %6
store double* %2, double** %7
store double* %3, double** %8
%9 = load %struct.XCSF*, %struct.XCSF** %5
%10 = load %struct.Cl*, %struct.Cl** %6
%11 = load double*, double** %7
%12 = load double*, double** %8
ret void
}

LLVM IR (-O2):
%struct.XCSF = type opaque
%struct.Cl = type opaque
define void @cond_gp_update(%struct.XCSF* nocapture %0, %struct.Cl* nocapture %1, double* nocapture %2, double* nocapture %3) {
ret void
}
/* Variables and functions */
int strlen(char const *);
int validate_author_email(const char *email) {
  if (email == NULL) {
    return -1;
  }
  if (strlen(email) > 255) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<validate_author_email>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <validate_author_email+0x23>
movl   $0xffffffff,-0x4(%rbp)
jmp    115a <validate_author_email+0x4a>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0xff,%eax
jle    1153 <validate_author_email+0x43>
movl   $0xffffffff,-0x4(%rbp)
jmp    115a <validate_author_email+0x4a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validate_author_email>:
test   %rdi,%rdi
je     112f <validate_author_email+0x1f>
push   %rax
call   1030 <strlen@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x100,%ecx
setge  %al
neg    %eax
add    $0x8,%rsp
ret
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @validate_author_email(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = tail call i32 @strlen(i8* %0)
%5 = icmp sgt i32 %4, 255
%6 = sext i1 %5 to i32
br label %7
7: ; preds = %3, %1
%8 = phi i32 [ -1, %1 ], [ %6, %3 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ Q_UTF8Width(char const *);
int Q_UTF8Strlen(const char *str) {
  int l = 0;
  while (*str) {
    l++;
    str += Q_UTF8Width(str);
  }
  return l;
}


x86 assembly (clang, -O0):
<Q_UTF8Strlen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1157 <Q_UTF8Strlen+0x47>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <Q_UTF8Width@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    1123 <Q_UTF8Strlen+0x13>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Q_UTF8Strlen>:
push   %rbp
push   %rbx
push   %rax
cmpb   $0x0,(%rdi)
je     1139 <Q_UTF8Strlen+0x29>
mov    %rdi,%rbx
xor    %ebp,%ebp
nopl   (%rax)
add    $0x1,%ebp
mov    %rbx,%rdi
call   1030 <Q_UTF8Width@plt>
cltq
cmpb   $0x0,(%rbx,%rax,1)
lea    (%rbx,%rax,1),%rbx
jne    1120 <Q_UTF8Strlen+0x10>
jmp    113b <Q_UTF8Strlen+0x2b>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @Q_UTF8Strlen(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %7, %4 ], [ 0, %1 ]
%6 = phi i8* [ %10, %4 ], [ %0, %1 ]
%7 = add nuw nsw i32 %5, 1
%8 = tail call i32 @Q_UTF8Width(i8* %6)
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %6, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %1
%14 = phi i32 [ 0, %1 ], [ %7, %4 ]
ret i32 %14
}
/* Type definitions */
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ foo(int *);
int main() {
  static int a[] = {0, 1, 2};
  int *i = &a[sizeof(a) / sizeof(*a)];
  while (i-- > a)
    foo(i);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0x2efa(%rip),%rax
add    $0xc,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffffc,%rcx
mov    %rcx,-0x10(%rbp)
lea    0x2edc(%rip),%rcx
cmp    %rcx,%rax
jbe    116b <main+0x4b>
mov    -0x10(%rbp),%rdi
call   1030 <foo@plt>
jmp    113e <main+0x1e>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0x2f10(%rip),%rdi
call   1030 <foo@plt>
lea    0x2efc(%rip),%rbx
lea    0x2ef9(%rip),%rdi
call   1030 <foo@plt>
mov    %rbx,%rdi
call   1030 <foo@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@main.a = internal global [3 x i32] [i32 0, i32 1, i32 2]
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
store i32* getelementptr inbounds ([3 x i32], [3 x i32]* @main.a, i64 1, i64 0), i32** %2
br label %3
3: ; preds = %7, %0
%4 = load i32*, i32** %2
%5 = getelementptr inbounds i32, i32* %4, i32 -1
store i32* %5, i32** %2
%6 = icmp ugt i32* %4, getelementptr inbounds ([3 x i32], [3 x i32]* @main.a, i64 0, i64 0)
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = load i32*, i32** %2
%9 = call i32 @foo(i32* %8)
br label %3
10: ; preds = %3
%11 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@main.a = internal global [3 x i32] [i32 0, i32 1, i32 2]
define i32 @main() {
%1 = tail call i32 @foo(i32* getelementptr inbounds ([3 x i32], [3 x i32]* @main.a, i64 0, i64 2))
%2 = tail call i32 @foo(i32* getelementptr inbounds ([3 x i32], [3 x i32]* @main.a, i64 0, i64 1))
%3 = tail call i32 @foo(i32* getelementptr inbounds ([3 x i32], [3 x i32]* @main.a, i64 0, i64 0))
%4 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
double RAND_MAX;
double rand();
double rand_double(double min, double max) {
  return min + (rand() / (RAND_MAX / (max - min)));
}


x86 assembly (clang, -O0):
<rand_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mov    0x2ea6(%rip),%rax
movsd  (%rax),%xmm2
movsd  -0x10(%rbp),%xmm3
subsd  -0x8(%rbp),%xmm3
divsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_double>:
sub    $0x18,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1030 <rand@plt>
mov    0x2eba(%rip),%rax
movsd  (%rax),%xmm1
movsd  0x8(%rsp),%xmm2
movsd  0x10(%rsp),%xmm3
subsd  %xmm2,%xmm3
divsd  %xmm3,%xmm1
divsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@RAND_MAX = global double 0.000000e+00
define double @rand_double(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = call double (...) @rand()
%7 = load double, double* @RAND_MAX
%8 = load double, double* %4
%9 = load double, double* %3
%10 = fsub double %8, %9
%11 = fdiv double %7, %10
%12 = fdiv double %6, %11
%13 = fadd double %5, %12
ret double %13
}

LLVM IR (-O2):
@RAND_MAX = global double 0.000000e+00
define double @rand_double(double %0, double %1) {
%3 = tail call double (...) @rand()
%4 = load double, double* @RAND_MAX
%5 = fsub double %1, %0
%6 = fdiv double %4, %5
%7 = fdiv double %3, %6
%8 = fadd double %7, %0
ret double %8
}
/* Variables and functions */
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ ungetc(char, int /*<<< orphan*/);
void ugchar(char ch) { ungetc(ch, stdin); }


x86 assembly (clang, -O0):
<ugchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
mov    0x2ec0(%rip),%rcx
mov    (%rcx),%esi
movsbl %al,%edi
call   1030 <ungetc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ugchar>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
jmp    1030 <ungetc@plt>

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

LLVM IR (-O2):
@stdin = global i32 0
define void @ugchar(i8 signext %0) {
%2 = load i32, i32* @stdin
%3 = tail call i32 @ungetc(i8 signext %0, i32 %2)
ret void
}