xunge/DecIR huggingface dataset:
int sync_test_and_clear_bit(long nr, volatile unsigned long *addr) {
  unsigned char oldbit;
  asm volatile("lock; btr %2,%1\n\tsetc %0"
               : "=qm"(oldbit), "+m"((*(volatile long *)addr))
               : "Ir"(nr)
               : "memory");
  return oldbit;
}


x86 assembly (clang, -O0):
<sync_test_and_clear_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
lock btr %rcx,(%rax)
setb   -0x11(%rbp)
movzbl -0x11(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sync_test_and_clear_bit>:
lock btr %rdi,(%rsi)
setb   -0x1(%rsp)
movzbl -0x1(%rsp),%eax
ret

LLVM IR (-O0):
define i32 @sync_test_and_clear_bit(i64 %0, i64* %1) {
%3 = alloca i64
%4 = alloca i64*
%5 = alloca i8
store i64 %0, i64* %3
store i64* %1, i64** %4
%6 = load i64*, i64** %4
%7 = load i64, i64* %3
%8 = load i8, i8* %5
%9 = zext i8 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @sync_test_and_clear_bit(i64 %0, i64* %1) {
%3 = alloca i8
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
ret i32 %5
}
__attribute__((no, noclone)) unsigned __int128 t153_4add(signed __int128 x) {
  signed __int128 y = (0);
  unsigned __int128 r;
  if (__builtin_add_overflow(x, y, &r))
    bar();
  return r;
}


x86 assembly (clang, -O0):
<t153_4add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    %rcx,%r9
sar    $0x3f,%r9
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    %rsi,%rax
sar    $0x3f,%rax
add    %rdi,%rdx
adc    %rsi,%rcx
mov    %r9,%r8
adc    %rax,%r8
adc    %rax,%r9
mov    %r8d,%eax
and    $0x1,%eax
mov    %eax,%esi
mov    %rsi,%rax
neg    %rax
mov    %rax,%rdi
xor    %r9,%rdi
xor    %r8,%rax
or     %rdi,%rax
or     %rsi,%rax
setne  %al
mov    %rdx,-0x50(%rbp)
mov    %rcx,-0x48(%rbp)
test   $0x1,%al
jne    11a2 <t153_4add+0x92>
jmp    11a9 <t153_4add+0x99>
mov    $0x0,%al
call   1030 <bar@plt>
mov    -0x50(%rbp),%rax
mov    -0x48(%rbp),%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t153_4add>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rax
sar    $0x3f,%rax
je     112a <t153_4add+0x1a>
xor    %eax,%eax
call   1030 <bar@plt>
mov    %r14,%rax
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define { i64, i64 } @t153_4add(i64 %0, i64 %1) {
%3 = alloca i128
%4 = alloca i128
%5 = alloca i128
%6 = alloca i128
%7 = alloca i128
%8 = bitcast i128* %4 to { i64, i64 }*
%9 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %8, i32 0, i32 0
store i64 %0, i64* %9
%10 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %8, i32 0, i32 1
store i64 %1, i64* %10
%11 = load i128, i128* %4
store i128 %11, i128* %5
store i128 0, i128* %6
%12 = load i128, i128* %5
%13 = load i128, i128* %6
%14 = sext i128 %12 to i129
%15 = sext i128 %13 to i129
%16 = call { i129, i1 } @llvm.sadd.with.overflow.i129(i129 %14, i129 %15)
%17 = extractvalue { i129, i1 } %16, 1
%18 = extractvalue { i129, i1 } %16, 0
%19 = trunc i129 %18 to i128
%20 = zext i128 %19 to i129
%21 = icmp ne i129 %18, %20
%22 = or i1 %17, %21
store i128 %19, i128* %7
br i1 %22, label %23, label %25
23: ; preds = %2
%24 = call i32 (...) @bar()
br label %25
25: ; preds = %23, %2
%26 = load i128, i128* %7
store i128 %26, i128* %3
%27 = bitcast i128* %3 to { i64, i64 }*
%28 = load { i64, i64 }, { i64, i64 }* %27
ret { i64, i64 } %28
}

LLVM IR (-O2):
define { i64, i64 } @t153_4add(i64 %0, i64 %1) {
%3 = zext i64 %1 to i128
%4 = shl nuw i128 %3, 64
%5 = zext i64 %0 to i128
%6 = or i128 %4, %5
%7 = sext i128 %6 to i129
%8 = zext i128 %6 to i129
%9 = icmp eq i129 %7, %8
br i1 %9, label %12, label %10
10: ; preds = %2
%11 = tail call i32 (...) @bar()
br label %12
12: ; preds = %10, %2
%13 = insertvalue { i64, i64 } poison, i64 %0, 0
%14 = insertvalue { i64, i64 } %13, i64 %1, 1
ret { i64, i64 } %14
}
unsigned long b_file_close(unsigned long handle) {
  unsigned long tlong = 0;
  asm volatile("call *0x00100078" : : "a"(handle));
  return tlong;
}


x86 assembly (clang, -O0):
<b_file_close>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
call   *0x100078
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<b_file_close>:
mov    %rdi,%rax
call   *0x100078
xor    %eax,%eax
ret

LLVM IR (-O0):
define i64 @b_file_close(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
store i64 0, i64* %3
%4 = load i64, i64* %2
%5 = load i64, i64* %3
ret i64 %5
}

LLVM IR (-O2):
define i64 @b_file_close(i64 %0) {
tail call void asm sideeffect "call *0x00100078", "{ax},~{dirflag},~{fpsr},~{flags}"(i64 %0)
ret i64 0
}
/* Variables and functions */
scalar_t__ LONG_MAX;
long LONG_MIN;
scalar_t__ labs(long);
unsigned long uabs(long n) {
  if (n == LONG_MIN)
    return ((unsigned long)LONG_MAX) + 1;
  return (unsigned long)labs(n);
}


x86 assembly (clang, -O0):
<uabs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2ec1(%rip),%rcx
cmp    (%rcx),%rax
jne    1147 <uabs+0x37>
mov    0x2ea1(%rip),%rax
mov    (%rax),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1154 <uabs+0x44>
mov    -0x10(%rbp),%rdi
call   1030 <labs@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uabs>:
mov    0x2ee1(%rip),%rcx
mov    0x2eca(%rip),%rax
mov    (%rax),%rdx
add    $0x1,%rdx
mov    %rdi,%rax
neg    %rax
cmovs  %rdi,%rax
cmp    %rdi,(%rcx)
cmove  %rdx,%rax
ret

LLVM IR (-O0):
@LONG_MIN = global i64 0
@LONG_MAX = global i64 0
define i64 @uabs(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = load i64, i64* @LONG_MIN
%6 = icmp eq i64 %4, %5
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i64, i64* @LONG_MAX
%9 = add i64 %8, 1
store i64 %9, i64* %2
br label %13
10: ; preds = %1
%11 = load i64, i64* %3
%12 = call i64 @labs(i64 %11)
store i64 %12, i64* %2
br label %13
13: ; preds = %10, %7
%14 = load i64, i64* %2
ret i64 %14
}

LLVM IR (-O2):
@LONG_MIN = global i64 0
@LONG_MAX = global i64 0
define i64 @uabs(i64 %0) {
%2 = load i64, i64* @LONG_MIN
%3 = icmp eq i64 %2, %0
%4 = load i64, i64* @LONG_MAX
%5 = add i64 %4, 1
%6 = tail call i64 @llvm.abs.i64(i64 %0, i1 true)
%7 = select i1 %3, i64 %5, i64 %6
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ out_byte(int);
void out_op1(int op) {
  if (op & 0x100)
    out_byte(0xFE);
  out_byte(op & 0xff);
}


x86 assembly (clang, -O0):
<out_op1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x100,%eax
cmp    $0x0,%eax
je     1136 <out_op1+0x26>
mov    $0xfe,%edi
call   1030 <out_byte@plt>
mov    -0x4(%rbp),%edi
and    $0xff,%edi
call   1030 <out_byte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<out_op1>:
push   %rbx
mov    %edi,%ebx
test   $0x100,%edi
je     1125 <out_op1+0x15>
mov    $0xfe,%edi
call   1030 <out_byte@plt>
movzbl %bl,%edi
pop    %rbx
jmp    1030 <out_byte@plt>

LLVM IR (-O0):
define void @out_op1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 256
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @out_byte(i32 254)
br label %8
8: ; preds = %6, %1
%9 = load i32, i32* %2
%10 = and i32 %9, 255
%11 = call i32 @out_byte(i32 %10)
ret void
}

LLVM IR (-O2):
define void @out_op1(i32 %0) {
%2 = and i32 %0, 256
%3 = icmp eq i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @out_byte(i32 254)
br label %6
6: ; preds = %4, %1
%7 = and i32 %0, 255
%8 = tail call i32 @out_byte(i32 %7)
ret void
}
int test_imm_0Fint64_lowword_reg(long long val) {
  return ((val) & (0x0F << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_0Fint64_lowword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
and    $0xf,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_0Fint64_lowword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 15
%5 = icmp ne i64 %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_0Fint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 15
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void init_rand(void) { srand(time(NULL)); }


x86 assembly (clang, -O0):
<init_rand>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_rand>:
push   %rax
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <srand@plt>

LLVM IR (-O0):
define void @init_rand() {
%1 = call i32 @time(i32* null)
%2 = call i32 @srand(i32 %1)
ret void
}

LLVM IR (-O2):
define void @init_rand() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ discard;

/* Variables and functions */
int /*<<< orphan*/ PACKET_LOSS;
int /*<<< orphan*/ SOL_PACKET;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, void *, int);
void __v1_v2_set_packet_loss_discard(int sock) {
  int ret, discard = 1;
  ret = setsockopt(sock, SOL_PACKET, PACKET_LOSS, (void *)&discard,
                   sizeof(discard));
  if (ret == -1) {
    perror("setsockopt");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<__v1_v2_set_packet_loss_discard>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ea4(%rip),%rax
mov    (%rax),%esi
mov    0x2e93(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    1189 <__v1_v2_set_packet_loss_discard+0x59>
lea    0xe86(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__v1_v2_set_packet_loss_discard>:
push   %rax
movl   $0x1,0x4(%rsp)
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
mov    0x2e9f(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
cmp    $0xffffffff,%eax
je     1162 <__v1_v2_set_packet_loss_discard+0x32>
pop    %rax
ret
lea    0xe97(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@SOL_PACKET = global i32 0
@PACKET_LOSS = global i32 0
@.str = [11 x i8] c"setsockopt\00"
define void @__v1_v2_set_packet_loss_discard(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %4
%5 = load i32, i32* %2
%6 = load i32, i32* @SOL_PACKET
%7 = load i32, i32* @PACKET_LOSS
%8 = bitcast i32* %4 to i8*
%9 = call i32 @setsockopt(i32 %5, i32 %6, i32 %7, i8* %8, i32 4)
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %15
12: ; preds = %1
%13 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %1
ret void
}

LLVM IR (-O2):
@SOL_PACKET = global i32 0
@PACKET_LOSS = global i32 0
@.str = [11 x i8] c"setsockopt\00"
define void @__v1_v2_set_packet_loss_discard(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 1, i32* %2
%4 = load i32, i32* @SOL_PACKET
%5 = load i32, i32* @PACKET_LOSS
%6 = call i32 @setsockopt(i32 %0, i32 %4, i32 %5, i8* %3, i32 4)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
11: ; preds = %1
ret void
}
/* Variables and functions */
char *scopy(char *, char const *);
char *scopy_char(char *d, const char *s, const char c) {
  d = scopy(d, s);
  *d++ = c;
  return d;
}


x86 assembly (clang, -O0):
<scopy_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <scopy@plt>
mov    %rax,-0x8(%rbp)
mov    -0x11(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scopy_char>:
push   %rbx
mov    %edx,%ebx
call   1030 <scopy@plt>
mov    %bl,(%rax)
add    $0x1,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @scopy_char(i8* %0, i8* %1, i8 signext %2) {
%4 = tail call i8* @scopy(i8* %0, i8* %1)
%5 = getelementptr inbounds i8, i8* %4, i64 1
store i8 %2, i8* %4
ret i8* %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *);
void usage(FILE *file, const char *name) {
  fprintf(file,
          "Usage: %s [PROBE_OUTPUT]\n"
          "Decode a UC-Logic tablet probe dump.\n"
          "\n",
          name);
}


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

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

LLVM IR (-O0):
@.str = [64 x i8] c"Usage: %s [PROBE_OUTPUT]\0ADecode a UC-Logic tablet probe dump.\0A\0A\00"
define void @usage(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%5 = load i32*, i32** %3
%6 = load i8*, i8** %4
%7 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [64 x i8] c"Usage: %s [PROBE_OUTPUT]\0ADecode a UC-Logic tablet probe dump.\0A\0A\00"
define void @usage(i32* nocapture %0, i8* %1) {
%3 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}
void free_driver(void *info) {}


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

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

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

LLVM IR (-O2):
define void @free_driver(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main(int argc, char **argv) {
  int c = 3;
  switch (c) {
  case (1):
    puts("one");
    break;
  case (2):
    puts("two");
    break;
  case (3):
    puts("three");
    break;
  case (4):
    puts("four");
    break;
  default:
    break;
  }
  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)
movl   $0x3,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x3,%eax
ja     119a <main+0x8a>
mov    -0x20(%rbp),%rax
lea    0xeb3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeb3(%rip),%rdi
call   1030 <puts@plt>
jmp    119f <main+0x8f>
lea    0xea6(%rip),%rdi
call   1030 <puts@plt>
jmp    119f <main+0x8f>
lea    0xe99(%rip),%rdi
call   1030 <puts@plt>
jmp    119f <main+0x8f>
lea    0xe8e(%rip),%rdi
call   1030 <puts@plt>
jmp    119f <main+0x8f>
jmp    119f <main+0x8f>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str.2 = [6 x i8] c"three\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}
int mn(int x, int y) { return x < y ? x : y; }


x86 assembly (clang, -O0):
<mn>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1121 <mn+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <mn+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mn>:
mov    %esi,%eax
cmp    %esi,%edi
cmovl  %edi,%eax
ret

LLVM IR (-O0):
define i32 @mn(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 = icmp slt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %3
br label %12
10: ; preds = %2
%11 = load i32, i32* %4
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @mn(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t transfer_int(uint8_t data) { return 0xFF; }


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

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

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

LLVM IR (-O2):
define i32 @transfer_int(i32 %0) {
ret i32 255
}
/* Variables and functions */
int /*<<< orphan*/ f18a_msg(char *);
void dumpheader(void) {
  f18a_msg("p   r     t     s     a     b   io    i     @ opcode\n"
           "--- ----- ----- ----- ----- --- ----- ----- - --------\n");
}


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

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

LLVM IR (-O0):
@.str = [109 x i8] c"p r t s a b io i @ opcode\0A--- ----- ----- ----- ----- --- ----- ----- - --------\0A\00"
define void @dumpheader() {
%1 = call i32 @f18a_msg(i8* getelementptr inbounds ([109 x i8], [109 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [109 x i8] c"p r t s a b io i @ opcode\0A--- ----- ----- ----- ----- --- ----- ----- - --------\0A\00"
define void @dumpheader() {
%1 = tail call i32 @f18a_msg(i8* getelementptr inbounds ([109 x i8], [109 x i8]* @.str, i64 0, i64 0))
ret void
}
double c(double x) { return 2.0 / (x * x - 4.0); }


x86 assembly (clang, -O0):
<c>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xee9(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xed5(%rip),%xmm0
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<c>:
mulsd  %xmm0,%xmm0
addsd  0xef4(%rip),%xmm0
movsd  0xef4(%rip),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @c(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = call double @llvm.fmuladd.f64(double %3, double %4, double -4.000000e+00)
%6 = fdiv double 2.000000e+00, %5
ret double %6
}

LLVM IR (-O2):
define double @c(double %0) {
%2 = tail call double @llvm.fmuladd.f64(double %0, double %0, double -4.000000e+00)
%3 = fdiv double 2.000000e+00, %2
ret double %3
}
void drawpixel(void *s, char a) { *((char *)(s)) = a; }


x86 assembly (clang, -O0):
<drawpixel>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawpixel>:
mov    %sil,(%rdi)
ret

LLVM IR (-O0):
define void @drawpixel(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = load i8*, i8** %3
store i8 %5, i8* %6
ret void
}

LLVM IR (-O2):
define void @drawpixel(i8* nocapture writeonly %0, i8 signext %1) {
store i8 %1, i8* %0
ret void
}
/* Type definitions */
struct sockaddr {
  scalar_t__ sa_family;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ connect(int /*<<< orphan*/, struct sockaddr *,
                           int /*<<< orphan*/);
void test_connect() {
  struct sockaddr sa;
  sa.sa_family = 0;
  connect(0, &sa, 0);
  assert(sa.sa_family == 0);
}


x86 assembly (clang, -O0):
<test_connect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
xor    %edx,%edx
lea    -0x8(%rbp),%rsi
mov    %edx,%edi
call   1040 <connect@plt>
cmpq   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_connect>:
push   %rax
movq   $0x0,(%rsp)
mov    %rsp,%rsi
xor    %edi,%edi
xor    %edx,%edx
call   1040 <connect@plt>
xor    %edi,%edi
cmpq   $0x0,(%rsp)
sete   %dil
call   1030 <assert@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.sockaddr = type { i64 }
define void @test_connect() {
%1 = alloca %struct.sockaddr
%2 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %1, i32 0, i32 0
store i64 0, i64* %2
%3 = call i32 @connect(i32 0, %struct.sockaddr* %1, i32 0)
%4 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %1, i32 0, i32 0
%5 = load i64, i64* %4
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
ret void
}

LLVM IR (-O2):
%struct.sockaddr = type { i64 }
define void @test_connect() {
%1 = alloca %struct.sockaddr
%2 = bitcast %struct.sockaddr* %1 to i8*
%3 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %1, i64 0, i32 0
store i64 0, i64* %3
%4 = call i32 @connect(i32 0, %struct.sockaddr* %1, i32 0)
%5 = load i64, i64* %3
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
ret void
}
int n_fib() {}


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

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

LLVM IR (-O0):
define i32 @n_fib() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @n_fib() {
ret i32 undef
}
/* Variables and functions */
int dump_gpio_info();
int /*<<< orphan*/ printf(char *);
int gpio_dump(void) {
  int ret;
  printf("\nGpio Tree :\n");
  printf("***********\n");
  ret = dump_gpio_info();
  printf("\n\n");
  return ret;
}


x86 assembly (clang, -O0):
<gpio_dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1040 <printf@plt>
lea    0xed3(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <dump_gpio_info@plt>
mov    %eax,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gpio_dump>:
push   %rbx
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xed9(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <dump_gpio_info@plt>
mov    %eax,%ebx
lea    0xed0(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"\0AGpio Tree :\0A\00"
@.str.1 = [13 x i8] c"***********\0A\00"
@.str.2 = [3 x i8] c"\0A\0A\00"
define i32 @gpio_dump() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 (...) @dump_gpio_info()
store i32 %4, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%6 = load i32, i32* %1
ret i32 %6
}

LLVM IR (-O2):
@str = [13 x i8] c"\0AGpio Tree :\00"
@str.3 = [12 x i8] c"***********\00"
@str.4 = [2 x i8] c"\0A\00"
define i32 @gpio_dump() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 (...) @dump_gpio_info()
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0))
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ THRandom_manualSeed(unsigned long);
scalar_t__ time(int /*<<< orphan*/);
unsigned long THRandom_seed() {
  unsigned long s = (unsigned long)time(0);
  THRandom_manualSeed(s);
  return s;
}


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

x86 assembly (clang, -O2):
<THRandom_seed>:
push   %rbx
xor    %edi,%edi
call   1040 <time@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <THRandom_manualSeed@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @THRandom_seed() {
%1 = alloca i64
%2 = call i64 @time(i32 0)
store i64 %2, i64* %1
%3 = load i64, i64* %1
%4 = call i32 @THRandom_manualSeed(i64 %3)
%5 = load i64, i64* %1
ret i64 %5
}

LLVM IR (-O2):
define i64 @THRandom_seed() {
%1 = tail call i64 @time(i32 0)
%2 = tail call i32 @THRandom_manualSeed(i64 %1)
ret i64 %1
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, long);
int write(int, char *, int);
int /*<<< orphan*/ x_perror(char *);
void send_long(long value) {
  char lbuf[10];
  sprintf(lbuf, "%08lx", value);
  if (write(1, lbuf, 8) != 8)
    x_perror("send_long");
}


x86 assembly (clang, -O0):
<send_long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x12(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xeb5(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x12(%rbp),%rsi
mov    $0x1,%edi
mov    $0x8,%edx
call   1040 <write@plt>
cmp    $0x8,%eax
je     1178 <send_long+0x48>
lea    0xe93(%rip),%rdi
call   1030 <x_perror@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_long>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rdx
lea    0xec1(%rip),%rsi
lea    0x6(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <sprintf@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    $0x8,%edx
call   1040 <write@plt>
cmp    $0x8,%eax
jne    1169 <send_long+0x39>
add    $0x10,%rsp
pop    %rbx
ret
lea    0xe96(%rip),%rdi
add    $0x10,%rsp
pop    %rbx
jmp    1030 <x_perror@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%08lx\00"
@.str.1 = [10 x i8] c"send_long\00"
define void @send_long(i64 %0) {
%2 = alloca i64
%3 = alloca [10 x i8]
store i64 %0, i64* %2
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%5 = load i64, i64* %2
%6 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 %5)
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%8 = call i32 @write(i32 1, i8* %7, i32 8)
%9 = icmp ne i32 %8, 8
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = call i32 @x_perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %1
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%08lx\00"
@.str.1 = [10 x i8] c"send_long\00"
define void @send_long(i64 %0) {
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 %0)
%5 = call i32 @write(i32 1, i8* %3, i32 8)
%6 = icmp eq i32 %5, 8
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = tail call i32 @x_perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
ret void
}
char *checkid(id, delimiter)
char *id;
int delimiter;
{ return checkidentifier(id, delimiter, 1); }


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

x86 assembly (clang, -O2):
<checkid>:
push   %rax
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <checkidentifier@plt>
cltq
pop    %rcx
ret

LLVM IR (-O0):
define i8* @checkid(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 (i8*, i32, i32, ...) bitcast (i32 (...)* @checkidentifier to i32 (i8*, i32, i32, ...)*)(i8* %5, i32 %6, i32 1)
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i8*
ret i8* %9
}

LLVM IR (-O2):
define i8* @checkid(i8* %0, i32 %1) {
%3 = tail call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @checkidentifier to i32 (i8*, i32, i32, ...)*)(i8* %0, i32 %1, i32 1)
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
ret i8* %5
}
int test_imm_1Fuint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0x1F << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_1Fuint64_midword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
shr    $0x10,%rdx
and    $0x1f,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_1Fuint64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 16
%6 = and i64 %5, 31
%7 = icmp ne i64 %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_1Fuint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 2031616
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           char const *);
int /*<<< orphan*/ stderr;
void print_usage(const char *name) {
  fprintf(stderr,
          "Usage: %s <local-key> <remote-key> [<address>[:<port>]]\n"
          "       %s --generate <size> <new-key-file>\n",
          name, name);
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
mov    %rdi,%rcx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
mov    %rcx,%rdx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [100 x i8] c"Usage: %s <local-key> <remote-key> [<address>[:<port>]]\0A %s --generate <size> <new-key-file>\0A\00"
define void @print_usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %5)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [100 x i8] c"Usage: %s <local-key> <remote-key> [<address>[:<port>]]\0A %s --generate <size> <new-key-file>\0A\00"
define void @print_usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %0)
ret void
}
/* Variables and functions */
long gcd(long, long);
int lcm(long int x, long int y) { return (x * y) / gcd(x, y); }


x86 assembly (clang, -O0):
<lcm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
imul   -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <gcd@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cqto
idiv   %rcx
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcm>:
push   %rbx
mov    %rsi,%rbx
imul   %rdi,%rbx
call   1030 <gcd@plt>
mov    %rax,%rcx
or     %rbx,%rax
shr    $0x20,%rax
je     1133 <lcm+0x23>
mov    %rbx,%rax
cqto
idiv   %rcx
pop    %rbx
ret
mov    %ebx,%eax
xor    %edx,%edx
div    %ecx
pop    %rbx
ret

LLVM IR (-O0):
define i32 @lcm(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = mul nsw i64 %5, %6
%8 = load i64, i64* %3
%9 = load i64, i64* %4
%10 = call i64 @gcd(i64 %8, i64 %9)
%11 = sdiv i64 %7, %10
%12 = trunc i64 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @lcm(i64 %0, i64 %1) {
%3 = mul nsw i64 %1, %0
%4 = tail call i64 @gcd(i64 %0, i64 %1)
%5 = sdiv i64 %3, %4
%6 = trunc i64 %5 to i32
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ __m256i;

/* Variables and functions */
int /*<<< orphan*/ filter_8x1_pixels(int /*<<< orphan*/ const *,
                                     int /*<<< orphan*/ const *,
                                     int /*<<< orphan*/ *);
void filter_8x9_pixels(const __m256i *sig, const __m256i *f, __m256i *y0,
                       __m256i *y1) {
  filter_8x1_pixels(sig, f, y0);
  filter_8x1_pixels(&sig[4], f, y1);
}


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

x86 assembly (clang, -O2):
<filter_8x9_pixels>:
push   %r15
push   %r14
push   %rbx
mov    %rcx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1030 <filter_8x1_pixels@plt>
add    $0x10,%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <filter_8x1_pixels@plt>

LLVM IR (-O0):
define void @filter_8x9_pixels(i32* %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%9 = load i32*, i32** %5
%10 = load i32*, i32** %6
%11 = load i32*, i32** %7
%12 = call i32 @filter_8x1_pixels(i32* %9, i32* %10, i32* %11)
%13 = load i32*, i32** %5
%14 = getelementptr inbounds i32, i32* %13, i64 4
%15 = load i32*, i32** %6
%16 = load i32*, i32** %8
%17 = call i32 @filter_8x1_pixels(i32* %14, i32* %15, i32* %16)
ret void
}

LLVM IR (-O2):
define void @filter_8x9_pixels(i32* %0, i32* %1, i32* %2, i32* %3) {
%5 = tail call i32 @filter_8x1_pixels(i32* %0, i32* %1, i32* %2)
%6 = getelementptr inbounds i32, i32* %0, i64 4
%7 = tail call i32 @filter_8x1_pixels(i32* %6, i32* %1, i32* %3)
ret void
}
/* Variables and functions */
unsigned long BIT_MASK(int);
int BIT_WORD(int);
int /*<<< orphan*/ local_irq_restore(unsigned long);
int /*<<< orphan*/ local_irq_save(unsigned long);
void clear_bit(int nr, volatile unsigned long *addr) {
  unsigned long mask = BIT_MASK(nr);
  unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
  unsigned long flags;
  do {
    local_irq_save(flags);
  } while (0);
  *p &= ~mask;
  do {
    local_irq_restore(flags);
  } while (0);
}


x86 assembly (clang, -O0):
<clear_bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <BIT_MASK@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x4(%rbp),%edi
call   1060 <BIT_WORD@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <local_irq_save@plt>
mov    -0x18(%rbp),%rcx
xor    $0xffffffffffffffff,%rcx
mov    -0x20(%rbp),%rax
and    (%rax),%rcx
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rdi
call   1050 <local_irq_restore@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_bit>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
call   1030 <BIT_MASK@plt>
mov    %rax,%rbx
mov    %ebp,%edi
call   1060 <BIT_WORD@plt>
movslq %eax,%rbp
call   1040 <local_irq_save@plt>
not    %rbx
and    %rbx,(%r14,%rbp,8)
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <local_irq_restore@plt>

LLVM IR (-O0):
define void @clear_bit(i32 %0, i64* %1) {
%3 = alloca i32
%4 = alloca i64*
%5 = alloca i64
%6 = alloca i64*
%7 = alloca i64
store i32 %0, i32* %3
store i64* %1, i64** %4
%8 = load i32, i32* %3
%9 = call i64 @BIT_MASK(i32 %8)
store i64 %9, i64* %5
%10 = load i64*, i64** %4
%11 = load i32, i32* %3
%12 = call i32 @BIT_WORD(i32 %11)
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i64, i64* %10, i64 %13
store i64* %14, i64** %6
br label %15
15: ; preds = %2
%16 = load i64, i64* %7
%17 = call i32 @local_irq_save(i64 %16)
br label %18
18: ; preds = %15
%19 = load i64, i64* %5
%20 = xor i64 %19, -1
%21 = load i64*, i64** %6
%22 = load i64, i64* %21
%23 = and i64 %22, %20
store i64 %23, i64* %21
br label %24
24: ; preds = %18
%25 = load i64, i64* %7
%26 = call i32 @local_irq_restore(i64 %25)
br label %27
27: ; preds = %24
ret void
}

LLVM IR (-O2):
define void @clear_bit(i32 %0, i64* nocapture %1) {
%3 = tail call i64 @BIT_MASK(i32 %0)
%4 = tail call i32 @BIT_WORD(i32 %0)
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i64, i64* %1, i64 %5
%7 = tail call i32 @local_irq_save(i64 undef)
%8 = xor i64 %3, -1
%9 = load i64, i64* %6
%10 = and i64 %9, %8
store i64 %10, i64* %6
%11 = tail call i32 @local_irq_restore(i64 undef)
ret void
}
void user_access(void) {}


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

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

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

LLVM IR (-O2):
define void @user_access() {
ret void
}
void test1() {
  extern volatile int f11G, a, b;
  f11G = a + b;
  f11G = a - b;
  f11G = a * b;
  f11G = -a;
  ++a;
  --a;
}


x86 assembly (clang, -O0):
<test1>:
push   %rbp
mov    %rsp,%rbp
mov    0x2edd(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec4(%rip),%rax
mov    (%rax),%eax
add    %eax,%ecx
mov    0x2eb1(%rip),%rax
mov    %ecx,(%rax)
mov    0x2ec0(%rip),%rax
mov    (%rax),%ecx
mov    0x2ea7(%rip),%rax
mov    (%rax),%eax
sub    %eax,%ecx
mov    0x2e94(%rip),%rax
mov    %ecx,(%rax)
mov    0x2ea3(%rip),%rax
mov    (%rax),%ecx
mov    0x2e8a(%rip),%rax
mov    (%rax),%eax
imul   %eax,%ecx
mov    0x2e76(%rip),%rax
mov    %ecx,(%rax)
mov    0x2e85(%rip),%rax
mov    (%rax),%eax
xor    %ecx,%ecx
sub    %eax,%ecx
mov    0x2e60(%rip),%rax
mov    %ecx,(%rax)
mov    0x2e6f(%rip),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    0x2e63(%rip),%rax
mov    %ecx,(%rax)
mov    0x2e5a(%rip),%rax
mov    (%rax),%ecx
add    $0xffffffff,%ecx
mov    0x2e4e(%rip),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<test1>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec8(%rip),%rdx
add    (%rdx),%ecx
mov    0x2eb7(%rip),%rsi
mov    %ecx,(%rsi)
mov    (%rax),%ecx
sub    (%rdx),%ecx
mov    %ecx,(%rsi)
mov    (%rax),%ecx
imul   (%rdx),%ecx
mov    %ecx,(%rsi)
xor    %ecx,%ecx
sub    (%rax),%ecx
mov    %ecx,(%rsi)
addl   $0x1,(%rax)
addl   $0xffffffff,(%rax)
ret

LLVM IR (-O0):
@a = external global i32
@b = external global i32
@f11G = external global i32
define void @test1() {
%1 = load volatile i32, i32* @a
%2 = load volatile i32, i32* @b
%3 = add nsw i32 %1, %2
store volatile i32 %3, i32* @f11G
%4 = load volatile i32, i32* @a
%5 = load volatile i32, i32* @b
%6 = sub nsw i32 %4, %5
store volatile i32 %6, i32* @f11G
%7 = load volatile i32, i32* @a
%8 = load volatile i32, i32* @b
%9 = mul nsw i32 %7, %8
store volatile i32 %9, i32* @f11G
%10 = load volatile i32, i32* @a
%11 = sub nsw i32 0, %10
store volatile i32 %11, i32* @f11G
%12 = load volatile i32, i32* @a
%13 = add nsw i32 %12, 1
store volatile i32 %13, i32* @a
%14 = load volatile i32, i32* @a
%15 = add nsw i32 %14, -1
store volatile i32 %15, i32* @a
ret void
}

LLVM IR (-O2):
@a = external global i32
@b = external global i32
@f11G = external global i32
define void @test1() {
%1 = load volatile i32, i32* @a
%2 = load volatile i32, i32* @b
%3 = add nsw i32 %2, %1
store volatile i32 %3, i32* @f11G
%4 = load volatile i32, i32* @a
%5 = load volatile i32, i32* @b
%6 = sub nsw i32 %4, %5
store volatile i32 %6, i32* @f11G
%7 = load volatile i32, i32* @a
%8 = load volatile i32, i32* @b
%9 = mul nsw i32 %8, %7
store volatile i32 %9, i32* @f11G
%10 = load volatile i32, i32* @a
%11 = sub nsw i32 0, %10
store volatile i32 %11, i32* @f11G
%12 = load volatile i32, i32* @a
%13 = add nsw i32 %12, 1
store volatile i32 %13, i32* @a
%14 = load volatile i32, i32* @a
%15 = add nsw i32 %14, -1
store volatile i32 %15, i32* @a
ret void
}
/* Variables and functions */
int /*<<< orphan*/ LedsP__Leds__led0Toggle();
void OscilloscopeC__Leds__led0Toggle(void) { LedsP__Leds__led0Toggle(); }


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

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

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

LLVM IR (-O2):
define void @OscilloscopeC__Leds__led0Toggle() {
%1 = tail call i32 (...) @LedsP__Leds__led0Toggle()
ret void
}
int another_evil_nonnull_func(int *pointer, char ch, void *pv) {
  if (pointer == (void *)0) {
    return 0;
  } else {
    return *pointer;
  }
  set_param_to_null(&pointer);
  if (!pointer)
    return 0;
  else
    return *pointer;
  if (pv == (void *)0) {
  }
}


x86 assembly (clang, -O0):
<another_evil_nonnull_func>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1129 <another_evil_nonnull_func+0x29>
movl   $0x0,-0x4(%rbp)
jmp    1132 <another_evil_nonnull_func+0x32>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<another_evil_nonnull_func>:
test   %rdi,%rdi
je     1108 <another_evil_nonnull_func+0x8>
mov    (%rdi),%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @another_evil_nonnull_func(i32* %0, i8 signext %1, i8* nocapture readnone %2) {
%4 = icmp eq i32* %0, null
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = load i32, i32* %0
br label %7
7: ; preds = %3, %5
%8 = phi i32 [ %6, %5 ], [ 0, %3 ]
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
void kinetis_program(uint32_t address, void *firmware, size_t total) {}


x86 assembly (clang, -O0):
<kinetis_program>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @kinetis_program(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32 %0, i32* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
ret void
}

LLVM IR (-O2):
define void @kinetis_program(i32 %0, i8* nocapture %1, i64 %2) {
ret void
}
/* Variables and functions */
int SIGINT;
int /*<<< orphan*/ __sort_fitness();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ get_best_gene();
int /*<<< orphan*/ printf(char *);
void sig_handler(int sig) {
  if (sig == SIGINT) {
    printf("SIGINT ===============\n");
    __sort_fitness();
    get_best_gene();
    printf("\n");
  }
  exit(-1);
}


x86 assembly (clang, -O0):
<sig_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2e93(%rip),%rcx
cmp    (%rcx),%eax
jne    1183 <sig_handler+0x43>
lea    0xe9c(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <__sort_fitness@plt>
mov    $0x0,%al
call   1050 <get_best_gene@plt>
lea    0xe98(%rip),%rdi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<sig_handler>:
push   %rax
mov    0x2e90(%rip),%rax
cmp    %edi,(%rax)
jne    1180 <sig_handler+0x30>
lea    0xe9d(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1050 <__sort_fitness@plt>
xor    %eax,%eax
call   1060 <get_best_gene@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@SIGINT = global i32 0
@.str = [24 x i8] c"SIGINT ===============\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @sig_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIGINT
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (...) @__sort_fitness()
%9 = call i32 (...) @get_best_gene()
%10 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %6, %1
%12 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@SIGINT = global i32 0
@str = [23 x i8] c"SIGINT ===============\00"
define void @sig_handler(i32 %0) {
%2 = load i32, i32* @SIGINT
%3 = icmp eq i32 %2, %0
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 (...) @__sort_fitness()
%7 = tail call i32 (...) @get_best_gene()
%8 = tail call i32 @putchar(i32 10)
br label %9
9: ; preds = %4, %1
%10 = tail call i32 @exit(i32 -1)
unreachable
}