xunge/DecIR huggingface dataset:
int _jsh_hash_for_key_ptr(unsigned int bucket_size, void *key) {
  int h = ((int)key) / (sizeof(void *));
  return h % bucket_size;
}


x86 assembly (clang, -O0):
<_jsh_hash_for_key_ptr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cltq
shr    $0x3,%rax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
xor    %edx,%edx
divl   -0x4(%rbp)
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_jsh_hash_for_key_ptr>:
movslq %esi,%rax
shr    $0x3,%rax
xor    %edx,%edx
div    %edi
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @_jsh_hash_for_key_ptr(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = ptrtoint i8* %6 to i32
%8 = sext i32 %7 to i64
%9 = udiv i64 %8, 8
%10 = trunc i64 %9 to i32
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = load i32, i32* %3
%13 = urem i32 %11, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @_jsh_hash_for_key_ptr(i32 %0, i8* %1) {
%3 = ptrtoint i8* %1 to i64
%4 = shl i64 %3, 32
%5 = ashr exact i64 %4, 32
%6 = lshr i64 %5, 3
%7 = trunc i64 %6 to i32
%8 = urem i32 %7, %0
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int *, ...);
int main(int argc, char *argv[]) {
  char *s = "str";
  int i = 0;
  int *i1 = &i;
  int **i2 = &i1;
  printf("%p %p\n", i1, i2);
  printf("%p, %p\n", i1, *i2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed3(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    -0x1c(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rax
mov    (%rax),%rdx
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movl   $0x0,0xc(%rsp)
lea    0xc(%rsp),%rsi
mov    %rsi,0x10(%rsp)
lea    0xed3(%rip),%rdi
lea    0x10(%rsp),%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x10(%rsp),%rdx
lea    0xec2(%rip),%rdi
mov    %rdx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"str\00"
@.str.1 = [7 x i8] c"%p %p\0A\00"
@.str.2 = [8 x i8] c"%p, %p\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %6
store i32 0, i32* %7
store i32* %7, i32** %8
store i32** %8, i32*** %9
%10 = load i32*, i32** %8
%11 = load i32**, i32*** %9
%12 = call i32 (i8*, i32*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %10, i32** %11)
%13 = load i32*, i32** %8
%14 = load i32**, i32*** %9
%15 = load i32*, i32** %14
%16 = call i32 (i8*, i32*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32* %13, i32* %15)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c"%p %p\0A\00"
@.str.2 = [8 x i8] c"%p, %p\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%6 = bitcast i32** %4 to i8*
store i32* %3, i32** %4
%7 = call i32 (i8*, i32*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32** %4)
%8 = load i32*, i32** %4
%9 = call i32 (i8*, i32*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32* %8, i32* %8)
ret i32 0
}
void virtual_mcu_GlobalInterrupts_enable__E() {}


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

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

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

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

/* Variables and functions */
scalar_t__ ASN1_item_new(int /*<<< orphan*/ *);
int /*<<< orphan*/ PKCS7_ISSUER_AND_SERIAL_it;
PKCS7_ISSUER_AND_SERIAL *PKCS7_ISSUER_AND_SERIAL_new(void) {
  return (PKCS7_ISSUER_AND_SERIAL *)ASN1_item_new(&PKCS7_ISSUER_AND_SERIAL_it);
}


x86 assembly (clang, -O0):
<PKCS7_ISSUER_AND_SERIAL_new>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rdi
call   1030 <ASN1_item_new@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<PKCS7_ISSUER_AND_SERIAL_new>:
mov    0x2ed1(%rip),%rdi
jmp    1030 <ASN1_item_new@plt>

LLVM IR (-O0):
@PKCS7_ISSUER_AND_SERIAL_it = global i32 0
define i32* @PKCS7_ISSUER_AND_SERIAL_new() {
%1 = call i64 @ASN1_item_new(i32* @PKCS7_ISSUER_AND_SERIAL_it)
%2 = inttoptr i64 %1 to i32*
ret i32* %2
}

LLVM IR (-O2):
@PKCS7_ISSUER_AND_SERIAL_it = global i32 0
define i32* @PKCS7_ISSUER_AND_SERIAL_new() {
%1 = tail call i64 @ASN1_item_new(i32* @PKCS7_ISSUER_AND_SERIAL_it)
%2 = inttoptr i64 %1 to i32*
ret i32* %2
}
do_close(void *cookie) { printf("%s, cookie=%p\n", __func__, cookie); }


x86 assembly (clang, -O0):
<do_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
lea    0xed9(%rip),%rdi
lea    0xee1(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_close>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rdi
lea    0xeee(%rip),%rsi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"%s, cookie=%p\0A\00"
@__func__.do_close = [9 x i8] c"do_close\00"
define i32 @do_close(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__func__.do_close, i64 0, i64 0), i8* %4)
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
@.str = [15 x i8] c"%s, cookie=%p\0A\00"
@__func__.do_close = [9 x i8] c"do_close\00"
define i32 @do_close(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__func__.do_close, i64 0, i64 0), i8* %0)
ret i32 undef
}
/* Variables and functions */
scalar_t__ isspace(int);
void iniFileLineNextWord(const char **s) {
  while (**s && isspace((int)**s))
    (*s)++;
}


x86 assembly (clang, -O0):
<iniFileLineNextWord>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     114d <iniFileLineNextWord+0x3d>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    115d <iniFileLineNextWord+0x4d>
jmp    1170 <iniFileLineNextWord+0x60>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    111c <iniFileLineNextWord+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iniFileLineNextWord>:
push   %rbx
mov    (%rdi),%rax
mov    (%rax),%al
test   %al,%al
je     113f <iniFileLineNextWord+0x2f>
mov    %rdi,%rbx
nopl   (%rax)
movsbl %al,%edi
call   1030 <isspace@plt>
test   %rax,%rax
je     113f <iniFileLineNextWord+0x2f>
mov    (%rbx),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%rbx)
movzbl 0x1(%rax),%eax
test   %al,%al
jne    1120 <iniFileLineNextWord+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @iniFileLineNextWord(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = load i8, i8* %2
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %1, %10
%6 = phi i8 [ %13, %10 ], [ %3, %1 ]
%7 = sext i8 %6 to i32
%8 = tail call i64 @isspace(i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %5
%11 = load i8*, i8** %0
%12 = getelementptr inbounds i8, i8* %11, i64 1
store i8* %12, i8** %0
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %10, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fatal(char *, char *);
int /*<<< orphan*/ printf(char *);
int test_fatal_1024(char *msg) {
  printf("   fatal( \"log.c:fatal(): test message: '%%s'\", msg );");
  fatal("log.c:fatal(): test message: '%s'", msg);
  printf(" passed\n");
  return (0);
}


x86 assembly (clang, -O0):
<test_fatal_1024>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xef4(%rip),%rdi
call   1040 <fatal@plt>
lea    0xf0a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_fatal_1024>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rdi
call   1040 <printf@plt>
lea    0xef0(%rip),%rdi
mov    %rbx,%rsi
call   1050 <fatal@plt>
lea    0xf03(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [55 x i8] c" fatal( \22log.c:fatal(): test message: '%%s'\22, msg );\00"
@.str.1 = [34 x i8] c"log.c:fatal(): test message: '%s'\00"
@.str.2 = [9 x i8] c" passed\0A\00"
define i32 @test_fatal_1024(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 @fatal(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [55 x i8] c" fatal( \22log.c:fatal(): test message: '%%s'\22, msg );\00"
@.str.1 = [34 x i8] c"log.c:fatal(): test message: '%s'\00"
@str = [8 x i8] c" passed\00"
define i32 @test_fatal_1024(i8* %0) {
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @fatal(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
ret i32 0
}
void XESetCreateGC() {}


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

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

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

LLVM IR (-O2):
define void @XESetCreateGC() {
ret void
}
/* Variables and functions */
unsigned char inb(int);
void smbus_wait_until_done(void) {
  unsigned char byte;
  do {
    byte = inb(0x1000);
  } while ((byte & 1) == 1);
  while ((byte & ~1) == 0) {
    byte = inb(0x1000);
  }
}


x86 assembly (clang, -O0):
<smbus_wait_until_done>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1000,%edi
call   1030 <inb@plt>
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0x1,%eax
cmp    $0x1,%eax
je     1118 <smbus_wait_until_done+0x8>
jmp    113a <smbus_wait_until_done+0x2a>
movzbl -0x1(%rbp),%eax
and    $0xfffffffe,%eax
cmp    $0x0,%eax
jne    115c <smbus_wait_until_done+0x4c>
mov    $0x1000,%edi
call   1030 <inb@plt>
mov    %al,-0x1(%rbp)
jmp    113a <smbus_wait_until_done+0x2a>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smbus_wait_until_done>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x1000,%edi
call   1030 <inb@plt>
test   $0x1,%al
jne    1120 <smbus_wait_until_done+0x10>
cmp    $0x1,%al
ja     114e <smbus_wait_until_done+0x3e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x1000,%edi
call   1030 <inb@plt>
cmp    $0x2,%al
jb     1140 <smbus_wait_until_done+0x30>
pop    %rax
ret

LLVM IR (-O0):
define void @smbus_wait_until_done() {
%1 = alloca i8
br label %2
2: ; preds = %4, %0
%3 = call zeroext i8 @inb(i32 4096)
store i8 %3, i8* %1
br label %4
4: ; preds = %2
%5 = load i8, i8* %1
%6 = zext i8 %5 to i32
%7 = and i32 %6, 1
%8 = icmp eq i32 %7, 1
br i1 %8, label %2, label %9
9: ; preds = %4
br label %10
10: ; preds = %15, %9
%11 = load i8, i8* %1
%12 = zext i8 %11 to i32
%13 = and i32 %12, -2
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %10
%16 = call zeroext i8 @inb(i32 4096)
store i8 %16, i8* %1
br label %10
17: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @smbus_wait_until_done() {
br label %1
1: ; preds = %1, %0
%2 = tail call zeroext i8 @inb(i32 4096)
%3 = and i8 %2, 1
%4 = icmp eq i8 %3, 0
br i1 %4, label %5, label %1
5: ; preds = %1
%6 = icmp ult i8 %2, 2
br i1 %6, label %7, label %10
7: ; preds = %5, %7
%8 = tail call zeroext i8 @inb(i32 4096)
%9 = icmp ult i8 %8, 2
br i1 %9, label %7, label %10
10: ; preds = %7, %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *);
int /*<<< orphan*/ puts(char *);
void apiOut(char *text, char *jsonp) {
  puts("Content-Type:text/javascript\n");
  if (jsonp) {
    printf("%s(%s)", jsonp, text);
  } else {
    puts(text);
  }
}


x86 assembly (clang, -O0):
<apiOut>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
cmpq   $0x0,-0x10(%rbp)
je     1160 <apiOut+0x40>
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
jmp    1169 <apiOut+0x49>
mov    -0x8(%rbp),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<apiOut>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xecf(%rip),%rdi
call   1030 <puts@plt>
test   %rbx,%rbx
je     1154 <apiOut+0x34>
lea    0xedc(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <printf@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"Content-Type:text/javascript\0A\00"
@.str.1 = [7 x i8] c"%s(%s)\00"
define void @apiOut(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = call i32 @puts(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%6 = load i8*, i8** %4
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i8*, i8** %4
%10 = load i8*, i8** %3
%11 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %9, i8* %10)
br label %15
12: ; preds = %2
%13 = load i8*, i8** %3
%14 = call i32 @puts(i8* %13)
br label %15
15: ; preds = %12, %8
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"Content-Type:text/javascript\0A\00"
@.str.1 = [7 x i8] c"%s(%s)\00"
define void @apiOut(i8* %0, i8* %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i8* %1, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %1, i8* %0)
br label %9
7: ; preds = %2
%8 = tail call i32 @puts(i8* dereferenceable(1) %0)
br label %9
9: ; preds = %7, %5
ret void
}
/* Variables and functions */
int close(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void record_clean(int audio_fd) {
  if (close(audio_fd) == -1) {
    perror("/dev/dsp");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<record_clean>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
cmp    $0xffffffff,%eax
jne    1162 <record_clean+0x32>
lea    0xead(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<record_clean>:
push   %rax
call   1030 <close@plt>
cmp    $0xffffffff,%eax
je     113d <record_clean+0xd>
pop    %rax
ret
lea    0xebc(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"/dev/dsp\00"
define void @record_clean(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @close(i32 %3)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @exit(i32 1)
unreachable
9: ; preds = %1
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"/dev/dsp\00"
define void @record_clean(i32 %0) {
%2 = tail call i32 @close(i32 %0)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %1
ret void
}
int test_imm_7Cuint8_reg(unsigned char val) {
  return ((val) & (0x7C << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_7Cuint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0x7c,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_7Cuint8_reg(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, 124
%6 = icmp ne i32 %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_7Cuint8_reg(i8 zeroext %0) {
%2 = and i8 %0, 124
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ switch_off_bits(unsigned char *, int);
int /*<<< orphan*/ switch_on_bits(unsigned char *, int);
void CTRL_REGSC_BITSET_R4g_T2g(unsigned char *data) {
  switch_on_bits(data, (0x02 | 0x10));
  switch_off_bits(data, (0x01));
}


x86 assembly (clang, -O0):
<CTRL_REGSC_BITSET_R4g_T2g>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x12,%esi
call   1030 <switch_on_bits@plt>
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1040 <switch_off_bits@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CTRL_REGSC_BITSET_R4g_T2g>:
push   %rbx
mov    %rdi,%rbx
mov    $0x12,%esi
call   1030 <switch_on_bits@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
pop    %rbx
jmp    1040 <switch_off_bits@plt>

LLVM IR (-O0):
define void @CTRL_REGSC_BITSET_R4g_T2g(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @switch_on_bits(i8* %3, i32 18)
%5 = load i8*, i8** %2
%6 = call i32 @switch_off_bits(i8* %5, i32 1)
ret void
}

LLVM IR (-O2):
define void @CTRL_REGSC_BITSET_R4g_T2g(i8* %0) {
%2 = tail call i32 @switch_on_bits(i8* %0, i32 18)
%3 = tail call i32 @switch_off_bits(i8* %0, i32 1)
ret void
}
char GetEncoding12() { return 0xe5; }


x86 assembly (clang, -O0):
<GetEncoding12>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe5,%al
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetEncoding12>:
mov    $0xe5,%al
ret

LLVM IR (-O0):
define signext i8 @GetEncoding12() {
ret i8 -27
}

LLVM IR (-O2):
define signext i8 @GetEncoding12() {
ret i8 -27
}
/* Variables and functions */
int /*<<< orphan*/ execlp(char *, char *, char *, char *, char *,
                          int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
int main(void) {
  execlp("./listeArgs", "listeA", "abc", "123", "-l", NULL);
  printf("---------------\n");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    0xecf(%rip),%rsi
lea    0xecf(%rip),%rdx
lea    0xecc(%rip),%rcx
lea    0xec9(%rip),%r8
xor    %eax,%eax
mov    %eax,%r9d
call   1040 <execlp@plt>
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xedd(%rip),%rsi
lea    0xedd(%rip),%rdx
lea    0xeda(%rip),%rcx
lea    0xed7(%rip),%r8
xor    %r9d,%r9d
call   1040 <execlp@plt>
lea    0xecb(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"./listeArgs\00"
@.str.1 = [7 x i8] c"listeA\00"
@.str.2 = [4 x i8] c"abc\00"
@.str.3 = [4 x i8] c"123\00"
@.str.4 = [3 x i8] c"-l\00"
@.str.5 = [17 x i8] c"---------------\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @execlp(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* null)
%3 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"./listeArgs\00"
@.str.1 = [7 x i8] c"listeA\00"
@.str.2 = [4 x i8] c"abc\00"
@.str.3 = [4 x i8] c"123\00"
@.str.4 = [3 x i8] c"-l\00"
@str = [16 x i8] c"---------------\00"
define i32 @main() {
%1 = tail call i32 @execlp(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* null)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int sci_get_chip_id();
int soc_id_is_sc8735v0(void) {
  return ((sci_get_chip_id() & (0xFFFFFFFF)) == ((0x8300aaaa) & (0xFFFFFFFF)));
}


x86 assembly (clang, -O0):
<soc_id_is_sc8735v0>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <sci_get_chip_id@plt>
and    $0xffffffff,%eax
cmp    $0x8300aaaa,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<soc_id_is_sc8735v0>:
push   %rax
xor    %eax,%eax
call   1030 <sci_get_chip_id@plt>
xor    %ecx,%ecx
cmp    $0x8300aaaa,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @soc_id_is_sc8735v0() {
%1 = call i32 (...) @sci_get_chip_id()
%2 = and i32 %1, -1
%3 = icmp eq i32 %2, -2097108310
%4 = zext i1 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @soc_id_is_sc8735v0() {
%1 = tail call i32 (...) @sci_get_chip_id()
%2 = icmp eq i32 %1, -2097108310
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ atoi(char const *);
int /*<<< orphan*/ rcc_printf(char *, int /*<<< orphan*/);
void emit_load_ptr(const char *dst) {
  rcc_printf("  ldr r0, [fp, %d]\n", atoi(dst));
}


x86 assembly (clang, -O0):
<emit_load_ptr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <atoi@plt>
mov    %eax,%esi
lea    0xec2(%rip),%rdi
call   1040 <rcc_printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_load_ptr>:
push   %rax
call   1030 <atoi@plt>
lea    0xed3(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1040 <rcc_printf@plt>

LLVM IR (-O0):
@.str = [20 x i8] c" ldr r0, [fp, %d]\0A\00"
define void @emit_load_ptr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @atoi(i8* %3)
%5 = call i32 @rcc_printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c" ldr r0, [fp, %d]\0A\00"
define void @emit_load_ptr(i8* nocapture %0) {
%2 = tail call i32 @atoi(i8* %0)
%3 = tail call i32 @rcc_printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ const uint8_t;

/* Variables and functions */
uint8_t hfp_subevent_microphone_volume_get_status(const uint8_t *event) {
  return event[3];
}


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

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

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

LLVM IR (-O2):
define i32 @hfp_subevent_microphone_volume_get_status(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 3
%3 = load i32, i32* %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ sprintf_s(char *, size_t, char *, long);
int _ltoa_s(long value, char *str, size_t size, int radix) {
  sprintf_s(str, size, 16 == radix ? "%lx" : "%ld", value);
  return 0;
}


x86 assembly (clang, -O0):
<_ltoa_s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%r8d
mov    $0x10,%ecx
lea    0xec5(%rip),%rdx
lea    0xeba(%rip),%rax
cmp    %r8d,%ecx
cmove  %rax,%rdx
mov    -0x8(%rbp),%rcx
call   1030 <sprintf_s@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_ltoa_s>:
push   %rax
mov    %rdi,%rax
cmp    $0x10,%ecx
lea    0xee2(%rip),%rdi
lea    0xedf(%rip),%rcx
cmove  %rdi,%rcx
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %rcx,%rdx
mov    %rax,%rcx
call   1030 <sprintf_s@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lx\00"
@.str.1 = [4 x i8] c"%ld\00"
define i32 @_ltoa_s(i64 %0, i8* %1, i64 %2, i32 %3) {
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
store i64 %0, i64* %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i32 %3, i32* %8
%9 = load i8*, i8** %6
%10 = load i64, i64* %7
%11 = load i32, i32* %8
%12 = icmp eq i32 16, %11
%13 = zext i1 %12 to i64
%14 = select i1 %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0)
%15 = load i64, i64* %5
%16 = call i32 @sprintf_s(i8* %9, i64 %10, i8* %14, i64 %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lx\00"
@.str.1 = [4 x i8] c"%ld\00"
define i32 @_ltoa_s(i64 %0, i8* %1, i64 %2, i32 %3) {
%5 = icmp eq i32 %3, 16
%6 = select i1 %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0)
%7 = tail call i32 @sprintf_s(i8* %1, i64 %2, i8* %6, i64 %0)
ret i32 0
}
/* Variables and functions */
int readInt();
int /*<<< orphan*/ writeCommand(char *);
int encoderRight() {
  int counter = 0;
  writeCommand("EDR");
  counter = readInt();
  return -counter;
}


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

x86 assembly (clang, -O2):
<encoderRight>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <writeCommand@plt>
xor    %eax,%eax
call   1030 <readInt@plt>
neg    %eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"EDR\00"
define i32 @encoderRight() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @writeCommand(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @readInt()
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = sub nsw i32 0, %4
ret i32 %5
}

LLVM IR (-O2):
@.str = [4 x i8] c"EDR\00"
define i32 @encoderRight() {
%1 = tail call i32 @writeCommand(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @readInt()
%3 = sub nsw i32 0, %2
ret i32 %3
}
/* Variables and functions */
unsigned long crc32_ipmce_byte(unsigned long, int /*<<< orphan*/);
unsigned long crc32_ipmce(unsigned long sum, unsigned const char *buf,
                          unsigned int len) {
  if (len) {
    do {
      sum = crc32_ipmce_byte(sum, *buf++);
    } while (--len);
  }
  return sum;
}


x86 assembly (clang, -O0):
<crc32_ipmce>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1168 <crc32_ipmce+0x58>
jmp    1132 <crc32_ipmce+0x22>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movzbl (%rax),%esi
call   1030 <crc32_ipmce_byte@plt>
mov    %rax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jne    1132 <crc32_ipmce+0x22>
jmp    1168 <crc32_ipmce+0x58>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crc32_ipmce>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rax
test   %edx,%edx
je     1146 <crc32_ipmce+0x36>
mov    %rsi,%r14
mov    %edx,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%r14,%rbx,1),%esi
mov    %rax,%rdi
call   1030 <crc32_ipmce_byte@plt>
add    $0x1,%rbx
cmp    %ebx,%r15d
jne    1130 <crc32_ipmce+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i64 @crc32_ipmce(i64 %0, i8* nocapture %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %15, label %5
5: ; preds = %3, %5
%6 = phi i64 [ %12, %5 ], [ %0, %3 ]
%7 = phi i8* [ %9, %5 ], [ %1, %3 ]
%8 = phi i32 [ %13, %5 ], [ %2, %3 ]
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = load i8, i8* %7
%11 = zext i8 %10 to i32
%12 = tail call i64 @crc32_ipmce_byte(i64 %6, i32 %11)
%13 = add i32 %8, -1
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %3
%16 = phi i64 [ %0, %3 ], [ %12, %5 ]
ret i64 %16
}
/* Variables and functions */
char *puthex_tetra(char *, unsigned int);
char *puthex(char *b, unsigned int dword) {
  b = puthex_tetra(b, (dword & 0xFF000000) >> 24);
  b = puthex_tetra(b, (dword & 0x00FF0000) >> 16);
  b = puthex_tetra(b, (dword & 0x0000FF00) >> 8);
  b = puthex_tetra(b, (dword & 0x000000FF));
  return b;
}


x86 assembly (clang, -O0):
<puthex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
and    $0xff000000,%esi
shr    $0x18,%esi
call   1030 <puthex_tetra@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
and    $0xff0000,%esi
shr    $0x10,%esi
call   1030 <puthex_tetra@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
and    $0xff00,%esi
shr    $0x8,%esi
call   1030 <puthex_tetra@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
and    $0xff,%esi
call   1030 <puthex_tetra@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<puthex>:
push   %rbx
mov    %esi,%ebx
mov    %esi,%eax
shr    $0x18,%eax
mov    %eax,%esi
call   1030 <puthex_tetra@plt>
mov    %ebx,%ecx
shr    $0x10,%ecx
movzbl %cl,%esi
mov    %rax,%rdi
call   1030 <puthex_tetra@plt>
movzbl %bh,%esi
mov    %rax,%rdi
call   1030 <puthex_tetra@plt>
movzbl %bl,%esi
mov    %rax,%rdi
pop    %rbx
jmp    1030 <puthex_tetra@plt>

LLVM IR (-O0):
define i8* @puthex(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 = and i32 %6, -16777216
%8 = lshr i32 %7, 24
%9 = call i8* @puthex_tetra(i8* %5, i32 %8)
store i8* %9, i8** %3
%10 = load i8*, i8** %3
%11 = load i32, i32* %4
%12 = and i32 %11, 16711680
%13 = lshr i32 %12, 16
%14 = call i8* @puthex_tetra(i8* %10, i32 %13)
store i8* %14, i8** %3
%15 = load i8*, i8** %3
%16 = load i32, i32* %4
%17 = and i32 %16, 65280
%18 = lshr i32 %17, 8
%19 = call i8* @puthex_tetra(i8* %15, i32 %18)
store i8* %19, i8** %3
%20 = load i8*, i8** %3
%21 = load i32, i32* %4
%22 = and i32 %21, 255
%23 = call i8* @puthex_tetra(i8* %20, i32 %22)
store i8* %23, i8** %3
%24 = load i8*, i8** %3
ret i8* %24
}

LLVM IR (-O2):
define i8* @puthex(i8* %0, i32 %1) {
%3 = lshr i32 %1, 24
%4 = tail call i8* @puthex_tetra(i8* %0, i32 %3)
%5 = lshr i32 %1, 16
%6 = and i32 %5, 255
%7 = tail call i8* @puthex_tetra(i8* %4, i32 %6)
%8 = lshr i32 %1, 8
%9 = and i32 %8, 255
%10 = tail call i8* @puthex_tetra(i8* %7, i32 %9)
%11 = and i32 %1, 255
%12 = tail call i8* @puthex_tetra(i8* %10, i32 %11)
ret i8* %12
}
int lastblank(char line[], int pos) {
  while (line[pos + 1] == ' ' && line[pos + 1] != '\t' && line[pos + 1] != '\n')
    ++pos;
  return pos;
}


x86 assembly (clang, -O0):
<lastblank>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0xd(%rbp)
jne    1163 <lastblank+0x63>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x9,%ecx
mov    %al,-0xd(%rbp)
je     1163 <lastblank+0x63>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1173 <lastblank+0x73>
jmp    1181 <lastblank+0x81>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110b <lastblank+0xb>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lastblank>:
movslq %esi,%rcx
lea    -0x1(%rcx),%eax
add    %rdi,%rcx
add    $0x1,%rcx
nopl   (%rax)
add    $0x1,%eax
cmpb   $0x20,(%rcx)
lea    0x1(%rcx),%rcx
je     1110 <lastblank+0x10>
ret

LLVM IR (-O0):
define i32 @lastblank(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
br label %5
5: ; preds = %34, %2
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = add nsw i32 %7, 1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %6, i64 %9
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 32
br i1 %13, label %14, label %32
14: ; preds = %5
%15 = load i8*, i8** %3
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %15, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 9
br i1 %22, label %23, label %32
23: ; preds = %14
%24 = load i8*, i8** %3
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %24, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp ne i32 %30, 10
br label %32
32: ; preds = %23, %14, %5
%33 = phi i1 [ false, %14 ], [ false, %5 ], [ %31, %23 ]
br i1 %33, label %34, label %37
34: ; preds = %32
%35 = load i32, i32* %4
%36 = add nsw i32 %35, 1
store i32 %36, i32* %4
br label %5
37: ; preds = %32
%38 = load i32, i32* %4
ret i32 %38
}

LLVM IR (-O2):
define i32 @lastblank(i8* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
br label %4
4: ; preds = %4, %2
%5 = phi i64 [ %6, %4 ], [ %3, %2 ]
%6 = add nsw i64 %5, 1
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 32
br i1 %9, label %4, label %10
10: ; preds = %4
%11 = trunc i64 %5 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ __aos_mem_free(void *);
void aos_mem_free(void *buf) { __aos_mem_free(buf); }


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

x86 assembly (clang, -O2):
<aos_mem_free>:
jmp    1030 <__aos_mem_free@plt>

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

LLVM IR (-O2):
define void @aos_mem_free(i8* %0) {
%2 = tail call i32 @__aos_mem_free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ routineA();
int main(void) {
  routineA();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @routineA()
ret i32 0
}
int text_length(char *text) {
  int length = 0;
  while (text[length] != '\0')
    length++;
  return length;
}


x86 assembly (clang, -O0):
<text_length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1132 <text_length+0x32>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <text_length+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<text_length>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <text_length+0x10>
ret

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

LLVM IR (-O2):
define i32 @text_length(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
int is_space(char c) { return c == '\t' || c == ' ' || c == '\n' || c == '\r'; }


x86 assembly (clang, -O0):
<is_space>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x9,%ecx
mov    %al,-0x2(%rbp)
je     114d <is_space+0x4d>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x2(%rbp)
je     114d <is_space+0x4d>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0xa,%ecx
mov    %al,-0x2(%rbp)
je     114d <is_space+0x4d>
movsbl -0x1(%rbp),%eax
cmp    $0xd,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_space>:
cmp    $0x20,%dil
ja     1120 <is_space+0x20>
mov    $0x1,%eax
movzbl %dil,%ecx
movabs $0x100000600,%rdx
bt     %rcx,%rdx
jae    1120 <is_space+0x20>
ret
xor    %eax,%eax
cmp    $0xd,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @is_space(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 9
br i1 %5, label %18, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 32
br i1 %9, label %18, label %10
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 10
br i1 %13, label %18, label %14
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 13
br label %18
18: ; preds = %14, %10, %6, %1
%19 = phi i1 [ true, %10 ], [ true, %6 ], [ true, %1 ], [ %17, %14 ]
%20 = zext i1 %19 to i32
ret i32 %20
}

LLVM IR (-O2):
define i32 @is_space(i8 signext %0) {
switch i8 %0, label %2 [
i8 32, label %5
i8 10, label %5
i8 9, label %5
]
2: ; preds = %1
%3 = icmp eq i8 %0, 13
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %1, %1, %1, %2
%6 = phi i32 [ 1, %1 ], [ %4, %2 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %6
}
/* Variables and functions */
int easy_square(int);
int /*<<< orphan*/ printf(char *, int);
int stupid_average(int, int);
int main(int argc, char **argv) {
  printf("%d\n", easy_square(5));
  printf("%d\n", stupid_average(100, 150));
  return 0;
}


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    $0x5,%edi
call   1030 <easy_square@plt>
mov    %eax,%esi
lea    0xea7(%rip),%rdi
call   1040 <printf@plt>
mov    $0x64,%edi
mov    $0x96,%esi
call   1050 <stupid_average@plt>
mov    %eax,%esi
lea    0xe8a(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x5,%edi
call   1030 <easy_square@plt>
lea    0xebe(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x64,%edi
mov    $0x96,%esi
call   1050 <stupid_average@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
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 @easy_square(i32 5)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 @stupid_average(i32 100, i32 150)
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @easy_square(i32 5)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @stupid_average(i32 100, i32 150)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}
unsigned int history_isPair(unsigned int a, unsigned int b, unsigned int x,
                            unsigned int y) {
  return ((a == x) && (b == y)) || ((a == y) && (b == x));
  __builtin_unreachable();
}


x86 assembly (clang, -O0):
<history_isPair>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    112d <history_isPair+0x2d>
mov    -0x8(%rbp),%ecx
mov    $0x1,%al
cmp    -0x10(%rbp),%ecx
mov    %al,-0x11(%rbp)
je     1150 <history_isPair+0x50>
mov    -0x4(%rbp),%ecx
xor    %eax,%eax
cmp    -0x10(%rbp),%ecx
mov    %al,-0x12(%rbp)
jne    114a <history_isPair+0x4a>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
sete   %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<history_isPair>:
mov    %edi,%r8d
xor    %edx,%r8d
mov    %esi,%eax
xor    %ecx,%eax
or     %r8d,%eax
sete   %al
xor    %ecx,%edi
xor    %edx,%esi
or     %edi,%esi
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @history_isPair(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %7
%11 = icmp eq i32 %9, %10
br i1 %11, label %12, label %16
12: ; preds = %4
%13 = load i32, i32* %6
%14 = load i32, i32* %8
%15 = icmp eq i32 %13, %14
br i1 %15, label %26, label %16
16: ; preds = %12, %4
%17 = load i32, i32* %5
%18 = load i32, i32* %8
%19 = icmp eq i32 %17, %18
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load i32, i32* %6
%22 = load i32, i32* %7
%23 = icmp eq i32 %21, %22
br label %24
24: ; preds = %20, %16
%25 = phi i1 [ false, %16 ], [ %23, %20 ]
br label %26
26: ; preds = %24, %12
%27 = phi i1 [ true, %12 ], [ %25, %24 ]
%28 = zext i1 %27 to i32
ret i32 %28
}

LLVM IR (-O2):
define i32 @history_isPair(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %0, %2
%6 = icmp eq i32 %1, %3
%7 = and i1 %5, %6
%8 = icmp eq i32 %0, %3
%9 = icmp eq i32 %1, %2
%10 = and i1 %9, %8
%11 = or i1 %7, %10
%12 = zext i1 %11 to i32
ret i32 %12
}
/* Variables and functions */
double DBL_EPSILON;
int eqdbl(double a, double b) {
  return (a - b < DBL_EPSILON) && (b - a < DBL_EPSILON);
}


x86 assembly (clang, -O0):
<eqdbl>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
mov    0x2ec9(%rip),%rax
movsd  (%rax),%xmm0
xor    %eax,%eax
ucomisd %xmm1,%xmm0
mov    %al,-0x11(%rbp)
jbe    1151 <eqdbl+0x51>
movsd  -0x10(%rbp),%xmm1
subsd  -0x8(%rbp),%xmm1
mov    0x2ea5(%rip),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<eqdbl>:
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
mov    0x2ed9(%rip),%rax
movsd  (%rax),%xmm3
ucomisd %xmm2,%xmm3
seta   %al
subsd  %xmm0,%xmm1
ucomisd %xmm1,%xmm3
seta   %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
@DBL_EPSILON = global double 0.000000e+00
define i32 @eqdbl(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fsub double %5, %6
%8 = load double, double* @DBL_EPSILON
%9 = fcmp olt double %7, %8
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load double, double* %4
%12 = load double, double* %3
%13 = fsub double %11, %12
%14 = load double, double* @DBL_EPSILON
%15 = fcmp olt double %13, %14
br label %16
16: ; preds = %10, %2
%17 = phi i1 [ false, %2 ], [ %15, %10 ]
%18 = zext i1 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
@DBL_EPSILON = global double 0.000000e+00
define i32 @eqdbl(double %0, double %1) {
%3 = fsub double %0, %1
%4 = load double, double* @DBL_EPSILON
%5 = fcmp olt double %3, %4
%6 = fsub double %1, %0
%7 = fcmp olt double %6, %4
%8 = and i1 %5, %7
%9 = zext i1 %8 to i32
ret i32 %9
}