xunge/DecIR huggingface dataset:
/* Variables and functions */
void *malloc(int);
void *vec_malloc(int size) { return malloc(size); }


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

x86 assembly (clang, -O2):
<vec_malloc>:
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define noalias i8* @vec_malloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
ret i8* %2
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint32_t readU32LittleEndian(uint8_t *in) {
  return ((uint32_t)in[0]) | ((uint32_t)in[1] << 8) | ((uint32_t)in[2] << 16) |
         ((uint32_t)in[3] << 24);
}


x86 assembly (clang, -O0):
<readU32LittleEndian>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x8(%rbp),%rcx
mov    0x8(%rcx),%rcx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x10(%rcx),%rcx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x18(%rcx),%rcx
shl    $0x18,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<readU32LittleEndian>:
mov    0x8(%rdi),%ecx
mov    0x10(%rdi),%edx
shl    $0x8,%ecx
or     (%rdi),%ecx
shl    $0x10,%edx
mov    0x18(%rdi),%eax
shl    $0x18,%eax
or     %edx,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @readU32LittleEndian(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = getelementptr inbounds i64, i64* %3, i64 0
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = load i64*, i64** %2
%8 = getelementptr inbounds i64, i64* %7, i64 1
%9 = load i64, i64* %8
%10 = trunc i64 %9 to i32
%11 = shl i32 %10, 8
%12 = or i32 %6, %11
%13 = load i64*, i64** %2
%14 = getelementptr inbounds i64, i64* %13, i64 2
%15 = load i64, i64* %14
%16 = trunc i64 %15 to i32
%17 = shl i32 %16, 16
%18 = or i32 %12, %17
%19 = load i64*, i64** %2
%20 = getelementptr inbounds i64, i64* %19, i64 3
%21 = load i64, i64* %20
%22 = trunc i64 %21 to i32
%23 = shl i32 %22, 24
%24 = or i32 %18, %23
ret i32 %24
}

