xunge/DecIR huggingface dataset:
/* Variables and functions */
int bbm_byte_read(void *, unsigned short, unsigned char *);
signed int bbm_com_byte_read(void *handle, unsigned short addr,
                             unsigned char *data) {
  signed int res;
  res = bbm_byte_read(handle, addr, data);
  return res;
}


x86 assembly (clang, -O0):
<bbm_com_byte_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xa(%rbp),%ax
mov    -0x18(%rbp),%rdx
movzwl %ax,%esi
call   1030 <bbm_byte_read@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bbm_com_byte_read>:
jmp    1030 <bbm_byte_read@plt>

LLVM IR (-O0):
define i32 @bbm_com_byte_read(i8* %0, i16 zeroext %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i16
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %4
store i16 %1, i16* %5
store i8* %2, i8** %6
%8 = load i8*, i8** %4
%9 = load i16, i16* %5
%10 = load i8*, i8** %6
%11 = call i32 @bbm_byte_read(i8* %8, i16 zeroext %9, i8* %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
ret i32 %12
}

LLVM IR (-O2):
define i32 @bbm_com_byte_read(i8* %0, i16 zeroext %1, i8* %2) {
%4 = tail call i32 @bbm_byte_read(i8* %0, i16 zeroext %1, i8* %2)
ret i32 %4
}
/* Variables and functions */
int getfirstocc(int *, int /*<<< orphan*/, int, int);
int getlastocc(int *, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ printf(char *, int, int);
int main(void) {
  int a[10] = {1, 2, 3, 3, 3, 3, 3, 3, 3, 4, 5, 5, 5, 5};
  int i = getfirstocc(a, 0, 13, 3);
  int j = getlastocc(a, 0, 13, 3);
  printf("%d%d", i, j);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
lea    0xead(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0xd,%edx
mov    $0x3,%ecx
call   1060 <getfirstocc@plt>
mov    %eax,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0xd,%edx
mov    $0x3,%ecx
call   1050 <getlastocc@plt>
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%esi
mov    -0x38(%rbp),%edx
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
mov    0xee3(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xec7(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeab(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xd,%edx
mov    $0x3,%ecx
call   1050 <getfirstocc@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xd,%edx
mov    $0x3,%ecx
call   1040 <getlastocc@plt>
lea    0xe9b(%rip),%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@__const.main.a = [10 x i32] [i32 1, i32 2, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 4]
@.str = [5 x i8] c"%d%d\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @getfirstocc(i32* %3, i32 0, i32 13, i32 3)
%5 = call i32 @getlastocc(i32* %3, i32 0, i32 13, i32 3)
%6 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %5)
ret i32 0
}
/* Type definitions */
struct msghdr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int sendmsg(int sockfd, const struct msghdr *msg, int flags) {
  errno = ENOSYS;
  return -1;
}


x86 assembly (clang, -O0):
<sendmsg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0x2ed3(%rip),%rax
mov    (%rax),%ecx
mov    0x2eba(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sendmsg>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct.msghdr = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @sendmsg(i32 %0, %struct.msghdr* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.msghdr*
%6 = alloca i32
store i32 %0, i32* %4
store %struct.msghdr* %1, %struct.msghdr** %5
store i32 %2, i32* %6
%7 = load i32, i32* @ENOSYS
store i32 %7, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
%struct.msghdr = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @sendmsg(i32 %0, %struct.msghdr* nocapture readnone %1, i32 %2) {
%4 = load i32, i32* @ENOSYS
store i32 %4, i32* @errno
ret i32 -1
}
int test_imm_57int32_reg(int val) { return ((val) & (0x57 << 0)) ? -20 : -40; }


x86 assembly (clang, -O0):
<test_imm_57int32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x57,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_57int32_reg(i32 %0) {
%2 = and i32 %0, 87
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int errno;
int /*<<< orphan*/ execvp(char *, char **);
int /*<<< orphan*/ printf(char *, int);
int run_entry_point(char *entry_point, char **argv) {
  execvp(entry_point, argv);
  printf("run_entry_point(): execvp(): %d\n", errno);
  return -1;
}


x86 assembly (clang, -O0):
<run_entry_point>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <execvp@plt>
mov    0x2e9c(%rip),%rax
mov    (%rax),%esi
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_entry_point>:
push   %rax
call   1040 <execvp@plt>
mov    0x2eb3(%rip),%rax
mov    (%rax),%esi
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"run_entry_point(): execvp(): %d\0A\00"
@errno = global i32 0
define i32 @run_entry_point(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
store i8* %0, i8** %3
store i8** %1, i8*** %4
%5 = load i8*, i8** %3
%6 = load i8**, i8*** %4
%7 = call i32 @execvp(i8* %5, i8** %6)
%8 = load i32, i32* @errno
%9 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 -1
}

LLVM IR (-O2):
@.str = [33 x i8] c"run_entry_point(): execvp(): %d\0A\00"
@errno = global i32 0
define i32 @run_entry_point(i8* %0, i8** %1) {
%3 = tail call i32 @execvp(i8* %0, i8** %1)
%4 = load i32, i32* @errno
%5 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, char const *);
int /*<<< orphan*/ putchar(int);
void print_tile(const char *color_code, const char *tile) {
  putchar(0x00);
  putchar(0x1b);
  printf("%s%s", color_code, tile);
}


x86 assembly (clang, -O0):
<print_tile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %edi,%edi
call   1030 <putchar@plt>
mov    $0x1b,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xeb0(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_tile>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
call   1030 <putchar@plt>
mov    $0x1b,%edi
call   1030 <putchar@plt>
lea    0xebe(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <printf@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"%s%s\00"
define void @print_tile(i8* %0, i8* %1) {
%3 = tail call i32 @putchar(i32 0)
%4 = tail call i32 @putchar(i32 27)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ internal_fiat_poly1305_carry_square(uintptr_t, uintptr_t);
void fiat_poly1305_carry_square(uint64_t out1[3], const uint64_t arg1[3]) {
  internal_fiat_poly1305_carry_square((uintptr_t)out1, (uintptr_t)arg1);
}


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

x86 assembly (clang, -O2):
<fiat_poly1305_carry_square>:
jmp    1030 <internal_fiat_poly1305_carry_square@plt>

LLVM IR (-O0):
define void @fiat_poly1305_carry_square(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 = ptrtoint i32* %5 to i64
%7 = load i32*, i32** %4
%8 = ptrtoint i32* %7 to i64
%9 = call i32 @internal_fiat_poly1305_carry_square(i64 %6, i64 %8)
ret void
}

LLVM IR (-O2):
define void @fiat_poly1305_carry_square(i32* %0, i32* %1) {
%3 = ptrtoint i32* %0 to i64
%4 = ptrtoint i32* %1 to i64
%5 = tail call i32 @internal_fiat_poly1305_carry_square(i64 %3, i64 %4)
ret void
}
/* Type definitions */
typedef unsigned long volatile uint32_t;

/* Variables and functions */
uint32_t SysCtlIntStatus(bool bMasked) {
  if (bMasked) {
    return ((*((volatile unsigned long *)(0x400FE058))));
  } else {
    return ((*((volatile unsigned long *)(0x400FE050))));
  }
}


x86 assembly (clang, -O0):
<SysCtlIntStatus>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1122 <SysCtlIntStatus+0x22>
mov    $0x400fe058,%eax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    112e <SysCtlIntStatus+0x2e>
mov    $0x400fe050,%eax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SysCtlIntStatus>:
xor    %eax,%eax
test   %edi,%edi
setne  %al
mov    0x400fe050(,%rax,8),%rax
40
ret

LLVM IR (-O0):
define i64 @SysCtlIntStatus(i32 %0) {
%2 = alloca i64
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load volatile i64, i64* inttoptr (i64 1074782296 to i64*)
store i64 %7, i64* %2
br label %10
8: ; preds = %1
%9 = load volatile i64, i64* inttoptr (i64 1074782288 to i64*)
store i64 %9, i64* %2
br label %10
10: ; preds = %8, %6
%11 = load i64, i64* %2
ret i64 %11
}

LLVM IR (-O2):
define i64 @SysCtlIntStatus(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i64* inttoptr (i64 1074782288 to i64*), i64* inttoptr (i64 1074782296 to i64*)
%4 = load volatile i64, i64* %3
ret i64 %4
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int strlen(char *);
uint8_t gaps(char *str) {
  uint8_t cnt = 0;
  for (int i = 0; i < strlen(str); i++) {
    cnt += (str[i] == '_');
  }
  return cnt;
}


x86 assembly (clang, -O0):
<gaps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
jge    1171 <gaps+0x61>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5f,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112a <gaps+0x1a>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gaps>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
test   %eax,%eax
jle    1151 <gaps+0x41>
xor    %ebx,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
cmpb   $0x5f,(%r14,%rbx,1)
sete   %al
add    %eax,%ebp
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1130 <gaps+0x20>
jmp    1153 <gaps+0x43>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @gaps(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %6, %1
%5 = phi i32 [ 0, %1 ], [ %13, %6 ]
ret i32 %5
6: ; preds = %1, %6
%7 = phi i64 [ %14, %6 ], [ 0, %1 ]
%8 = phi i32 [ %13, %6 ], [ 0, %1 ]
%9 = getelementptr inbounds i8, i8* %0, i64 %7
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 95
%12 = zext i1 %11 to i32
%13 = add nuw nsw i32 %8, %12
%14 = add nuw nsw i64 %7, 1
%15 = tail call i32 @strlen(i8* %0)
%16 = sext i32 %15 to i64
%17 = icmp slt i64 %14, %16
br i1 %17, label %6, label %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ logmsg(int, char *, size_t);
void *realloc(void *, size_t);
void *srealloc(void *p, size_t size) {
  void *result = realloc(p, size);
  if (result == NULL) {
    logmsg(0x03, "realloc(%zu) failed\n", size);
    exit(1);
  }
  return result;
}


x86 assembly (clang, -O0):
<srealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    117b <srealloc+0x4b>
mov    -0x10(%rbp),%rdx
mov    $0x3,%edi
lea    0xe94(%rip),%rsi
call   1040 <logmsg@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<srealloc>:
push   %rbx
mov    %rsi,%rbx
call   1030 <realloc@plt>
test   %rax,%rax
je     1140 <srealloc+0x10>
pop    %rbx
ret
lea    0xeb9(%rip),%rsi
mov    $0x3,%edi
mov    %rbx,%rdx
call   1040 <logmsg@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"realloc(%zu) failed\0A\00"
define i8* @srealloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i64, i64* %4
%13 = call i32 @logmsg(i32 3, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i64 %12)
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %2
%16 = load i8*, i8** %5
ret i8* %16
}

LLVM IR (-O2):
@.str = [21 x i8] c"realloc(%zu) failed\0A\00"
define noalias i8* @srealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 @logmsg(i32 3, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i64 %1)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
ret i8* %3
}
/* Type definitions */
typedef size_t uint32_t;
typedef size_t int32_t;

/* Variables and functions */
void copy_stack_usage(int32_t *stack_usage, uint32_t ebp, uint32_t *ptrs) {
  uint32_t idx = 0;
  while (stack_usage[idx]) {
    ptrs[idx] = *((uint32_t *)(ebp + stack_usage[idx]));
    idx++;
  }
}


x86 assembly (clang, -O0):
<copy_stack_usage>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     115b <copy_stack_usage+0x5b>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    -0x20(%rbp),%rdx
add    (%rcx,%rdx,8),%rax
mov    (%rax),%rdx
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1118 <copy_stack_usage+0x18>
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_stack_usage>:
mov    (%rdi),%rax
test   %rax,%rax
je     1126 <copy_stack_usage+0x26>
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
mov    (%rax,%rsi,1),%rax
mov    %rax,(%rdx,%rcx,1)
mov    0x8(%rdi,%rcx,1),%rax
add    $0x8,%rcx
test   %rax,%rax
jne    1110 <copy_stack_usage+0x10>
ret

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

LLVM IR (-O2):
define void @copy_stack_usage(i64* nocapture %0, i64 %1, i64* nocapture writeonly %2) {
%4 = load i64, i64* %0
%5 = icmp eq i64 %4, 0
br i1 %5, label %17, label %6
6: ; preds = %3, %6
%7 = phi i64 [ %15, %6 ], [ %4, %3 ]
%8 = phi i64 [ %13, %6 ], [ 0, %3 ]
%9 = add i64 %7, %1
%10 = inttoptr i64 %9 to i64*
%11 = load i64, i64* %10
%12 = getelementptr inbounds i64, i64* %2, i64 %8
store i64 %11, i64* %12
%13 = add i64 %8, 1
%14 = getelementptr inbounds i64, i64* %0, i64 %13
%15 = load i64, i64* %14
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %6
17: ; preds = %6, %3
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ parse_timestamp(char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char const *);
int strlen(char const *);
time_t parse_datestamp(const char *string) {
  char zs[128];
  if (strlen(string) != 10)
    return 0;
  strcpy(zs, string);
  strcat(zs, "T12:00:00Z");
  return parse_timestamp(zs);
}


x86 assembly (clang, -O0):
<parse_datestamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0xa,%eax
je     116d <parse_datestamp+0x2d>
movl   $0x0,-0x4(%rbp)
jmp    119f <parse_datestamp+0x5f>
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x90(%rbp),%rdi
lea    0xe75(%rip),%rsi
call   1050 <strcat@plt>
lea    -0x90(%rbp),%rdi
call   1060 <parse_timestamp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_datestamp>:
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
jne    1180 <parse_datestamp+0x40>
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xe90(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcat@plt>
mov    %r14,%rdi
call   1060 <parse_timestamp@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [11 x i8] c"T12:00:00Z\00"
define i32 @parse_datestamp(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [128 x i8]
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @strlen(i8* %5)
%7 = icmp ne i32 %6, 10
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %2
br label %17
9: ; preds = %1
%10 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%11 = load i8*, i8** %3
%12 = call i32 @strcpy(i8* %10, i8* %11)
%13 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%14 = call i32 @strcat(i8* %13, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%15 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%16 = call i32 @parse_timestamp(i8* %15)
store i32 %16, i32* %2
br label %17
17: ; preds = %9, %8
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
@.str = [11 x i8] c"T12:00:00Z\00"
define i32 @parse_datestamp(i8* %0) {
%2 = alloca [128 x i8]
%3 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @strlen(i8* %0)
%5 = icmp eq i32 %4, 10
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = call i32 @strcpy(i8* %3, i8* %0)
%8 = call i32 @strcat(i8* %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @parse_timestamp(i8* %3)
br label %10
10: ; preds = %1, %6
%11 = phi i32 [ %9, %6 ], [ 0, %1 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ __chk_fail_overlap();
void __chk_overlap(const void *a, size_t an, const void *b, size_t bn) {
  if (((uintptr_t)a) <= ((uintptr_t)b) + bn &&
      ((uintptr_t)b) <= ((uintptr_t)a) + an)
    __chk_fail_overlap();
}


x86 assembly (clang, -O0):
<__chk_overlap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
add    -0x20(%rbp),%rcx
cmp    %rcx,%rax
ja     1159 <__chk_overlap+0x49>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
add    -0x10(%rbp),%rcx
cmp    %rcx,%rax
ja     1159 <__chk_overlap+0x49>
mov    $0x0,%al
call   1030 <__chk_fail_overlap@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__chk_overlap>:
add    %rdi,%rsi
cmp    %rdx,%rsi
jb     1127 <__chk_overlap+0x17>
add    %rcx,%rdx
cmp    %rdi,%rdx
jb     1127 <__chk_overlap+0x17>
xor    %eax,%eax
jmp    1030 <__chk_fail_overlap@plt>
ret

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

LLVM IR (-O2):
define void @__chk_overlap(i8* %0, i64 %1, i8* %2, i64 %3) {
%5 = ptrtoint i8* %0 to i64
%6 = ptrtoint i8* %2 to i64
%7 = add i64 %6, %3
%8 = icmp ult i64 %7, %5
%9 = add i64 %5, %1
%10 = icmp ult i64 %9, %6
%11 = or i1 %10, %8
br i1 %11, label %14, label %12
12: ; preds = %4
%13 = tail call i32 (...) @__chk_fail_overlap()
br label %14
14: ; preds = %12, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void keyboard(unsigned char key, int x, int y) {
  if (key == 27) {
    exit(0);
  }
}


x86 assembly (clang, -O0):
<keyboard>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x1b,%eax
jne    1138 <keyboard+0x28>
xor    %edi,%edi
call   1030 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<keyboard>:
cmp    $0x1b,%dil
je     1117 <keyboard+0x7>
ret
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @keyboard(i8 zeroext %0, i32 %1, i32 %2) {
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
store i8 %0, i8* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8, i8* %4
%8 = zext i8 %7 to i32
%9 = icmp eq i32 %8, 27
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = call i32 @exit(i32 0)
unreachable
12: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @keyboard(i8 zeroext %0, i32 %1, i32 %2) {
%4 = icmp eq i8 %0, 27
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @exit(i32 0)
unreachable
7: ; preds = %3
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ tempString;

/* Variables and functions */
int /*<<< orphan*/ getSexComponents(double, int *, int *, int *);
int setStandardProcedure(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, int, int, int);
int setSiteLatitude(double Lat) {
  int d, m, s;
  char tempString[32];
  getSexComponents(Lat, &d, &m, &s);
  snprintf(tempString, sizeof(tempString), "#:St%+03d:%02d:%02d#", d, m, s);
  return (setStandardProcedure(tempString));
}


x86 assembly (clang, -O0):
<setSiteLatitude>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    -0xc(%rbp),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
call   1050 <getSexComponents@plt>
lea    -0x40(%rbp),%rdi
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
mov    -0x14(%rbp),%r9d
mov    $0x20,%esi
lea    0xe92(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x40(%rbp),%rdi
call   1030 <setStandardProcedure@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setSiteLatitude>:
push   %rbx
sub    $0x30,%rsp
lea    0xc(%rsp),%rdi
lea    0x8(%rsp),%rsi
lea    0x4(%rsp),%rdx
call   1050 <getSexComponents@plt>
mov    0xc(%rsp),%ecx
mov    0x8(%rsp),%r8d
mov    0x4(%rsp),%r9d
lea    0xea2(%rip),%rdx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x20,%esi
call   1040 <snprintf@plt>
mov    %rbx,%rdi
call   1030 <setStandardProcedure@plt>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"#:St%+03d:%02d:%02d#\00"
define i32 @setSiteLatitude(double %0) {
%2 = alloca double
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [32 x i8]
store double %0, double* %2
%7 = load double, double* %2
%8 = call i32 @getSexComponents(double %7, i32* %3, i32* %4, i32* %5)
%9 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = call i32 @snprintf(i8* %9, i32 32, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %11, i32 %12)
%14 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%15 = call i32 @setStandardProcedure(i8* %14)
ret i32 %15
}

LLVM IR (-O2):
@.str = [21 x i8] c"#:St%+03d:%02d:%02d#\00"
define i32 @setSiteLatitude(double %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [32 x i8]
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%10 = call i32 @getSexComponents(double %0, i32* %2, i32* %3, i32* %4)
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = call i32 @snprintf(i8* %9, i32 32, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %12, i32 %13)
%15 = call i32 @setStandardProcedure(i8* %9)
ret i32 %15
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
void UpnpDisplayFileAndLine(FILE *fd, const char *DbgFileName, int DbgLineNo) {
  return;
  fd = fd;
  DbgFileName = DbgFileName;
  DbgLineNo = DbgLineNo;
}


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

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

LLVM IR (-O0):
define void @UpnpDisplayFileAndLine(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
ret void
}

LLVM IR (-O2):
define void @UpnpDisplayFileAndLine(i32* nocapture %0, i8* nocapture %1, i32 %2) {
ret void
}
void SystraceCounter(const char *name, const int value) {
  (void)name;
  (void)value;
}


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

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

LLVM IR (-O0):
define void @SystraceCounter(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
ret void
}

LLVM IR (-O2):
define void @SystraceCounter(i8* nocapture %0, i32 %1) {
ret void
}
int __attribute__((target("no-sse2"))) echidna(int a) { return 4; }


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

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

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

LLVM IR (-O2):
define i32 @echidna(i32 %0) {
ret i32 4
}
/* Type definitions */
typedef int /*<<< orphan*/ X509_EXTENSION;

/* Variables and functions */
int /*<<< orphan*/ *ASN1_item_dup(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ X509_EXTENSION_it;
X509_EXTENSION *X509_EXTENSION_dup(X509_EXTENSION *x) {
  return ASN1_item_dup(&X509_EXTENSION_it, x);
}


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

x86 assembly (clang, -O2):
<X509_EXTENSION_dup>:
mov    %rdi,%rsi
mov    0x2ec6(%rip),%rdi
jmp    1030 <ASN1_item_dup@plt>

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

LLVM IR (-O2):
@X509_EXTENSION_it = global i32 0
define i32* @X509_EXTENSION_dup(i32* %0) {
%2 = tail call i32* @ASN1_item_dup(i32* @X509_EXTENSION_it, i32* %0)
ret i32* %2
}
int is_opening_quote(char x, char q) {
  return ((q == '\0') && ((x == '\"') || (x == '{')));
}


x86 assembly (clang, -O0):
<is_opening_quote>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x3(%rbp)
jne    1147 <is_opening_quote+0x47>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x22,%ecx
mov    %al,-0x4(%rbp)
je     1141 <is_opening_quote+0x41>
movsbl -0x1(%rbp),%eax
cmp    $0x7b,%eax
sete   %al
mov    %al,-0x4(%rbp)
mov    -0x4(%rbp),%al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_opening_quote>:
test   %sil,%sil
sete   %al
cmp    $0x22,%dil
sete   %cl
cmp    $0x7b,%dil
sete   %dl
or     %cl,%dl
and    %al,%dl
movzbl %dl,%eax
ret

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

LLVM IR (-O2):
define i32 @is_opening_quote(i8 signext %0, i8 signext %1) {
%3 = icmp eq i8 %1, 0
%4 = icmp eq i8 %0, 34
%5 = icmp eq i8 %0, 123
%6 = or i1 %4, %5
%7 = and i1 %3, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
unsigned char hex_to_ascii_nib(unsigned char nib) {
  if (nib < 10) {
    return nib + '0';
  } else {
    return (nib - 10) + 'a';
  }
}


x86 assembly (clang, -O0):
<hex_to_ascii_nib>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movzbl -0x2(%rbp),%eax
cmp    $0xa,%eax
jge    1126 <hex_to_ascii_nib+0x26>
movzbl -0x2(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x1(%rbp)
jmp    1133 <hex_to_ascii_nib+0x33>
movzbl -0x2(%rbp),%eax
sub    $0xa,%eax
add    $0x61,%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hex_to_ascii_nib>:
cmp    $0xa,%dil
mov    $0x30,%ecx
mov    $0x57,%eax
cmovb  %ecx,%eax
add    %dil,%al
ret

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

LLVM IR (-O2):
define zeroext i8 @hex_to_ascii_nib(i8 zeroext %0) {
%2 = icmp ult i8 %0, 10
%3 = select i1 %2, i8 48, i8 87
%4 = add i8 %3, %0
ret i8 %4
}
/* Type definitions */
struct array {
  int dummy;
};

/* Variables and functions */
void *array_get(struct array const *, int /*<<< orphan*/);
void *queue_peek(const struct array *q) { return array_get(q, 0); }


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

x86 assembly (clang, -O2):
<queue_peek>:
xor    %esi,%esi
jmp    1030 <array_get@plt>

LLVM IR (-O0):
%struct.array = type { i32 }
define i8* @queue_peek(%struct.array* %0) {
%2 = alloca %struct.array*
store %struct.array* %0, %struct.array** %2
%3 = load %struct.array*, %struct.array** %2
%4 = call i8* @array_get(%struct.array* %3, i32 0)
ret i8* %4
}

LLVM IR (-O2):
%struct.array = type { i32 }
define i8* @queue_peek(%struct.array* %0) {
%2 = tail call i8* @array_get(%struct.array* %0, i32 0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int /*<<< orphan*/ scanf(char *, char *);
void reverse() {
  char c;
  scanf("%c", &c);
  if (c != '\n') {
    reverse();
    printf("%c", c);
  }
}


x86 assembly (clang, -O0):
<reverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    -0x1(%rbp),%rsi
call   1050 <scanf@plt>
movsbl -0x1(%rbp),%eax
cmp    $0xa,%eax
je     116a <reverse+0x3a>
call   1030 <reverse@plt>
lea    0xe9f(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1050 <scanf@plt>
cmpb   $0xa,0x7(%rsp)
je     115f <reverse+0x2f>
call   1030 <reverse@plt>
movsbl 0x7(%rsp),%esi
lea    0xea6(%rip),%rdi
call   1040 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
define void @reverse() {
%1 = alloca i8
%2 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%3 = load i8, i8* %1
%4 = sext i8 %3 to i32
%5 = icmp ne i32 %4, 10
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = load i8, i8* %1
%8 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %7)
br label %9
9: ; preds = %6, %0
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @reverse() {
%1 = alloca i8
%2 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 10
br i1 %4, label %8, label %5
5: ; preds = %0
%6 = load i8, i8* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %6)
br label %8
8: ; preds = %5, %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ pr_inf_skip(char *, char const *);
int /*<<< orphan*/ stress_check_capability(int);
int stress_cyclic_supported(const char *name) {
  if (!stress_check_capability((-1))) {
    pr_inf_skip("%s stressor needs to be run with CAP_SYS_NICE "
                "set SCHED_RR, SCHED_FIFO or SCHED_DEADLINE priorities, "
                "skipping this stressor\n",
                name);
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<stress_cyclic_supported>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0xffffffff,%edi
call   1030 <stress_check_capability@plt>
cmp    $0x0,%eax
jne    115b <stress_cyclic_supported+0x3b>
mov    -0x10(%rbp),%rsi
lea    0xeb6(%rip),%rdi
call   1040 <pr_inf_skip@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1162 <stress_cyclic_supported+0x42>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stress_cyclic_supported>:
push   %rbx
mov    %rdi,%rbx
mov    $0xffffffff,%edi
call   1030 <stress_check_capability@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
je     1138 <stress_cyclic_supported+0x18>
pop    %rbx
ret
lea    0xec1(%rip),%rdi
mov    %rbx,%rsi
call   1040 <pr_inf_skip@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [125 x i8] c"%s stressor needs to be run with CAP_SYS_NICE set SCHED_RR, SCHED_FIFO or SCHED_DEADLINE priorities, skipping this stressor\0A\00"
define i32 @stress_cyclic_supported(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = call i32 @stress_check_capability(i32 -1)
%5 = icmp ne i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i8*, i8** %3
%8 = call i32 @pr_inf_skip(i8* getelementptr inbounds ([125 x i8], [125 x i8]* @.str, i64 0, i64 0), i8* %7)
store i32 -1, i32* %2
br label %10
9: ; preds = %1
store i32 0, i32* %2
br label %10
10: ; preds = %9, %6
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
@.str = [125 x i8] c"%s stressor needs to be run with CAP_SYS_NICE set SCHED_RR, SCHED_FIFO or SCHED_DEADLINE priorities, skipping this stressor\0A\00"
define i32 @stress_cyclic_supported(i8* %0) {
%2 = tail call i32 @stress_check_capability(i32 -1)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @pr_inf_skip(i8* getelementptr inbounds ([125 x i8], [125 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ -1, %4 ], [ 0, %1 ]
ret i32 %7
}
/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
int /*<<< orphan*/ ENODEV;
int /*<<< orphan*/ errno;
ssize_t write(int fd, const void *src, size_t count) {
  (void)fd;
  (void)src;
  (void)count;
  errno = ENODEV;
  return -1;
}


x86 assembly (clang, -O0):
<write>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec1(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<write>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%eax
mov    0x2ed0(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@ENODEV = global i32 0
@errno = global i32 0
define i32 @write(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32 %0, i32* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = load i32, i32* @ENODEV
store i32 %10, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ENODEV = global i32 0
@errno = global i32 0
define i32 @write(i32 %0, i8* nocapture readnone %1, i64 %2) {
%4 = load i32, i32* @ENODEV
store i32 %4, i32* @errno
ret i32 -1
}
/* Type definitions */
struct option {
  int dummy;
};

/* Variables and functions */
int getopt_long(int, char **, char const *, struct option const *, int *);
int do_getopt_long(int argc, const char **argv, const char *shortopts,
                   const struct option *longopts, int *longind) {
  return getopt_long(argc, (char **)argv, shortopts, longopts, longind);
}


x86 assembly (clang, -O0):
<do_getopt_long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1030 <getopt_long@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_getopt_long>:
jmp    1030 <getopt_long@plt>

LLVM IR (-O0):
%struct.option = type { i32 }
define i32 @do_getopt_long(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8*
%9 = alloca %struct.option*
%10 = alloca i32*
store i32 %0, i32* %6
store i8** %1, i8*** %7
store i8* %2, i8** %8
store %struct.option* %3, %struct.option** %9
store i32* %4, i32** %10
%11 = load i32, i32* %6
%12 = load i8**, i8*** %7
%13 = load i8*, i8** %8
%14 = load %struct.option*, %struct.option** %9
%15 = load i32*, i32** %10
%16 = call i32 @getopt_long(i32 %11, i8** %12, i8* %13, %struct.option* %14, i32* %15)
ret i32 %16
}

LLVM IR (-O2):
%struct.option = type { i32 }
define i32 @do_getopt_long(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4) {
%6 = tail call i32 @getopt_long(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, void *);
int /*<<< orphan*/ stderr;
void rtpp_stream_finish_playback_fin(void *pub) {
  fprintf(stderr,
          "Method rtpp_stream@%p::finish_playback "
          "(rtpp_stream_finish_playback) is invoked after destruction\x0a",
          pub);
  abort();
}


x86 assembly (clang, -O0):
<rtpp_stream_finish_playback_fin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<rtpp_stream_finish_playback_fin>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [99 x i8] c"Method rtpp_stream@%p::finish_playback (rtpp_stream_finish_playback) is invoked after destruction\0A\00"
define void @rtpp_stream_finish_playback_fin(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [99 x i8] c"Method rtpp_stream@%p::finish_playback (rtpp_stream_finish_playback) is invoked after destruction\0A\00"
define void @rtpp_stream_finish_playback_fin(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
char *diag_instance_base_str(unsigned int);
char *diag_instance_str(unsigned int);
int snprintf(char *, size_t, char *, char *, char *);
int get_diag_instance_info(char *str, size_t size, unsigned int instance) {
  return snprintf(str, size, "%s:%s", diag_instance_base_str(instance >> 6),
                  diag_instance_str(instance & 0x3f));
}


x86 assembly (clang, -O0):
<get_diag_instance_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
shr    $0x6,%edi
call   1050 <diag_instance_base_str@plt>
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
and    $0x3f,%edi
call   1040 <diag_instance_str@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rcx
mov    %rax,%r8
lea    0xe7d(%rip),%rdx
call   1030 <snprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_diag_instance_info>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %edx,%edi
shr    $0x6,%edi
call   1050 <diag_instance_base_str@plt>
mov    %rax,%r12
and    $0x3f,%ebx
mov    %ebx,%edi
call   1040 <diag_instance_str@plt>
lea    0xea2(%rip),%rdx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r12,%rcx
mov    %rax,%r8
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <snprintf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%s:%s\00"
define i32 @get_diag_instance_info(i8* %0, i64 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
store i8* %0, i8** %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i64, i64* %5
%9 = load i32, i32* %6
%10 = lshr i32 %9, 6
%11 = call i8* @diag_instance_base_str(i32 %10)
%12 = load i32, i32* %6
%13 = and i32 %12, 63
%14 = call i8* @diag_instance_str(i32 %13)
%15 = call i32 @snprintf(i8* %7, i64 %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %11, i8* %14)
ret i32 %15
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s:%s\00"
define i32 @get_diag_instance_info(i8* %0, i64 %1, i32 %2) {
%4 = lshr i32 %2, 6
%5 = tail call i8* @diag_instance_base_str(i32 %4)
%6 = and i32 %2, 63
%7 = tail call i8* @diag_instance_str(i32 %6)
%8 = tail call i32 @snprintf(i8* %0, i64 %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %7)
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ __wfi();
void check__wfi(void) { __wfi(); }


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

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

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

LLVM IR (-O2):
define void @check__wfi() {
%1 = tail call i32 (...) @__wfi()
ret void
}