xunge/DecIR huggingface dataset:
int calculate_value() {
  asm("");
  return getdistance() / getspeed();
}


x86 assembly (clang, -O0):
<calculate_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getdistance@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getspeed@plt>
mov    %eax,%ecx
mov    -0x4(%rbp),%eax
cltd
idiv   %ecx
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate_value>:
push   %rbx
xor    %eax,%eax
call   1030 <getdistance@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getspeed@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
pop    %rbx
ret

LLVM IR (-O0):
define i32 @calculate_value() {
%1 = call i32 (...) @getdistance()
%2 = call i32 (...) @getspeed()
%3 = sdiv i32 %1, %2
ret i32 %3
}

LLVM IR (-O2):
define i32 @calculate_value() {
tail call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags}"()
%1 = tail call i32 (...) @getdistance()
%2 = tail call i32 (...) @getspeed()
%3 = sdiv i32 %1, %2
ret i32 %3
}
int defaultPayloadColor(void *payload) { return 0x00000000; }


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

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

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

LLVM IR (-O2):
define i32 @defaultPayloadColor(i8* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ print(char *);
int main() {
  print("Hola Mundo");
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [11 x i8] c"Hola Mundo\00"
define i32 @main() {
%1 = tail call i32 @print(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int testAdd(int a, int b) { return a + b; }


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

x86 assembly (clang, -O2):
<testAdd>:
lea    (%rdi,%rsi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @testAdd(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
scalar_t__ sqrt(float);
float SQRT(float var) { return (float)sqrt(var); }


x86 assembly (clang, -O0):
<SQRT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <sqrt@plt>
cvtsi2ss %rax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SQRT>:
push   %rax
call   1030 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @SQRT(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i64 @sqrt(float %3)
%5 = sitofp i64 %4 to float
ret float %5
}

LLVM IR (-O2):
define float @SQRT(float %0) {
%2 = tail call i64 @sqrt(float %0)
%3 = sitofp i64 %2 to float
ret float %3
}
void av_codec_iterate() {}


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

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

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

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


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

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

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

LLVM IR (-O2):
define void @foo13() {
ret void
}
void test() {
#pragma omp target teams
  ;
}


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

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

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

LLVM IR (-O2):
define void @test() {
ret void
}
/* Variables and functions */
char *strchr(const char *s, int c) {
  for (; *s != (char)c; ++s)
    if (*s == '\0')
      return NULL;
  return (char *)s;
}


x86 assembly (clang, -O0):
<strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x14(%rbp),%ecx
movsbl %cl,%ecx
cmp    %ecx,%eax
je     1153 <strchr+0x53>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    113d <strchr+0x3d>
movq   $0x0,-0x8(%rbp)
jmp    115b <strchr+0x5b>
jmp    1142 <strchr+0x42>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110b <strchr+0xb>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchr>:
mov    %rdi,%rax
movsbl %sil,%ecx
movsbl (%rdi),%edx
cmp    %edx,%ecx
je     1120 <strchr+0x20>
xchg   %ax,%ax
test   %dl,%dl
je     1121 <strchr+0x21>
movsbl 0x1(%rax),%edx
add    $0x1,%rax
cmp    %edx,%ecx
jne    1110 <strchr+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @strchr(i8* %0, i32 %1) {
%3 = shl i32 %1, 24
%4 = ashr exact i32 %3, 24
%5 = load i8, i8* %0
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %4, %6
br i1 %7, label %17, label %8
8: ; preds = %2, %12
%9 = phi i8 [ %14, %12 ], [ %5, %2 ]
%10 = phi i8* [ %13, %12 ], [ %0, %2 ]
%11 = icmp eq i8 %9, 0
br i1 %11, label %17, label %12
12: ; preds = %8
%13 = getelementptr inbounds i8, i8* %10, i64 1
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %4, %15
br i1 %16, label %17, label %8
17: ; preds = %8, %12, %2
%18 = phi i8* [ %0, %2 ], [ %13, %12 ], [ null, %8 ]
ret i8* %18
}
/* Variables and functions */
int /*<<< orphan*/ log_write(char *);
void log_br() {
  char line_break[81];
  for (int i = 0; i < 80; i++)
    line_break[i] = '-';
  line_break[80] = '\0';
  log_write(line_break);
}


x86 assembly (clang, -O0):
<log_br>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x64(%rbp)
cmpl   $0x50,-0x64(%rbp)
jge    1140 <log_br+0x30>
movslq -0x64(%rbp),%rax
movb   $0x2d,-0x60(%rbp,%rax,1)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    111f <log_br+0xf>
movb   $0x0,-0x10(%rbp)
lea    -0x60(%rbp),%rdi
call   1030 <log_write@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_br>:
sub    $0x58,%rsp
movaps 0xee5(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movb   $0x0,0x50(%rsp)
mov    %rsp,%rdi
call   1030 <log_write@plt>
add    $0x58,%rsp
ret

LLVM IR (-O0):
define void @log_br() {
%1 = alloca [81 x i8]
%2 = alloca i32
store i32 0, i32* %2
br label %3
3: ; preds = %10, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 80
br i1 %5, label %6, label %13
6: ; preds = %3
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [81 x i8], [81 x i8]* %1, i64 0, i64 %8
store i8 45, i8* %9
br label %10
10: ; preds = %6
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 1
store i32 %12, i32* %2
br label %3
13: ; preds = %3
%14 = getelementptr inbounds [81 x i8], [81 x i8]* %1, i64 0, i64 80
store i8 0, i8* %14
%15 = getelementptr inbounds [81 x i8], [81 x i8]* %1, i64 0, i64 0
%16 = call i32 @log_write(i8* %15)
ret void
}

LLVM IR (-O2):
define void @log_br() {
%1 = alloca [81 x i8]
%2 = getelementptr inbounds [81 x i8], [81 x i8]* %1, i64 0, i64 0
%3 = getelementptr inbounds [81 x i8], [81 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [81 x i8], [81 x i8]* %1, i64 0, i64 80
store i8 0, i8* %4
%5 = call i32 @log_write(i8* %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
void usage(char *program) {
  printf("usage: %s <+interface/local-IPv6/mask/my-UDP-port/peer-UDP-port> "
         "(<destination/gateway/mask/interface>...)...\n",
         program);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [111 x i8] c"usage: %s <+interface/local-IPv6/mask/my-UDP-port/peer-UDP-port> (<destination/gateway/mask/interface>...)...\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([111 x i8], [111 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [111 x i8] c"usage: %s <+interface/local-IPv6/mask/my-UDP-port/peer-UDP-port> (<destination/gateway/mask/interface>...)...\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([111 x i8], [111 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
void alias() {
  int x;
  int *ip = &x;
  float *fp = (float *)ip;
}


x86 assembly (clang, -O0):
<alias>:
push   %rbp
mov    %rsp,%rbp
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @alias() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca float*
store i32* %1, i32** %2
%4 = load i32*, i32** %2
%5 = bitcast i32* %4 to float*
store float* %5, float** %3
ret void
}

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

/* Variables and functions */
int randLIB_get_64bit();
uint32_t randLIB_get_32bit(void) {
  uint64_t r = randLIB_get_64bit();
  return (uint32_t)(r >> 32);
}


x86 assembly (clang, -O0):
<randLIB_get_32bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <randLIB_get_64bit@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x20,%ecx
sar    %cl,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @randLIB_get_32bit() {
%1 = alloca i32
%2 = call i32 (...) @randLIB_get_64bit()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = ashr i32 %3, 32
ret i32 %4
}

LLVM IR (-O2):
define i32 @randLIB_get_32bit() {
%1 = tail call i32 (...) @randLIB_get_64bit()
ret i32 poison
}
/* Type definitions */
typedef int /*<<< orphan*/ volatile uint8_t;
typedef scalar_t__ uint32_t;

/* Variables and functions */
__attribute__((section(".flash.text.Read"))) uint8_t FlashRead(uint32_t addr) {
  return *((volatile uint8_t *)addr);
}


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

x86 assembly (clang, -O2):
<FlashRead>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @FlashRead(i64 %0) section ".flash.text.Read" {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = inttoptr i64 %3 to i32*
%5 = load volatile i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @FlashRead(i64 %0) section ".flash.text.Read" {
%2 = inttoptr i64 %0 to i32*
%3 = load volatile i32, i32* %2
ret i32 %3
}
/* Variables and functions */
int *malloc(int);
int *increment(int *x) {
  int *result = malloc(sizeof(int));
  *result = (*x) + 1;
  return result;
}


x86 assembly (clang, -O0):
<increment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<increment>:
push   %rbx
mov    %rdi,%rbx
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    (%rbx),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
pop    %rbx
ret

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

LLVM IR (-O2):
define noalias i32* @increment(i32* nocapture %0) {
%2 = tail call i32* @malloc(i32 4)
%3 = load i32, i32* %0
%4 = add nsw i32 %3, 1
store i32 %4, i32* %2
ret i32* %2
}
/* Variables and functions */
int /*<<< orphan*/ _ACC_init(int, char **);
void acc_init_(int *argc, char **argv) { _ACC_init(*argc, argv); }


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

x86 assembly (clang, -O2):
<acc_init_>:
mov    (%rdi),%edi
jmp    1030 <_ACC_init@plt>

LLVM IR (-O0):
define void @acc_init_(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 i32, i32* %5
%7 = load i8**, i8*** %4
%8 = call i32 @_ACC_init(i32 %6, i8** %7)
ret void
}

LLVM IR (-O2):
define void @acc_init_(i32* nocapture %0, i8** %1) {
%3 = load i32, i32* %0
%4 = tail call i32 @_ACC_init(i32 %3, i8** %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void cidr_destroy(void *cidr) {
  if (cidr) {
    free(cidr);
    cidr = NULL;
  }
}


x86 assembly (clang, -O0):
<cidr_destroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1138 <cidr_destroy+0x28>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cidr_destroy>:
test   %rdi,%rdi
je     111a <cidr_destroy+0xa>
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
define void @cidr_destroy(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @free(i8* %6)
store i8* null, i8** %2
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @cidr_destroy(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t mcnet_read_uint16(uint8_t *in) { return (in[0] << 8) + in[1]; }


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

x86 assembly (clang, -O2):
<mcnet_read_uint16>:
mov    (%rdi),%eax
shl    $0x8,%eax
add    0x4(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @mcnet_read_uint16(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = shl i32 %2, 8
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = add nsw i32 %3, %5
ret i32 %6
}
unsigned long long
nlm_crypto_form_rsa_ecc_fmn_entry0(unsigned int l3alloc, unsigned int type,
                                   unsigned int func,
                                   unsigned long long srcaddr) {
  return ((unsigned long long)(l3alloc) << (61)) |
         ((unsigned long long)(type) << (46)) |
         ((unsigned long long)(func) << (40)) |
         ((unsigned long long)(srcaddr) << (0));
}


x86 assembly (clang, -O0):
<nlm_crypto_form_rsa_ecc_fmn_entry0>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x3d,%rax
mov    -0x8(%rbp),%ecx
shl    $0x2e,%rcx
or     %rcx,%rax
mov    -0xc(%rbp),%ecx
shl    $0x28,%rcx
or     %rcx,%rax
mov    -0x18(%rbp),%rcx
shl    $0x0,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nlm_crypto_form_rsa_ecc_fmn_entry0>:
mov    %edx,%eax
shl    $0x3d,%rdi
shl    $0x2e,%rsi
or     %rdi,%rsi
shl    $0x28,%rax
or     %rcx,%rax
or     %rsi,%rax
ret

LLVM IR (-O0):
define i64 @nlm_crypto_form_rsa_ecc_fmn_entry0(i32 %0, i32 %1, i32 %2, i64 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i64 %3, i64* %8
%9 = load i32, i32* %5
%10 = zext i32 %9 to i64
%11 = shl i64 %10, 61
%12 = load i32, i32* %6
%13 = zext i32 %12 to i64
%14 = shl i64 %13, 46
%15 = or i64 %11, %14
%16 = load i32, i32* %7
%17 = zext i32 %16 to i64
%18 = shl i64 %17, 40
%19 = or i64 %15, %18
%20 = load i64, i64* %8
%21 = shl i64 %20, 0
%22 = or i64 %19, %21
ret i64 %22
}

LLVM IR (-O2):
define i64 @nlm_crypto_form_rsa_ecc_fmn_entry0(i32 %0, i32 %1, i32 %2, i64 %3) {
%5 = zext i32 %0 to i64
%6 = shl i64 %5, 61
%7 = zext i32 %1 to i64
%8 = shl i64 %7, 46
%9 = or i64 %8, %6
%10 = zext i32 %2 to i64
%11 = shl i64 %10, 40
%12 = or i64 %9, %3
%13 = or i64 %12, %11
ret i64 %13
}
/* Variables and functions */
int bitcount(char);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int ret = 0;
  char x = -128;
  printf("The result is %d", bitcount(x));
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movb   $0x80,-0x9(%rbp)
movsbl -0x9(%rbp),%edi
call   1040 <bitcount@plt>
mov    %eax,%esi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [17 x i8] c"The result is %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
store i32 0, i32* %1
store i32 0, i32* %2
store i8 -128, i8* %3
%4 = load i8, i8* %3
%5 = call i32 @bitcount(i8 signext %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %2
ret i32 %7
}

LLVM IR (-O2):
@.str = [17 x i8] c"The result is %d\00"
define i32 @main() {
%1 = tail call i32 @bitcount(i8 signext -128)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int rand();
void randomqtdPayer(int *qtdPayer) { *qtdPayer = rand() % 5000; }


x86 assembly (clang, -O0):
<randomqtdPayer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x1388,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%rax
mov    %edx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randomqtdPayer>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x68db8bad,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x2b,%rcx
add    %edx,%ecx
imul   $0x1388,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @randomqtdPayer(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = call i32 (...) @rand()
%4 = srem i32 %3, 5000
%5 = load i32*, i32** %2
store i32 %4, i32* %5
ret void
}

LLVM IR (-O2):
define void @randomqtdPayer(i32* nocapture writeonly %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, 5000
store i32 %3, i32* %0
ret void
}
void memleak_typeid_raw(const void *ptr, unsigned long type_id) {}


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

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

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

LLVM IR (-O2):
define void @memleak_typeid_raw(i8* nocapture %0, i64 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void do_something_1() { printf("doing work 1\n"); }


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"doing work 1\0A\00"
define void @do_something_1() {
%1 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [13 x i8] c"doing work 1\00"
define void @do_something_1() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret void
}
int iscntrl(int c) { return ((c > 0x0 && c < 0x1F) || c == 0x7F) ? 1 : 0; }


x86 assembly (clang, -O0):
<iscntrl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1120 <iscntrl+0x20>
mov    $0x1,%al
cmpl   $0x1f,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     112a <iscntrl+0x2a>
cmpl   $0x7f,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<iscntrl>:
lea    -0x1(%rdi),%eax
cmp    $0x1e,%eax
setb   %al
cmp    $0x7f,%edi
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @iscntrl(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 31
br i1 %7, label %11, label %8
8: ; preds = %5, %1
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 127
br label %11
11: ; preds = %8, %5
%12 = phi i1 [ true, %5 ], [ %10, %8 ]
%13 = zext i1 %12 to i64
%14 = select i1 %12, i32 1, i32 0
ret i32 %14
}

LLVM IR (-O2):
define i32 @iscntrl(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 30
%4 = icmp eq i32 %0, 127
%5 = or i1 %4, %3
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int getbyte();
int get16() {
  int l_byte, h_byte;
  l_byte = getbyte();
  h_byte = getbyte();
  if (h_byte >= 128)
    h_byte -= 256;
  return l_byte | (h_byte << 8);
}


x86 assembly (clang, -O0):
<get16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getbyte@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getbyte@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x80,-0x8(%rbp)
jl     1144 <get16+0x34>
mov    -0x8(%rbp),%eax
sub    $0x100,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get16>:
push   %rbx
xor    %eax,%eax
call   1030 <getbyte@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <getbyte@plt>
mov    %eax,%edx
shl    $0x8,%edx
lea    -0x10000(%rdx),%ecx
cmp    $0x7f,%eax
cmovle %edx,%ecx
or     %ebx,%ecx
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @get16() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @getbyte()
store i32 %3, i32* %1
%4 = call i32 (...) @getbyte()
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp sge i32 %5, 128
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = load i32, i32* %2
%9 = sub nsw i32 %8, 256
store i32 %9, i32* %2
br label %10
10: ; preds = %7, %0
%11 = load i32, i32* %1
%12 = load i32, i32* %2
%13 = shl i32 %12, 8
%14 = or i32 %11, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @get16() {
%1 = tail call i32 (...) @getbyte()
%2 = tail call i32 (...) @getbyte()
%3 = icmp sgt i32 %2, 127
%4 = shl i32 %2, 8
%5 = add i32 %4, -65536
%6 = select i1 %3, i32 %5, i32 %4
%7 = or i32 %6, %1
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ core3_print(char *, char *, char const *);
void U_EMRSETPOLYFILLMODE_print(const char *contents) {
  core3_print("U_EMRSETPOLYFILLMODE", "iMode:", contents);
}


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

x86 assembly (clang, -O2):
<U_EMRSETPOLYFILLMODE_print>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rdi
lea    0xef4(%rip),%rsi
jmp    1030 <core3_print@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"U_EMRSETPOLYFILLMODE\00"
@.str.1 = [7 x i8] c"iMode:\00"
define void @U_EMRSETPOLYFILLMODE_print(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @core3_print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"U_EMRSETPOLYFILLMODE\00"
@.str.1 = [7 x i8] c"iMode:\00"
define void @U_EMRSETPOLYFILLMODE_print(i8* %0) {
%2 = tail call i32 @core3_print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}
int clearBitsThroughI(int x, int i) { return (x & (-1 << i)); }


x86 assembly (clang, -O0):
<clearBitsThroughI>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    $0xffffffff,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clearBitsThroughI>:
mov    %esi,%ecx
mov    %edi,%eax
shr    %cl,%eax
shl    %cl,%eax
ret

LLVM IR (-O0):
define i32 @clearBitsThroughI(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 = shl i32 -1, %6
%8 = and i32 %5, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @clearBitsThroughI(i32 %0, i32 %1) {
%3 = shl nsw i32 -1, %1
%4 = and i32 %3, %0
ret i32 %4
}
/* Variables and functions */
unsigned int sleep(unsigned int);
int /*<<< orphan*/ unix_error(char *);
unsigned int csapp_sleep(unsigned int secs) {
  unsigned int rc;
  if ((rc = sleep(secs)) < 0)
    unix_error("sleep error");
  return rc;
}


x86 assembly (clang, -O0):
<csapp_sleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <sleep@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jae    114b <csapp_sleep+0x2b>
lea    0xeba(%rip),%rdi
call   1030 <unix_error@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<csapp_sleep>:
jmp    1030 <sleep@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"sleep error\00"
define i32 @csapp_sleep(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @sleep(i32 %4)
store i32 %5, i32* %3
%6 = icmp ult i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @unix_error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
define i32 @csapp_sleep(i32 %0) {
%2 = tail call i32 @sleep(i32 %0)
ret i32 %2
}
void wx11pk(pkg) char pkg[];
{}


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

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

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

LLVM IR (-O2):
define void @wx11pk(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main(void) {
  char colour[50];
  printf("What's your favourite colour?\n");
  scanf("%49s", colour);
  printf("The First Letter of your Favourite Colour is: %c\n", colour[0]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    0xed7(%rip),%rdi
call   1040 <scanf@plt>
movsbl -0x40(%rbp),%esi
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
lea    0xefc(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
movsbl (%rsp),%esi
lea    0xeab(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"What's your favourite colour?\0A\00"
@.str.1 = [5 x i8] c"%49s\00"
@.str.2 = [50 x i8] c"The First Letter of your Favourite Colour is: %c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [50 x i8]
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"%49s\00"
@.str.2 = [50 x i8] c"The First Letter of your Favourite Colour is: %c\0A\00"
@str = [30 x i8] c"What's your favourite colour?\00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret i32 0
}
/* Type definitions */
struct hostent {
  int dummy;
};

/* Variables and functions */
struct hostent *gethostbyname2(char const *, int);
int h_errno;
struct hostent *getipnodebyname(const char *name, int af, int flags,
                                int *error_num) {
  struct hostent *hostent = gethostbyname2(name, af);
  if (!hostent && error_num)
    *error_num = h_errno;
  return hostent;
}


x86 assembly (clang, -O0):
<getipnodebyname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <gethostbyname2@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    115b <getipnodebyname+0x4b>
cmpq   $0x0,-0x18(%rbp)
je     115b <getipnodebyname+0x4b>
mov    0x2e95(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getipnodebyname>:
push   %rbx
mov    %rcx,%rbx
call   1030 <gethostbyname2@plt>
test   %rbx,%rbx
je     112e <getipnodebyname+0x1e>
test   %rax,%rax
jne    112e <getipnodebyname+0x1e>
mov    0x2ebe(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
%struct.hostent = type { i32 }
@h_errno = global i32 0
define %struct.hostent* @getipnodebyname(i8* %0, i32 %1, i32 %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca %struct.hostent*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32* %3, i32** %8
%10 = load i8*, i8** %5
%11 = load i32, i32* %6
%12 = call %struct.hostent* @gethostbyname2(i8* %10, i32 %11)
store %struct.hostent* %12, %struct.hostent** %9
%13 = load %struct.hostent*, %struct.hostent** %9
%14 = icmp ne %struct.hostent* %13, null
br i1 %14, label %21, label %15
15: ; preds = %4
%16 = load i32*, i32** %8
%17 = icmp ne i32* %16, null
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i32, i32* @h_errno
%20 = load i32*, i32** %8
store i32 %19, i32* %20
br label %21
21: ; preds = %18, %15, %4
%22 = load %struct.hostent*, %struct.hostent** %9
ret %struct.hostent* %22
}

LLVM IR (-O2):
%struct.hostent = type { i32 }
@h_errno = global i32 0
define %struct.hostent* @getipnodebyname(i8* %0, i32 %1, i32 %2, i32* writeonly %3) {
%5 = tail call %struct.hostent* @gethostbyname2(i8* %0, i32 %1)
%6 = icmp eq %struct.hostent* %5, null
%7 = icmp ne i32* %3, null
%8 = and i1 %7, %6
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = load i32, i32* @h_errno
store i32 %10, i32* %3
br label %11
11: ; preds = %9, %4
ret %struct.hostent* %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ slen(char *);
int /*<<< orphan*/ swap(char *, int /*<<< orphan*/);
int main() {
  char str[100];
  scanf("%s", str);
  swap(str, slen(str));
  printf("%s", str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xea3(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x70(%rbp),%rax
mov    %rax,-0x78(%rbp)
lea    -0x70(%rbp),%rdi
call   1030 <slen@plt>
mov    -0x78(%rbp),%rdi
mov    %eax,%esi
call   1060 <swap@plt>
lea    -0x70(%rbp),%rsi
lea    0xe77(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x68,%rsp
lea    0xeb2(%rip),%r14
mov    %rsp,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1030 <slen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1060 <swap@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
store i32 0, i32* %1
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%7 = call i32 @slen(i8* %6)
%8 = call i32 @swap(i8* %5, i32 %7)
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%10 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @slen(i8* %2)
%5 = call i32 @swap(i8* %2, i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char, int);
int /*<<< orphan*/ stderr;
void l(int x) { fprintf(stderr, "%c%d\n", 'l', x); }


x86 assembly (clang, -O0):
<l>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ebe(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%ecx
lea    0xed2(%rip),%rsi
mov    $0x6c,%edx
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<l>:
mov    %edi,%ecx
mov    0x2ec7(%rip),%rax
mov    (%rax),%edi
lea    0xede(%rip),%rsi
mov    $0x6c,%edx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [6 x i8] c"%c%d\0A\00"
define void @l(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @stderr
%4 = load i32, i32* %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8 signext 108, i32 %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [6 x i8] c"%c%d\0A\00"
define void @l(i32 %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8 signext 108, i32 %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int int32_t;

/* Variables and functions */
int _write(int32_t file, uint8_t *ptr, int32_t len) { return len; }


x86 assembly (clang, -O0):
<_write>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_write>:
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @_write(i32 %0, i32* nocapture readnone %1, i32 returned %2) {
ret i32 %2
}
int __atomic_cmpxchg(int *ptr, int old, int new) {
  return __sync_val_compare_and_swap(ptr, old, new);
}


x86 assembly (clang, -O0):
<__atomic_cmpxchg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%edx
lock cmpxchg %edx,(%rcx)
sete   %cl
pop    %rbp
ret

x86 assembly (clang, -O2):
<__atomic_cmpxchg>:
mov    %esi,%eax
lock cmpxchg %edx,(%rdi)
ret

LLVM IR (-O0):
define i32 @__atomic_cmpxchg(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = cmpxchg i32* %7, i32 %8, i32 %9 seq_cst seq_cst
%11 = extractvalue { i32, i1 } %10, 0
ret i32 %11
}

LLVM IR (-O2):
define i32 @__atomic_cmpxchg(i32* nocapture %0, i32 %1, i32 %2) {
%4 = cmpxchg i32* %0, i32 %1, i32 %2 seq_cst seq_cst
%5 = extractvalue { i32, i1 } %4, 0
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void ErrorExit() { exit(1); }


x86 assembly (clang, -O0):
<ErrorExit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <exit@plt>

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

LLVM IR (-O0):
define void @ErrorExit() {
%1 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @ErrorExit() {
%1 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef char *const_nis_name;

/* Variables and functions */
char *strchr(char *, char);
const_nis_name __nis_domain_of(const_nis_name name) {
  const_nis_name cptr = strchr(name, '.');
  if (cptr == NULL)
    return "";
  if (*++cptr == '\0')
    return ".";
  return cptr;
}


x86 assembly (clang, -O0):
<__nis_domain_of>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1149 <__nis_domain_of+0x39>
lea    0xec1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117d <__nis_domain_of+0x6d>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
jne    1175 <__nis_domain_of+0x65>
lea    0xe94(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117d <__nis_domain_of+0x6d>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__nis_domain_of>:
push   %rax
mov    $0x2e,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1138 <__nis_domain_of+0x28>
mov    %rax,%rcx
add    $0x1,%rcx
cmpb   $0x0,0x1(%rax)
lea    0xece(%rip),%rax
cmovne %rcx,%rax
pop    %rcx
ret
lea    0xec2(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c".\00"
define i8* @__nis_domain_of(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @strchr(i8* %5, i8 signext 46)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %10
9: ; preds = %1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %2
br label %19
10: ; preds = %1
%11 = load i8*, i8** %4
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %4
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %10
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %19
17: ; preds = %10
%18 = load i8*, i8** %4
store i8* %18, i8** %2
br label %19
19: ; preds = %17, %16, %9
%20 = load i8*, i8** %2
ret i8* %20
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c".\00"
define i8* @__nis_domain_of(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 46)
%3 = icmp eq i8* %2, null
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %2, i64 1
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
%8 = select i1 %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %5
br label %9
9: ; preds = %4, %1
%10 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %1 ], [ %8, %4 ]
ret i8* %10
}
/* Variables and functions */
char islower(unsigned char c) {
  if (c >= ((unsigned char)'a') && c <= ((unsigned char)'z'))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<islower>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movzbl -0x2(%rbp),%eax
cmp    $0x61,%eax
jl     112d <islower+0x2d>
movzbl -0x2(%rbp),%eax
cmp    $0x7a,%eax
jg     112d <islower+0x2d>
movb   $0x1,-0x1(%rbp)
jmp    1131 <islower+0x31>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define signext i8 @islower(i8 zeroext %0) {
%2 = add i8 %0, -97
%3 = icmp ult i8 %2, 26
%4 = zext i1 %3 to i8
ret i8 %4
}
const char *ls_costN_nm6_name_out(int i) {
  switch (i) {
  case 0:
    return "o0";
  case 1:
    return "o1";
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<ls_costN_nm6_name_out>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     112b <ls_costN_nm6_name_out+0x2b>
jmp    111a <ls_costN_nm6_name_out+0x1a>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     113b <ls_costN_nm6_name_out+0x3b>
jmp    114b <ls_costN_nm6_name_out+0x4b>
lea    0xece(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1153 <ls_costN_nm6_name_out+0x53>
lea    0xec1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1153 <ls_costN_nm6_name_out+0x53>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ls_costN_nm6_name_out>:
xor    %ecx,%ecx
cmp    $0x1,%edi
lea    0xef7(%rip),%rax
cmove  %rax,%rcx
test   %edi,%edi
lea    0xee7(%rip),%rax
cmovne %rcx,%rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"o0\00"
@.str.1 = [3 x i8] c"o1\00"
define i8* @ls_costN_nm6_name_out(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %7 [
i32 0, label %5
i32 1, label %6
]
5: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %2
br label %8
6: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %8
7: ; preds = %1
store i8* null, i8** %2
br label %8
8: ; preds = %7, %6, %5
%9 = load i8*, i8** %2
ret i8* %9
}

LLVM IR (-O2):
@.str = [3 x i8] c"o0\00"
@.str.1 = [3 x i8] c"o1\00"
define i8* @ls_costN_nm6_name_out(i32 %0) {
%2 = icmp eq i32 %0, 1
%3 = select i1 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* null
%4 = icmp eq i32 %0, 0
%5 = select i1 %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3
ret i8* %5
}
int lg4ff_init(struct hid_device *hdev) { return -1; }


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

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

LLVM IR (-O0):
%struct.hid_device = type opaque
define i32 @lg4ff_init(%struct.hid_device* %0) {
%2 = alloca %struct.hid_device*
store %struct.hid_device* %0, %struct.hid_device** %2
ret i32 -1
}

LLVM IR (-O2):
%struct.hid_device = type opaque
define i32 @lg4ff_init(%struct.hid_device* nocapture readnone %0) {
ret i32 -1
}
int abc(int argc, char *argv[]) {}


x86 assembly (clang, -O0):
<abc>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @abc(i32 %0, i8** nocapture readnone %1) {
ret i32 undef
}
void writeVAC(unsigned long add, unsigned long data) {
  *((unsigned long *)(((0xFFFD0000 | (add << 8)) >> 2) | 0xB0000000)) =
      (data << 16);
}


x86 assembly (clang, -O0):
<writeVAC>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
shl    $0x10,%rcx
mov    -0x8(%rbp),%rax
shl    $0x8,%rax
movabs $0xfffd0000,%rdx
or     %rdx,%rax
shr    $0x2,%rax
movabs $0xb0000000,%rdx
or     %rdx,%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeVAC>:
shl    $0x10,%rsi
shl    $0x6,%rdi
movabs $0x3fffffff4000bfc0,%rax
ff ff 3f
and    %rdi,%rax
mov    $0xbfff4000,%ecx
mov    %rsi,(%rax,%rcx,1)
ret

LLVM IR (-O0):
define void @writeVAC(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = shl i64 %5, 16
%7 = load i64, i64* %3
%8 = shl i64 %7, 8
%9 = or i64 4294770688, %8
%10 = lshr i64 %9, 2
%11 = or i64 %10, 2952790016
%12 = inttoptr i64 %11 to i64*
store i64 %6, i64* %12
ret void
}

LLVM IR (-O2):
define void @writeVAC(i64 %0, i64 %1) {
%3 = shl i64 %1, 16
%4 = shl i64 %0, 6
%5 = and i64 %4, 4611686015206211520
%6 = or i64 %5, 3221176320
%7 = inttoptr i64 %6 to i64*
store i64 %3, i64* %7
ret void
}
int do_650() { return 650; }


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

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

LLVM IR (-O0):
define i32 @do_650() {
ret i32 650
}

LLVM IR (-O2):
define i32 @do_650() {
ret i32 650
}