xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint32_t;
typedef int uint16_t;
struct hle_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ alist_load(struct hle_t *, int, int, int);
void LOADBUFF(struct hle_t *hle, uint32_t w1, uint32_t w2) {
  uint16_t count = (w1 >> 12) & 0xfff;
  uint16_t dmem = (w1 & 0xfff);
  uint32_t address = (w2 & 0xffffff);
  alist_load(hle, dmem, address, count);
}


x86 assembly (clang, -O0):
<LOADBUFF>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
sar    $0xc,%eax
and    $0xfff,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
and    $0xfff,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
and    $0xffffff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1030 <alist_load@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LOADBUFF>:
mov    %esi,%ecx
shr    $0xc,%ecx
and    $0xfff,%ecx
and    $0xfff,%esi
and    $0xffffff,%edx
jmp    1030 <alist_load@plt>

LLVM IR (-O0):
%struct.hle_t = type { i32 }
define void @LOADBUFF(%struct.hle_t* %0, i32 %1, i32 %2) {
%4 = alloca %struct.hle_t*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store %struct.hle_t* %0, %struct.hle_t** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%10 = load i32, i32* %5
%11 = ashr i32 %10, 12
%12 = and i32 %11, 4095
store i32 %12, i32* %7
%13 = load i32, i32* %5
%14 = and i32 %13, 4095
store i32 %14, i32* %8
%15 = load i32, i32* %6
%16 = and i32 %15, 16777215
store i32 %16, i32* %9
%17 = load %struct.hle_t*, %struct.hle_t** %4
%18 = load i32, i32* %8
%19 = load i32, i32* %9
%20 = load i32, i32* %7
%21 = call i32 @alist_load(%struct.hle_t* %17, i32 %18, i32 %19, i32 %20)
ret void
}

LLVM IR (-O2):
%struct.hle_t = type { i32 }
define void @LOADBUFF(%struct.hle_t* %0, i32 %1, i32 %2) {
%4 = lshr i32 %1, 12
%5 = and i32 %4, 4095
%6 = and i32 %1, 4095
%7 = and i32 %2, 16777215
%8 = tail call i32 @alist_load(%struct.hle_t* %0, i32 %6, i32 %7, i32 %5)
ret void
}
void F_H(int **A) { *A = (int *)0; }


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

x86 assembly (clang, -O2):
<F_H>:
movq   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
define void @F_H(i32** nocapture writeonly %0) {
store i32* null, i32** %0
ret void
}
__attribute__((always_)) void native_write_cr8(unsigned long val) {
  asm volatile("movq %0,%%cr8" ::"r"(val) : "memory");
}


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

x86 assembly (clang, -O2):
<native_write_cr8>:
mov    %rdi,%cr8
ret

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

LLVM IR (-O2):
define void @native_write_cr8(i64 %0) {
tail call void asm sideeffect "movq $0,%cr8", "r,~{memory},~{dirflag},~{fpsr},~{flags}"(i64 %0)
ret void
}
/* Variables and functions */
char *basename(char *);
char *strdup(char const *);
char *getFileNameFromPath(const char *path) {
  char *pathCopy = strdup(path);
  return basename(pathCopy);
}


x86 assembly (clang, -O0):
<getFileNameFromPath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <basename@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getFileNameFromPath>:
push   %rax
call   1040 <strdup@plt>
mov    %rax,%rdi
pop    %rax
jmp    1030 <basename@plt>