LLVM IR (-O2):
define i32 @readU32LittleEndian(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = trunc i64 %2 to i32
%4 = getelementptr inbounds i64, i64* %0, i64 1
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = shl i32 %6, 8
%8 = or i32 %7, %3
%9 = getelementptr inbounds i64, i64* %0, i64 2
%10 = load i64, i64* %9
%11 = trunc i64 %10 to i32
%12 = shl i32 %11, 16
%13 = or i32 %8, %12
%14 = getelementptr inbounds i64, i64* %0, i64 3
%15 = load i64, i64* %14
%16 = trunc i64 %15 to i32
%17 = shl i32 %16, 24
%18 = or i32 %13, %17
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ stdout;
void print_position(int i, int a) {
  printf("Axis %d: %8d\r", i, a);
  fflush(stdout);
}


x86 assembly (clang, -O0):
<print_position>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_position>:
push   %rax
mov    %esi,%edx
mov    %edi,%esi
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"Axis %d: %8d\0D\00"
@stdout = global i32 0
define void @print_position(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 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
%8 = load i32, i32* @stdout
%9 = call i32 @fflush(i32 %8)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"Axis %d: %8d\0D\00"
@stdout = global i32 0
define void @print_position(i32 %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
%4 = load i32, i32* @stdout
%5 = tail call i32 @fflush(i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void do_abort(void) { abort(); }


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

x86 assembly (clang, -O2):
<do_abort>:
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @do_abort() {
%1 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
define void @do_abort() {
%1 = tail call i32 (...) @abort()
unreachable
}
int main(void) { printf('Hello, world!\n'); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x6c64210a,%edi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (i8*, ...) @printf(i8* inttoptr (i64 1818501386 to i8*))
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* inttoptr (i64 1818501386 to i8*))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void debugHook() {
  char *hook = "debug hook";
  printf("%s\n", hook);
}


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

x86 assembly (clang, -O2):
<debugHook>:
lea    0xef4(%rip),%rdi
lea    0xee2(%rip),%rsi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [11 x i8] c"debug hook\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @debugHook() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}
extern void *bus_to_virt(unsigned long address) {
  if (address == 0)
    return 0;
  return ((void *)(address - 0x80000000 + 0x90000000));
}


x86 assembly (clang, -O0):
<bus_to_virt>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1120 <bus_to_virt+0x20>
movq   $0x0,-0x8(%rbp)
jmp    1142 <bus_to_virt+0x42>
mov    -0x10(%rbp),%rax
movabs $0x80000000,%rcx
sub    %rcx,%rax
movabs $0x90000000,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bus_to_virt>:
lea    0x10000000(%rdi),%rax
test   %rdi,%rdi
cmove  %rdi,%rax
ret

LLVM IR (-O0):
define i8* @bus_to_virt(i64 %0) {
%2 = alloca i8*
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i8* null, i8** %2
br label %12
7: ; preds = %1
%8 = load i64, i64* %3
%9 = sub i64 %8, 2147483648
%10 = add i64 %9, 2415919104
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %2
br label %12
12: ; preds = %7, %6
%13 = load i8*, i8** %2
ret i8* %13
}

LLVM IR (-O2):
define i8* @bus_to_virt(i64 %0) {
%2 = icmp eq i64 %0, 0
%3 = add i64 %0, 268435456
%4 = inttoptr i64 %3 to i8*
%5 = select i1 %2, i8* null, i8* %4
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ g_free(void *);
void ssl_rc4_info_delete(void *rc4_info) { g_free(rc4_info); }


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

x86 assembly (clang, -O2):
<ssl_rc4_info_delete>:
jmp    1030 <g_free@plt>

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

LLVM IR (-O2):
define void @ssl_rc4_info_delete(i8* %0) {
%2 = tail call i32 @g_free(i8* %0)
ret void
}
void elip(int a, ...) { (void)a; }


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

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

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

LLVM IR (-O2):
define void @elip(i32 %0, ...) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ NRF24_CE_Disable();
int /*<<< orphan*/ NRF24_CE_Enable();
void NRF24_CE_Test(void) {
  NRF24_CE_Enable();
  NRF24_CE_Disable();
}


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

x86 assembly (clang, -O2):
<NRF24_CE_Test>:
push   %rax
xor    %eax,%eax
call   1030 <NRF24_CE_Enable@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <NRF24_CE_Disable@plt>

LLVM IR (-O0):
define void @NRF24_CE_Test() {
%1 = call i32 (...) @NRF24_CE_Enable()
%2 = call i32 (...) @NRF24_CE_Disable()
ret void
}

LLVM IR (-O2):
define void @NRF24_CE_Test() {
%1 = tail call i32 (...) @NRF24_CE_Enable()
%2 = tail call i32 (...) @NRF24_CE_Disable()
ret void
}
/* Variables and functions */
int ssleay_rand_add(void const *, int, double);
int ssleay_rand_seed(const void *buf, int num) {
  return ssleay_rand_add(buf, num, (double)num);
}


x86 assembly (clang, -O0):
<ssleay_rand_seed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
cvtsi2sdl -0xc(%rbp),%xmm0
call   1030 <ssleay_rand_add@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ssleay_rand_seed>:
cvtsi2sd %esi,%xmm0
jmp    1030 <ssleay_rand_add@plt>

LLVM IR (-O0):
define i32 @ssleay_rand_seed(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = load i32, i32* %4
%8 = sitofp i32 %7 to double
%9 = call i32 @ssleay_rand_add(i8* %5, i32 %6, double %8)
ret i32 %9
}

LLVM IR (-O2):
define i32 @ssleay_rand_seed(i8* %0, i32 %1) {
%3 = sitofp i32 %1 to double
%4 = tail call i32 @ssleay_rand_add(i8* %0, i32 %1, double %3)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void default_mutex_destroy(void *mutex) { free(mutex); }


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

x86 assembly (clang, -O2):
<default_mutex_destroy>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @default_mutex_destroy(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int obd_read(int, char *);
int /*<<< orphan*/ usleep(int);
int /*<<< orphan*/ write(int, char *, int);
bool obd_find_protocol(int fd) {
  char buf[50];
  write(fd, "0100\r", 5);
  usleep(2000000);
  if (obd_read(fd, buf) >= 17)
    return true;
  else
    return false;
}


x86 assembly (clang, -O0):
<obd_find_protocol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    0xebb(%rip),%rsi
mov    $0x5,%edx
call   1030 <write@plt>
mov    $0x1e8480,%edi
call   1050 <usleep@plt>
mov    -0x8(%rbp),%edi
lea    -0x40(%rbp),%rsi
call   1040 <obd_read@plt>
cmp    $0x11,%eax
jl     117a <obd_find_protocol+0x4a>
movl   $0x1,-0x4(%rbp)
jmp    1181 <obd_find_protocol+0x51>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<obd_find_protocol>:
push   %rbx
sub    $0x40,%rsp
mov    %edi,%ebx
lea    0xec2(%rip),%rsi
mov    $0x5,%edx
call   1030 <write@plt>
mov    $0x1e8480,%edi
call   1050 <usleep@plt>
mov    %rsp,%rsi
mov    %ebx,%edi
call   1040 <obd_read@plt>
xor    %ecx,%ecx
cmp    $0x11,%eax
setge  %cl
mov    %ecx,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"0100\0D\00"
define i32 @obd_find_protocol(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [50 x i8]
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i32 @write(i32 %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
%7 = call i32 @usleep(i32 2000000)
%8 = load i32, i32* %3
%9 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%10 = call i32 @obd_read(i32 %8, i8* %9)
%11 = icmp sge i32 %10, 17
br i1 %11, label %12, label %13
12: ; preds = %1
store i32 1, i32* %2
br label %14
13: ; preds = %1
store i32 0, i32* %2
br label %14
14: ; preds = %13, %12
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
@.str = [6 x i8] c"0100\0D\00"
define i32 @obd_find_protocol(i32 %0) {
%2 = alloca [50 x i8]
%3 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @write(i32 %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
%5 = tail call i32 @usleep(i32 2000000)
%6 = call i32 @obd_read(i32 %0, i8* %3)
%7 = icmp sgt i32 %6, 16
%8 = zext i1 %7 to i32
ret i32 %8
}
int LexIsDigit(char c) {
  if ('0' <= c && c <= '9') {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<LexIsDigit>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%ecx
mov    $0x30,%eax
cmp    %ecx,%eax
jg     1134 <LexIsDigit+0x34>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     1134 <LexIsDigit+0x34>
movl   $0x1,-0x4(%rbp)
jmp    113b <LexIsDigit+0x3b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<LexIsDigit>:
add    $0xd0,%dil
xor    %eax,%eax
cmp    $0xa,%dil
setb   %al
ret

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

LLVM IR (-O2):
define i32 @LexIsDigit(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
int fun162() { return 162; }


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

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

LLVM IR (-O0):
define i32 @fun162() {
ret i32 162
}

LLVM IR (-O2):
define i32 @fun162() {
ret i32 162
}
void XkbSetAutoRepeatRate() {}


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

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

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

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


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ Sys_failure(char *);
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int pthread_attr_destroy(int /*<<< orphan*/ *);
void Pthread_attr_destroy(pthread_attr_t *attr) {
  int retval;
  assert(attr != NULL);
  retval = pthread_attr_destroy(attr);
  if (retval != 0)
    Sys_failure("pthread_attr_destroy");
}


x86 assembly (clang, -O0):
<Pthread_attr_destroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1050 <pthread_attr_destroy@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1170 <Pthread_attr_destroy+0x40>
lea    0xe95(%rip),%rdi
call   1040 <Sys_failure@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Pthread_attr_destroy>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1050 <pthread_attr_destroy@plt>
test   %eax,%eax
je     115b <Pthread_attr_destroy+0x2b>
lea    0xeab(%rip),%rdi
pop    %rbx
jmp    1040 <Sys_failure@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"pthread_attr_destroy\00"
define void @Pthread_attr_destroy(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = icmp ne i32* %4, null
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = load i32*, i32** %2
%9 = call i32 @pthread_attr_destroy(i32* %8)
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %1
%13 = call i32 @Sys_failure(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %1
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"pthread_attr_destroy\00"
define void @Pthread_attr_destroy(i32* %0) {
%2 = icmp ne i32* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @pthread_attr_destroy(i32* %0)
%6 = icmp eq i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = tail call i32 @Sys_failure(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ outbufClear();
int /*<<< orphan*/ outbufFlush(int);
int /*<<< orphan*/ outbufFormatVar(char const *, int /*<<< orphan*/);
void printFd(int fd, const char *format, va_list ap) {
  outbufClear();
  outbufFormatVar(format, ap);
  outbufFlush(fd);
}


x86 assembly (clang, -O0):
<printFd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0x0,%al
call   1040 <outbufClear@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <outbufFormatVar@plt>
mov    -0x4(%rbp),%edi
call   1030 <outbufFlush@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printFd>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %edi,%r14d
xor    %eax,%eax
call   1040 <outbufClear@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1050 <outbufFormatVar@plt>
mov    %r14d,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <outbufFlush@plt>

LLVM IR (-O0):
define void @printFd(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = call i32 (...) @outbufClear()
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @outbufFormatVar(i8* %8, i32 %9)
%11 = load i32, i32* %4
%12 = call i32 @outbufFlush(i32 %11)
ret void
}

LLVM IR (-O2):
define void @printFd(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 (...) @outbufClear()
%5 = tail call i32 @outbufFormatVar(i8* %1, i32 %2)
%6 = tail call i32 @outbufFlush(i32 %0)
ret void
}
/* Type definitions */
struct cnfnode {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int unparse_pair_line_sep(int /*<<< orphan*/ *, struct cnfnode *, int);
int unparse_pair_line(FILE *fptr, struct cnfnode *cn_top) {
  return unparse_pair_line_sep(fptr, cn_top, -1);
}


x86 assembly (clang, -O0):
<unparse_pair_line>:
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    $0xffffffff,%edx
call   1030 <unparse_pair_line_sep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unparse_pair_line>:
mov    $0xffffffff,%edx
jmp    1030 <unparse_pair_line_sep@plt>

LLVM IR (-O0):
%struct.cnfnode = type { i32 }
define i32 @unparse_pair_line(i32* %0, %struct.cnfnode* %1) {
%3 = alloca i32*
%4 = alloca %struct.cnfnode*
store i32* %0, i32** %3
store %struct.cnfnode* %1, %struct.cnfnode** %4
%5 = load i32*, i32** %3
%6 = load %struct.cnfnode*, %struct.cnfnode** %4
%7 = call i32 @unparse_pair_line_sep(i32* %5, %struct.cnfnode* %6, i32 -1)
ret i32 %7
}

LLVM IR (-O2):
%struct.cnfnode = type { i32 }
define i32 @unparse_pair_line(i32* %0, %struct.cnfnode* %1) {
%3 = tail call i32 @unparse_pair_line_sep(i32* %0, %struct.cnfnode* %1, i32 -1)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ __builtin_arc_lr(int);
__attribute__((always_)) uint32_t arcv2_timer0_control_get(void) {
  return (__builtin_arc_lr(0x022));
}


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

x86 assembly (clang, -O2):
<arcv2_timer0_control_get>:
mov    $0x22,%edi
jmp    1030 <__builtin_arc_lr@plt>

LLVM IR (-O0):
define i32 @arcv2_timer0_control_get() {
%1 = call i32 @__builtin_arc_lr(i32 34)
ret i32 %1
}

LLVM IR (-O2):
define i32 @arcv2_timer0_control_get() {
%1 = tail call i32 @__builtin_arc_lr(i32 34)
ret i32 %1
}
int cvmx_spi4000_initialize(int interface) { return 0; }


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @cvmx_spi4000_initialize(i32 %0) {
ret i32 0
}
void LOS_EvbKeyInit(void) { return; }


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

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

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

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


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

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

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

LLVM IR (-O2):
define void @RTFsQueryProperties() {
ret void
}
int test_imm_87int64_midword_reg(long long val) {
  return ((val >> 16) & (0x87 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_87int64_midword_reg>:
test   $0x870000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_87int64_midword_reg(i64 %0) {
%2 = and i64 %0, 8847360
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void decode1(int *xp, int *yp, int *zp) {
  int tx = *xp;
  int ty = *yp;
  int tz = *zp;
  *yp = tx;
  *zp = ty;
  *xp = tz;
}


x86 assembly (clang, -O0):
<decode1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x24(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode1>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
mov    (%rdx),%r8d
mov    %eax,(%rsi)
mov    %ecx,(%rdx)
mov    %r8d,(%rdi)
ret

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

LLVM IR (-O2):
define void @decode1(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2) {
%4 = load i32, i32* %0
%5 = load i32, i32* %1
%6 = load i32, i32* %2
store i32 %4, i32* %1
store i32 %5, i32* %2
store i32 %6, i32* %0
ret void
}
/* Variables and functions */
int rand_int_generator(int);
void rand_array_generator(int a[], int max, int num_elements) {
  int i;
  for (i = 0; i < num_elements; i++) {
    a[i] = rand_int_generator(max);
  }
}


x86 assembly (clang, -O0):
<rand_array_generator>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1158 <rand_array_generator+0x48>
mov    -0xc(%rbp),%edi
call   1030 <rand_int_generator@plt>
mov    %eax,%edx
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <rand_array_generator+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_array_generator>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edx,%edx
jle    1145 <rand_array_generator+0x35>
mov    %esi,%r14d
mov    %rdi,%r15
mov    %edx,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14d,%edi
call   1030 <rand_int_generator@plt>
mov    %eax,(%r15,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1130 <rand_array_generator+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @rand_array_generator(i32* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %13
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %11, %7 ]
%9 = tail call i32 @rand_int_generator(i32 %1)
%10 = getelementptr inbounds i32, i32* %0, i64 %8
store i32 %9, i32* %10
%11 = add nuw nsw i64 %8, 1
%12 = icmp eq i64 %11, %6
br i1 %12, label %13, label %7
13: ; preds = %7, %3
ret void
}
int i() { return 2; }


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

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

LLVM IR (-O0):
define i32 @i() {
ret i32 2
}

LLVM IR (-O2):
define i32 @i() {
ret i32 2
}
/* Variables and functions */
int ft_isalpha(int);
int ft_isdigit(int);
int ft_isalnum(int c) {
  return ((ft_isalpha(c) == 1 || ft_isdigit(c) == 1) ? 1 : 0);
}


x86 assembly (clang, -O0):
<ft_isalnum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <ft_isalpha@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x1,%ecx
mov    %al,-0x5(%rbp)
je     1154 <ft_isalnum+0x34>
mov    -0x4(%rbp),%edi
call   1030 <ft_isdigit@plt>
cmp    $0x1,%eax
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_isalnum>:
push   %rbx
mov    %edi,%ebx
call   1040 <ft_isalpha@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    $0x1,%ecx
je     1145 <ft_isalnum+0x25>
mov    %ebx,%edi
call   1030 <ft_isdigit@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
sete   %al
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @ft_isalnum(i32 %0) {
%2 = tail call i32 @ft_isalpha(i32 %0)
%3 = icmp eq i32 %2, 1
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @ft_isdigit(i32 %0)
%6 = icmp eq i32 %5, 1
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 1, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ memrev16(int /*<<< orphan*/ *);
uint16_t intrev16(uint16_t v) {
  memrev16(&v);
  return v;
}


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

x86 assembly (clang, -O2):
<intrev16>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <memrev16@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @intrev16(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @memrev16(i32* %2)
%4 = load i32, i32* %2
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ nl_item;

/* Variables and functions */
char *nl_langinfo(nl_item item __attribute__((unused))) { return "UTF8"; }


x86 assembly (clang, -O0):
<nl_langinfo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
lea    0xef2(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nl_langinfo>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"UTF8\00"
define i8* @nl_langinfo(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [5 x i8] c"UTF8\00"
define i8* @nl_langinfo(i32 %0) {
ret i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ pthread_mutex_unlock(int /*<<< orphan*/ *);
void mutexCancelCleanup(void *arg) {
  assert(arg != NULL);
  pthread_mutex_unlock((pthread_mutex_t *)arg);
}


x86 assembly (clang, -O0):
<mutexCancelCleanup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1040 <pthread_mutex_unlock@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mutexCancelCleanup>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <pthread_mutex_unlock@plt>

LLVM IR (-O0):
define void @mutexCancelCleanup(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = load i8*, i8** %2
%8 = bitcast i8* %7 to i32*
%9 = call i32 @pthread_mutex_unlock(i32* %8)
ret void
}

LLVM IR (-O2):
define void @mutexCancelCleanup(i8* %0) {
%2 = icmp ne i8* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = bitcast i8* %0 to i32*
%6 = tail call i32 @pthread_mutex_unlock(i32* %5)
ret void
}
int strccount(char *str, char c) {
  int i;
  i = 0;
  while (*str) {
    if (*str++ == c)
      i++;
  }
  return i;
}


x86 assembly (clang, -O0):
<strccount>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     114e <strccount+0x4e>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    1149 <strccount+0x49>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1115 <strccount+0x15>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strccount>:
mov    (%rdi),%cl
test   %cl,%cl
je     1126 <strccount+0x26>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
xor    %edx,%edx
cmp    %sil,%cl
sete   %dl
add    %edx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <strccount+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @strccount(i8* nocapture %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %13, %5 ], [ %3, %2 ]
%7 = phi i32 [ %12, %5 ], [ 0, %2 ]
%8 = phi i8* [ %9, %5 ], [ %0, %2 ]
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = icmp eq i8 %6, %1
%11 = zext i1 %10 to i32
%12 = add nuw nsw i32 %7, %11
%13 = load i8, i8* %9
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
%16 = phi i32 [ 0, %2 ], [ %12, %5 ]
ret i32 %16
}
int used_fn_isoarg(int arg __attribute__((used))) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @used_fn_isoarg(i32 %0) {
ret i32 0
}
/* Variables and functions */
int write(int, int *, int);
int putChar(char **out, int c) {
  if (out) {
    **out = c;
    (*out)++;
    return 1;
  } else
    return write(2, &c, 1);
}


x86 assembly (clang, -O0):
<putChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1152 <putChar+0x42>
mov    -0x14(%rbp),%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1168 <putChar+0x58>
mov    $0x2,%edi
lea    -0x14(%rbp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putChar>:
push   %rax
mov    %esi,0x4(%rsp)
test   %rdi,%rdi
je     112b <putChar+0x1b>
mov    (%rdi),%rax
mov    %sil,(%rax)
addq   $0x1,(%rdi)
mov    $0x1,%eax
pop    %rcx
ret
lea    0x4(%rsp),%rsi
mov    $0x2,%edi
mov    $0x1,%edx
call   1030 <write@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @putChar(i8** %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = icmp eq i8** %0, null
br i1 %4, label %10, label %5
5: ; preds = %2
%6 = trunc i32 %1 to i8
%7 = load i8*, i8** %0
store i8 %6, i8* %7
%8 = load i8*, i8** %0
%9 = getelementptr inbounds i8, i8* %8, i64 1
store i8* %9, i8** %0
br label %12
10: ; preds = %2
%11 = call i32 @write(i32 2, i32* %3, i32 1)
br label %12
12: ; preds = %10, %5
%13 = phi i32 [ 1, %5 ], [ %11, %10 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char const *);
void panic(const char *string) {
  printf("panic: %s\n", string);
  exit(0);
}


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

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

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

LLVM IR (-O2):
@.str = [11 x i8] c"panic: %s\0A\00"
define void @panic(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void changechoices() {
  printf("\n\nYou have following choices.\n\n");
  printf("1: \tTo change the value by index.\n");
  printf("2: \tTo replace a value with a new value.\n\n");
}


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

x86 assembly (clang, -O2):
<changechoices>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xefb(%rip),%rdi
call   1030 <puts@plt>
lea    0xf11(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"\0A\0AYou have following choices.\0A\0A\00"
@.str.1 = [35 x i8] c"1: \09To change the value by index.\0A\00"
@.str.2 = [43 x i8] c"2: \09To replace a value with a new value.\0A\0A\00"
define void @changechoices() {
%1 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [31 x i8] c"\0A\0AYou have following choices.\0A\00"
@str.3 = [34 x i8] c"1: \09To change the value by index.\00"
@str.4 = [42 x i8] c"2: \09To replace a value with a new value.\0A\00"
define void @changechoices() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.4, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ AlarmToTimerC__0__Alarm__stop();
void AlarmToTimerC__0__Timer__stop(void) { AlarmToTimerC__0__Alarm__stop(); }


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

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

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

LLVM IR (-O2):
define void @AlarmToTimerC__0__Timer__stop() {
%1 = tail call i32 (...) @AlarmToTimerC__0__Alarm__stop()
ret void
}
/* Variables and functions */
long strtol(char *, char **, int);
int str_to_int(char *str, int *intPtr) {
  char *endptr;
  long lval = strtol(str, &endptr, 10);
  int val = (int)lval;
  if (*endptr != '\0' || val != lval)
    return 0;
  *intPtr = val;
  return 1;
}


x86 assembly (clang, -O0):
<str_to_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    115b <str_to_int+0x4b>
movslq -0x2c(%rbp),%rax
cmp    -0x28(%rbp),%rax
je     1167 <str_to_int+0x57>
movl   $0x0,-0x4(%rbp)
jmp    1177 <str_to_int+0x67>
mov    -0x2c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_to_int>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
lea    0x8(%rsp),%rsi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %rax,%rcx
mov    0x8(%rsp),%rdx
xor    %eax,%eax
cmpb   $0x0,(%rdx)
jne    114d <str_to_int+0x3d>
mov    %rcx,%rdx
sub    $0xffffffff80000000,%rdx
shr    $0x20,%rdx
jne    114d <str_to_int+0x3d>
mov    %ecx,(%rbx)
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @str_to_int(i8* %0, i32* nocapture writeonly %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = call i64 @strtol(i8* %0, i8** %3, i32 10)
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
%9 = add i64 %5, 2147483648
%10 = icmp ult i64 %9, 4294967296
%11 = select i1 %8, i1 %10, i1 false
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = trunc i64 %5 to i32
store i32 %13, i32* %1
br label %14
14: ; preds = %2, %12
%15 = phi i32 [ 1, %12 ], [ 0, %2 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ Msp430AlarmC__1__Msp430Compare__fired();
void Msp430TimerCapComP__5__Compare__fired(void) {
  Msp430AlarmC__1__Msp430Compare__fired();
}


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

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

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

LLVM IR (-O2):
define void @Msp430TimerCapComP__5__Compare__fired() {
%1 = tail call i32 (...) @Msp430AlarmC__1__Msp430Compare__fired()
ret void
}
void *foo(void *a) { return 0; }


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

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

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

LLVM IR (-O2):
define noalias i8* @foo(i8* nocapture readnone %0) {
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ isOneOfThem(char, char const *);
char *goWhile(char *str, char const *set) {
  for (; *str != '\0'; ++str) {
    if (!isOneOfThem(*str, set))
      return str;
  }
  return 0;
}


x86 assembly (clang, -O0):
<goWhile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     116e <goWhile+0x5e>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    -0x18(%rbp),%rsi
movsbl %al,%edi
call   1030 <isOneOfThem@plt>
cmp    $0x0,%eax
jne    1158 <goWhile+0x48>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1176 <goWhile+0x66>
jmp    115d <goWhile+0x4d>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1120 <goWhile+0x10>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<goWhile>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     113b <goWhile+0x2b>
mov    %rsi,%r14
mov    %rdi,%rbx
movsbl %al,%edi
mov    %r14,%rsi
call   1030 <isOneOfThem@plt>
test   %eax,%eax
je     113d <goWhile+0x2d>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <goWhile+0x10>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @goWhile(i8* %0, i8* %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %2, %10
%6 = phi i8 [ %12, %10 ], [ %3, %2 ]
%7 = phi i8* [ %11, %10 ], [ %0, %2 ]
%8 = tail call i32 @isOneOfThem(i8 signext %6, i8* %1)
%9 = icmp eq i32 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %5
14: ; preds = %5, %10, %2
%15 = phi i8* [ null, %2 ], [ null, %10 ], [ %7, %5 ]
ret i8* %15
}