LLVM IR (-O0):
define i8* @getFileNameFromPath(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strdup(i8* %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = call i8* @basename(i8* %6)
ret i8* %7
}

LLVM IR (-O2):
define i8* @getFileNameFromPath(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = tail call i8* @basename(i8* %2)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ OPM_err(int);
void OPT_err(int n) { OPM_err(n); }


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

x86 assembly (clang, -O2):
<OPT_err>:
jmp    1030 <OPM_err@plt>

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

LLVM IR (-O2):
define void @OPT_err(i32 %0) {
%2 = tail call i32 @OPM_err(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ DS3231_Write(int, int);
void DS3231_init() {
  DS3231_Write(0x0E, 0x00);
  DS3231_Write(0x0F, 0x08);
}


x86 assembly (clang, -O0):
<DS3231_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe,%edi
xor    %esi,%esi
call   1030 <DS3231_Write@plt>
mov    $0xf,%edi
mov    $0x8,%esi
call   1030 <DS3231_Write@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<DS3231_init>:
push   %rax
mov    $0xe,%edi
xor    %esi,%esi
call   1030 <DS3231_Write@plt>
mov    $0xf,%edi
mov    $0x8,%esi
pop    %rax
jmp    1030 <DS3231_Write@plt>

LLVM IR (-O0):
define void @DS3231_init() {
%1 = call i32 @DS3231_Write(i32 14, i32 0)
%2 = call i32 @DS3231_Write(i32 15, i32 8)
ret void
}

LLVM IR (-O2):
define void @DS3231_init() {
%1 = tail call i32 @DS3231_Write(i32 14, i32 0)
%2 = tail call i32 @DS3231_Write(i32 15, i32 8)
ret void
}
int socket_v_rel(void) { return 0x20150831; }


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

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

LLVM IR (-O0):
define i32 @socket_v_rel() {
ret i32 538249265
}

LLVM IR (-O2):
define i32 @socket_v_rel() {
ret i32 538249265
}
/* Variables and functions */
int /*<<< orphan*/ preempt_enable();
void preempt_enable_no_resched(void) { preempt_enable(); }


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

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

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

LLVM IR (-O2):
define void @preempt_enable_no_resched() {
%1 = tail call i32 (...) @preempt_enable()
ret void
}
/* Variables and functions */
char *getenv(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
void get_config_path(char *config_path) {
  sprintf(config_path, "%s%s", getenv("HOME"), "/.kbpm/process_list.json");
}


x86 assembly (clang, -O0):
<get_config_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <getenv@plt>
mov    -0x10(%rbp),%rdi
mov    %rax,%rdx
lea    0xeb2(%rip),%rsi
lea    0xeb5(%rip),%rcx
call   1040 <sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_config_path>:
push   %rbx
mov    %rdi,%rbx
lea    0xeda(%rip),%rdi
call   1030 <getenv@plt>
lea    0xec9(%rip),%rsi
lea    0xecc(%rip),%rcx
mov    %rbx,%rdi
mov    %rax,%rdx
pop    %rbx
jmp    1040 <sprintf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%s%s\00"
@.str.1 = [5 x i8] c"HOME\00"
@.str.2 = [25 x i8] c"/.kbpm/process_list.json\00"
define void @get_config_path(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @sprintf(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %4, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s%s\00"
@.str.1 = [5 x i8] c"HOME\00"
@.str.2 = [25 x i8] c"/.kbpm/process_list.json\00"
define void @get_config_path(i8* nocapture writeonly %0) {
%2 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %2, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
ret void
}
brc(pn, c) int pn;
char c;
{ printf("%c[%d%c", 27, pn, c); }


x86 assembly (clang, -O0):
<brc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %edi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%edx
movsbl -0x9(%rbp),%ecx
lea    0xed1(%rip),%rdi
mov    $0x1b,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<brc>:
mov    %edi,%edx
movsbl %sil,%ecx
lea    0xee3(%rip),%rdi
mov    $0x1b,%esi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"%c[%d%c\00"
define i32 @brc(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
%6 = trunc i32 %1 to i8
store i32 %0, i32* %4
store i8 %6, i8* %5
%7 = load i32, i32* %4
%8 = load i8, i8* %5
%9 = sext i8 %8 to i32
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 27, i32 %7, i32 %9)
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
@.str = [8 x i8] c"%c[%d%c\00"
define i32 @brc(i32 %0, i32 %1) {
%3 = shl i32 %1, 24
%4 = ashr exact i32 %3, 24
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 27, i32 %0, i32 %4)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ OldFunction();
int main(int argc, const char *argv[]) { OldFunction(); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <OldFunction@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @OldFunction()
ret i32 0
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ itoa(int, char *, int);
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  char s[100];
  itoa(-128, s, 10);
  printf("%s\n", s);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rsi
mov    $0xffffff80,%edi
mov    $0xa,%edx
call   1040 <itoa@plt>
lea    -0x70(%rbp),%rsi
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e87(%rip),%rax
mov    (%rax),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
mov    %rsp,%rbx
mov    $0xffffff80,%edi
mov    %rbx,%rsi
mov    $0xa,%edx
call   1040 <itoa@plt>
lea    0xebf(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    0x2e90(%rip),%rax
mov    (%rax),%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@EXIT_SUCCESS = global i32 0
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 @itoa(i32 -128, i8* %3, i32 10)
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i32, i32* @EXIT_SUCCESS
ret i32 %7
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@EXIT_SUCCESS = global i32 0
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 @itoa(i32 -128, i8* %2, i32 10)
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = load i32, i32* @EXIT_SUCCESS
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ wiznetRegWriteByte(int /*<<< orphan*/, int,
                                      int /*<<< orphan*/);
void wiznetSetSocketKeepAliveTime(uint8_t socket, uint8_t time) {
  wiznetRegWriteByte(socket, (0x0000 + 0x002F), time);
}


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

x86 assembly (clang, -O2):
<wiznetSetSocketKeepAliveTime>:
mov    %esi,%edx
mov    $0x2f,%esi
jmp    1030 <wiznetRegWriteByte@plt>

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

LLVM IR (-O2):
define void @wiznetSetSocketKeepAliveTime(i32 %0, i32 %1) {
%3 = tail call i32 @wiznetRegWriteByte(i32 %0, i32 47, i32 %1)
ret void
}
void __attribute__((no, noclone)) test2(int x) {
  if ((2 << x) != 1 && (8 << x) != 1 && (8 << x) != 2 && (3072 << x) != 3 &&
      (294912 << x) != 9 && (45056 << x) != 11 && (2176 << x) != 17)
    ;
  else
    __builtin_abort();
}


x86 assembly (clang, -O0):
<test2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0x2,%eax
shl    %cl,%eax
cmp    $0x1,%eax
je     11a5 <test2+0x95>
mov    -0x4(%rbp),%ecx
mov    $0x8,%eax
shl    %cl,%eax
cmp    $0x1,%eax
je     11a5 <test2+0x95>
mov    -0x4(%rbp),%ecx
mov    $0x8,%eax
shl    %cl,%eax
cmp    $0x2,%eax
je     11a5 <test2+0x95>
mov    -0x4(%rbp),%ecx
mov    $0xc00,%eax
shl    %cl,%eax
cmp    $0x3,%eax
je     11a5 <test2+0x95>
mov    -0x4(%rbp),%ecx
mov    $0x48000,%eax
shl    %cl,%eax
cmp    $0x9,%eax
je     11a5 <test2+0x95>
mov    -0x4(%rbp),%ecx
mov    $0xb000,%eax
shl    %cl,%eax
cmp    $0xb,%eax
je     11a5 <test2+0x95>
mov    -0x4(%rbp),%ecx
mov    $0x880,%eax
shl    %cl,%eax
cmp    $0x11,%eax
je     11a5 <test2+0x95>
jmp    11aa <test2+0x9a>
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @test2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 2, %3
%5 = icmp ne i32 %4, 1
br i1 %5, label %6, label %31
6: ; preds = %1
%7 = load i32, i32* %2
%8 = shl i32 8, %7
%9 = icmp ne i32 %8, 1
br i1 %9, label %10, label %31
10: ; preds = %6
%11 = load i32, i32* %2
%12 = shl i32 8, %11
%13 = icmp ne i32 %12, 2
br i1 %13, label %14, label %31
14: ; preds = %10
%15 = load i32, i32* %2
%16 = shl i32 3072, %15
%17 = icmp ne i32 %16, 3
br i1 %17, label %18, label %31
18: ; preds = %14
%19 = load i32, i32* %2
%20 = shl i32 294912, %19
%21 = icmp ne i32 %20, 9
br i1 %21, label %22, label %31
22: ; preds = %18
%23 = load i32, i32* %2
%24 = shl i32 45056, %23
%25 = icmp ne i32 %24, 11
br i1 %25, label %26, label %31
26: ; preds = %22
%27 = load i32, i32* %2
%28 = shl i32 2176, %27
%29 = icmp ne i32 %28, 17
br i1 %29, label %30, label %31
30: ; preds = %26
br label %32
31: ; preds = %26, %22, %18, %14, %10, %6, %1
unreachable
32: ; preds = %30
ret void
}

LLVM IR (-O2):
define void @test2(i32 %0) {
ret void
}
void foo279(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo279(i32 %0) {
ret void
}
int main() {
  int rc = 0;
  if (rc == 0) {
  }
  return rc;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1121 <main+0x21>
jmp    1121 <main+0x21>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int main() {
  float c, area;
  printf("\nEntra la mida d'un costat i et calculare l'area del "
         "cuadrat.\n\n\tcostat>");
  scanf("%f", &c);
  area = c * c;
  printf("\nL'area del cuadrat es de %.1f.\n", area);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf0b(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xee6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf12(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
mulss  %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xef6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [72 x i8] c"\0AEntra la mida d'un costat i et calculare l'area del cuadrat.\0A\0A\09costat>\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [33 x i8] c"\0AL'area del cuadrat es de %.1f.\0A\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%5 = load float, float* %1
%6 = load float, float* %1
%7 = fmul float %5, %6
store float %7, float* %2
%8 = load float, float* %2
%9 = fpext float %8 to double
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), double %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [72 x i8] c"\0AEntra la mida d'un costat i et calculare l'area del cuadrat.\0A\0A\09costat>\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [33 x i8] c"\0AL'area del cuadrat es de %.1f.\0A\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%5 = load float, float* %1
%6 = fmul float %5, %5
%7 = fpext float %6 to double
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), double %7)
ret i32 0
}
/* Variables and functions */
long xstrtoll_range(char const *, int, long, long);
long xstrtol_range(const char *str, int b, long l, long u) {
  return xstrtoll_range(str, b, l, u);
}


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

x86 assembly (clang, -O2):
<xstrtol_range>:
jmp    1030 <xstrtoll_range@plt>

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

LLVM IR (-O2):
define i64 @xstrtol_range(i8* %0, i32 %1, i64 %2, i64 %3) {
%5 = tail call i64 @xstrtoll_range(i8* %0, i32 %1, i64 %2, i64 %3)
ret i64 %5
}
int letter(const char c) { return (unsigned)((c & 0xdf) - 'A') <= 'Z'; }


x86 assembly (clang, -O0):
<letter>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
and    $0xdf,%eax
sub    $0x41,%eax
cmp    $0x5a,%eax
setbe  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<letter>:
and    $0xdf,%edi
add    $0xffffffbf,%edi
xor    %eax,%eax
cmp    $0x5b,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @letter(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, 223
%6 = sub nsw i32 %5, 65
%7 = icmp ule i32 %6, 90
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @letter(i8 signext %0) {
%2 = and i8 %0, -33
%3 = zext i8 %2 to i32
%4 = add nsw i32 %3, -65
%5 = icmp ult i32 %4, 91
%6 = zext i1 %5 to i32
ret i32 %6
}
int raft_votes_is_majority(const int num_nodes, const int nvotes) {
  if (num_nodes < nvotes)
    return 0;
  int half = num_nodes / 2;
  return half + 1 <= nvotes;
}


x86 assembly (clang, -O0):
<raft_votes_is_majority>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1122 <raft_votes_is_majority+0x22>
movl   $0x0,-0x4(%rbp)
jmp    1144 <raft_votes_is_majority+0x44>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
cmp    -0xc(%rbp),%eax
setle  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<raft_votes_is_majority>:
xor    %eax,%eax
cmp    %esi,%edi
jl     1116 <raft_votes_is_majority+0x16>
mov    %edi,%ecx
shr    $0x1f,%ecx
add    %edi,%ecx
sar    %ecx
xor    %eax,%eax
cmp    %esi,%ecx
setl   %al
ret

LLVM IR (-O0):
define i32 @raft_votes_is_majority(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 0, i32* %3
br label %19
11: ; preds = %2
%12 = load i32, i32* %4
%13 = sdiv i32 %12, 2
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = add nsw i32 %14, 1
%16 = load i32, i32* %5
%17 = icmp sle i32 %15, %16
%18 = zext i1 %17 to i32
store i32 %18, i32* %3
br label %19
19: ; preds = %11, %10
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
define i32 @raft_votes_is_majority(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = sdiv i32 %0, 2
%6 = icmp slt i32 %5, %1
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %2, %4
%9 = phi i32 [ %7, %4 ], [ 0, %2 ]
ret i32 %9
}
/* Variables and functions */
int ns_ncasecmp(char const *, char const *, size_t);
int ns_casecmp(const char *s1, const char *s2) {
  return ns_ncasecmp(s1, s2, (size_t)~0);
}


x86 assembly (clang, -O0):
<ns_casecmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0xffffffffffffffff,%rdx
call   1030 <ns_ncasecmp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ns_casecmp>:
mov    $0xffffffffffffffff,%rdx
jmp    1030 <ns_ncasecmp@plt>

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

LLVM IR (-O2):
define i32 @ns_casecmp(i8* %0, i8* %1) {
%3 = tail call i32 @ns_ncasecmp(i8* %0, i8* %1, i64 -1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ gen_call(char *);
int /*<<< orphan*/ gen_pop();
gen_arithm_shift_left() {
  gen_pop();
  gen_call("ccasl");
}


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

x86 assembly (clang, -O2):
<gen_arithm_shift_left>:
push   %rax
xor    %eax,%eax
call   1030 <gen_pop@plt>
lea    0xed1(%rip),%rdi
pop    %rax
jmp    1040 <gen_call@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"ccasl\00"
define i32 @gen_arithm_shift_left() {
%1 = alloca i32
%2 = call i32 (...) @gen_pop()
%3 = call i32 @gen_call(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
@.str = [6 x i8] c"ccasl\00"
define i32 @gen_arithm_shift_left() {
%1 = tail call i32 (...) @gen_pop()
%2 = tail call i32 @gen_call(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Type definitions */
typedef scalar_t__ wchar_t;

/* Variables and functions */
size_t wcslen(const wchar_t *s) {
  const wchar_t *a;
  for (a = s; *s; s++)
    ;
  return s - a;
}


x86 assembly (clang, -O0):
<wcslen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1134 <wcslen+0x34>
jmp    1123 <wcslen+0x23>
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
jmp    1110 <wcslen+0x10>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
sar    $0x3,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcslen>:
mov    $0xfffffffffffffff8,%rax
nopw   0x0(%rax,%rax,1)
cmpq   $0x0,0x8(%rdi,%rax,1)
lea    0x8(%rax),%rax
jne    1110 <wcslen+0x10>
sar    $0x3,%rax
ret

LLVM IR (-O0):
define i64 @wcslen(i64* %0) {
%2 = alloca i64*
%3 = alloca i64*
store i64* %0, i64** %2
%4 = load i64*, i64** %2
store i64* %4, i64** %3
br label %5
5: ; preds = %10, %1
%6 = load i64*, i64** %2
%7 = load i64, i64* %6
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %5
br label %10
10: ; preds = %9
%11 = load i64*, i64** %2
%12 = getelementptr inbounds i64, i64* %11, i32 1
store i64* %12, i64** %2
br label %5
13: ; preds = %5
%14 = load i64*, i64** %2
%15 = load i64*, i64** %3
%16 = ptrtoint i64* %14 to i64
%17 = ptrtoint i64* %15 to i64
%18 = sub i64 %16, %17
%19 = sdiv exact i64 %18, 8
ret i64 %19
}

LLVM IR (-O2):
define i64 @wcslen(i64* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64* [ %0, %1 ], [ %6, %2 ]
%4 = load i64, i64* %3
%5 = icmp eq i64 %4, 0
%6 = getelementptr inbounds i64, i64* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i64* %3 to i64
%9 = ptrtoint i64* %0 to i64
%10 = sub i64 %8, %9
%11 = ashr exact i64 %10, 3
ret i64 %11
}
void NullFilledTriangle(struct ADrawTag *ctx __attribute__((unused)),
                        unsigned int x1 __attribute__((unused)),
                        unsigned int y1 __attribute__((unused)),
                        unsigned int x2 __attribute__((unused)),
                        unsigned int y2 __attribute__((unused)),
                        unsigned int x3 __attribute__((unused)),
                        unsigned int y3 __attribute__((unused))) {}


x86 assembly (clang, -O0):
<NullFilledTriangle>:
push   %rbp
mov    %rsp,%rbp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.ADrawTag = type opaque
define void @NullFilledTriangle(%struct.ADrawTag* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca %struct.ADrawTag*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store %struct.ADrawTag* %0, %struct.ADrawTag** %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i32 %6, i32* %14
ret void
}

LLVM IR (-O2):
%struct.ADrawTag = type opaque
define void @NullFilledTriangle(%struct.ADrawTag* nocapture %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Hello, Emacs!\n");
  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 <printf@plt>
xor    %eax,%eax
add    $0x10,%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 = [15 x i8] c"Hello, Emacs!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [14 x i8] c"Hello, Emacs!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int main(void) {
  char *ptr = NULL;
  fprintf(stderr, "Avant ecriture dans pointeur NULL\n");
  ptr[0] = 'A';
  fprintf(stderr, "Apres ecriture dans pointeur NULL\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
lea    0xec9(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%rax
movb   $0x41,(%rax)
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"Avant ecriture dans pointeur NULL\0A\00"
@.str.1 = [35 x i8] c"Apres ecriture dans pointeur NULL\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
store i8* null, i8** %2
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8, i8* %5, i64 0
store i8 65, i8* %6
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"Avant ecriture dans pointeur NULL\0A\00"
define i32 @main() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
unreachable
}
int main() {
  int y = 0;
  {
    y = 3;
    int x = 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x3,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ show_number(int);
int main() {
  show_number(10);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xa,%edi
call   1040 <show_number@plt>
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xa,%edi
call   1040 <show_number@plt>
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @show_number(i32 10)
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @show_number(i32 10)
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ clear_io_bit(int, int /*<<< orphan*/);
void TOSH_CLR_RADIO_CSN_PIN() { clear_io_bit(-1, 0); }


x86 assembly (clang, -O0):
<TOSH_CLR_RADIO_CSN_PIN>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffffff,%edi
xor    %esi,%esi
call   1030 <clear_io_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_CLR_RADIO_CSN_PIN>:
mov    $0xffffffff,%edi
xor    %esi,%esi
jmp    1030 <clear_io_bit@plt>

LLVM IR (-O0):
define void @TOSH_CLR_RADIO_CSN_PIN() {
%1 = call i32 @clear_io_bit(i32 -1, i32 0)
ret void
}

LLVM IR (-O2):
define void @TOSH_CLR_RADIO_CSN_PIN() {
%1 = tail call i32 @clear_io_bit(i32 -1, i32 0)
ret void
}
/* Variables and functions */
int INET_ADDRSTRLEN;
int getifaddr(char const *, char *, int);
int get_wan_connection_status(const char *ifname) {
  char addr[INET_ADDRSTRLEN];
  int r;
  r = getifaddr(ifname, addr, INET_ADDRSTRLEN);
  return (r < 0) ? (5) : (2);
}


x86 assembly (clang, -O0):
<get_wan_connection_status>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,%rsp
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e91(%rip),%rax
mov    (%rax),%edx
call   1030 <getifaddr@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edx
mov    $0x2,%eax
mov    $0x5,%ecx
cmp    $0x0,%edx
cmovl  %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_wan_connection_status>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rsi
mov    %rdx,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rsi
mov    %rsi,%rsp
call   1030 <getifaddr@plt>
shr    $0x1f,%eax
lea    (%rax,%rax,2),%eax
add    $0x2,%eax
mov    %rbp,%rsp
pop    %rbp
ret

LLVM IR (-O0):
@INET_ADDRSTRLEN = global i32 0
define i32 @get_wan_connection_status(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
store i8* %0, i8** %2
%6 = load i32, i32* @INET_ADDRSTRLEN
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
store i8* %8, i8** %3
%9 = alloca i8, i64 %7
store i64 %7, i64* %4
%10 = load i8*, i8** %2
%11 = load i32, i32* @INET_ADDRSTRLEN
%12 = call i32 @getifaddr(i8* %10, i8* %9, i32 %11)
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = icmp slt i32 %13, 0
%15 = zext i1 %14 to i64
%16 = select i1 %14, i32 5, i32 2
%17 = load i8*, i8** %3
ret i32 %16
}

LLVM IR (-O2):
@INET_ADDRSTRLEN = global i32 0
define i32 @get_wan_connection_status(i8* %0) {
%2 = load i32, i32* @INET_ADDRSTRLEN
%3 = zext i32 %2 to i64
%4 = alloca i8, i64 %3
%5 = call i32 @getifaddr(i8* %0, i8* %4, i32 %2)
%6 = icmp slt i32 %5, 0
%7 = select i1 %6, i32 5, i32 2
ret i32 %7
}
/* Variables and functions */
int PAPI_read_ts(int, long long *, long long *);
void PAPIF_READ_TS(int *EventSet, long long *values, long long *cycles,
                   int *check) {
  *check = PAPI_read_ts(*EventSet, values, cycles);
}


x86 assembly (clang, -O0):
<PAPIF_READ_TS>:
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),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <PAPI_read_ts@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PAPIF_READ_TS>:
push   %rbx
mov    %rcx,%rbx
mov    (%rdi),%edi
call   1030 <PAPI_read_ts@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @PAPIF_READ_TS(i32* nocapture %0, i64* %1, i64* %2, i32* nocapture writeonly %3) {
%5 = load i32, i32* %0
%6 = tail call i32 @PAPI_read_ts(i32 %5, i64* %1, i64* %2)
store i32 %6, i32* %3
ret void
}
/* Variables and functions */
int testing();
int main(int argn, char *argc[]) { return testing(); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <testing@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @testing()
ret i32 %3
}
/* Variables and functions */
int fatorial1(int);
double f1() {
  int i;
  double ret = 0;
  for (i = 1; i < 10000000; i++)
    ret += 1 / (fatorial1(i % 12));
  return ret;
}


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movl   $0x1,-0x4(%rbp)
cmpl   $0x989680,-0x4(%rbp)
jge    116c <f1+0x5c>
mov    -0x4(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
call   1030 <fatorial1@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1127 <f1+0x17>
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    $0x1,%ebx
xorpd  %xmm0,%xmm0
mov    $0x98967f,%ebp
mov    $0xaaaaaaab,%r14d
jmp    114d <f1+0x3d>
xchg   %ax,%ax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x1,%ebx
add    $0xffffffff,%ebp
je     1178 <f1+0x68>
movsd  %xmm0,0x8(%rsp)
mov    %ebx,%eax
imul   %r14,%rax
shr    $0x23,%rax
shl    $0x2,%eax
lea    (%rax,%rax,2),%eax
mov    %ebx,%edi
sub    %eax,%edi
call   1030 <fatorial1@plt>
lea    0x1(%rax),%ecx
cmp    $0x3,%ecx
jb     1130 <f1+0x20>
xor    %eax,%eax
jmp    1130 <f1+0x20>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define double @f1() {
%1 = alloca i32
%2 = alloca double
store double 0.000000e+00, double* %2
store i32 1, i32* %1
br label %3
3: ; preds = %14, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 10000000
br i1 %5, label %6, label %17
6: ; preds = %3
%7 = load i32, i32* %1
%8 = srem i32 %7, 12
%9 = call i32 @fatorial1(i32 %8)
%10 = sdiv i32 1, %9
%11 = sitofp i32 %10 to double
%12 = load double, double* %2
%13 = fadd double %12, %11
store double %13, double* %2
br label %14
14: ; preds = %6
%15 = load i32, i32* %1
%16 = add nsw i32 %15, 1
store i32 %16, i32* %1
br label %3
17: ; preds = %3
%18 = load double, double* %2
ret double %18
}

LLVM IR (-O2):
define double @f1() {
br label %1
1: ; preds = %0, %1
%2 = phi double [ 0.000000e+00, %0 ], [ %10, %1 ]
%3 = phi i32 [ 1, %0 ], [ %11, %1 ]
%4 = urem i32 %3, 12
%5 = tail call i32 @fatorial1(i32 %4)
%6 = add i32 %5, 1
%7 = icmp ult i32 %6, 3
%8 = select i1 %7, i32 %5, i32 0
%9 = sitofp i32 %8 to double
%10 = fadd double %2, %9
%11 = add nuw nsw i32 %3, 1
%12 = icmp eq i32 %11, 10000000
br i1 %12, label %13, label %1
13: ; preds = %1
ret double %10
}
/* Variables and functions */
int sha256_self_test(int);
int sha2_self_test(int verbose) { return sha256_self_test(verbose); }


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

x86 assembly (clang, -O2):
<sha2_self_test>:
jmp    1030 <sha256_self_test@plt>

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

LLVM IR (-O2):
define i32 @sha2_self_test(i32 %0) {
%2 = tail call i32 @sha256_self_test(i32 %0)
ret i32 %2
}
/* Type definitions */
struct timezone {
  int dummy;
};
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, struct timezone *);
double second() {
  struct timeval tp;
  struct timezone tzp;
  gettimeofday(&tp, &tzp);
  return ((double)tp.tv_sec + (double)tp.tv_usec * 1.e-6);
}


x86 assembly (clang, -O0):
<second>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <gettimeofday@plt>
cvtsi2sdq -0x8(%rbp),%xmm1
cvtsi2sdq -0x10(%rbp),%xmm0
movsd  0xec7(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<second>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <gettimeofday@plt>
cvtsi2sdq 0x10(%rsp),%xmm1
cvtsi2sdq 0x8(%rsp),%xmm0
mulsd  0xec9(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
%struct.timezone = type { i32 }
define double @second() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timezone
%3 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* %2)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%5 = load i64, i64* %4
%6 = sitofp i64 %5 to double
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to double
%10 = call double @llvm.fmuladd.f64(double %9, double 0x3EB0C6F7A0B5ED8D, double %6)
ret double %10
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
%struct.timezone = type { i32 }
define double @second() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timezone
%3 = bitcast %struct.timeval* %1 to i8*
%4 = bitcast %struct.timezone* %2 to i8*
%5 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* %2)
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load i64, i64* %6
%8 = sitofp i64 %7 to double
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%10 = load i64, i64* %9
%11 = sitofp i64 %10 to double
%12 = tail call double @llvm.fmuladd.f64(double %11, double 0x3EB0C6F7A0B5ED8D, double %8)
ret double %12
}
/* Variables and functions */
int /*<<< orphan*/ EX_USAGE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void emit_usage(void) {
  fputs("Usage: localaddr [-4] [-6] [-L] [-R] [interface-name]\n", stderr);
  exit(EX_USAGE);
}


x86 assembly (clang, -O0):
<emit_usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
lea    0xecc(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<emit_usage>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [55 x i8] c"Usage: localaddr [-4] [-6] [-L] [-R] [interface-name]\0A\00"
@stderr = global i32 0
@EX_USAGE = global i32 0
define void @emit_usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fputs(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @EX_USAGE
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@.str = [55 x i8] c"Usage: localaddr [-4] [-6] [-L] [-R] [interface-name]\0A\00"
@stderr = global i32 0
@EX_USAGE = global i32 0
define void @emit_usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @EX_USAGE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
int Cyc_Unify_cvar_default(int a, void *t1, void *t2) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @Cyc_Unify_cvar_default(i32 %0, i8* nocapture readnone %1, i8* nocapture readnone %2) {
ret i32 0
}
void foo_1_2_1_2_1_1_2_1_2() {}


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

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

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

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

/* Variables and functions */
void MPURegionGet(uint32_t ui32Region, uint32_t *pui32Addr,
                  uint32_t *pui32Flags) {
  ;
  ;
  ;
  (*((volatile uint32_t *)(0xE000ED98))) = ui32Region;
  *pui32Addr = (*((volatile uint32_t *)(0xE000ED9C))) & 0xFFFFFFE0;
  *pui32Flags = (*((volatile uint32_t *)(0xE000EDA0)));
}


x86 assembly (clang, -O0):
<MPURegionGet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0xe000ed98,%eax
mov    %ecx,(%rax)
mov    $0xe000ed9c,%eax
mov    (%rax),%ecx
and    $0xffffffe0,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    $0xe000eda0,%eax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<MPURegionGet>:
mov    $0xe000ed98,%eax
mov    %edi,(%rax)
mov    0x4(%rax),%ecx
and    $0xffffffe0,%ecx
mov    %ecx,(%rsi)
mov    0x8(%rax),%eax
mov    %eax,(%rdx)
ret

LLVM IR (-O0):
define void @MPURegionGet(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
store volatile i32 %7, i32* inttoptr (i64 3758157208 to i32*)
%8 = load volatile i32, i32* inttoptr (i64 3758157212 to i32*)
%9 = and i32 %8, -32
%10 = load i32*, i32** %5
store i32 %9, i32* %10
%11 = load volatile i32, i32* inttoptr (i64 3758157216 to i32*)
%12 = load i32*, i32** %6
store i32 %11, i32* %12
ret void
}

LLVM IR (-O2):
define void @MPURegionGet(i32 %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
store volatile i32 %0, i32* inttoptr (i64 3758157208 to i32*)
%4 = load volatile i32, i32* inttoptr (i64 3758157212 to i32*)
%5 = and i32 %4, -32
store i32 %5, i32* %1
%6 = load volatile i32, i32* inttoptr (i64 3758157216 to i32*)
store i32 %6, i32* %2
ret void
}