xunge/DecIR huggingface dataset:
long foo1(long x) { return __builtin_popcountl(x); }


x86 assembly (clang, -O0):
<foo1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
mov    %rcx,%rax
shr    %rax
movabs $0x5555555555555555,%rdx
55 55 55
and    %rdx,%rax
sub    %rax,%rcx
movabs $0x3333333333333333,%rdx
33 33 33
mov    %rcx,%rax
and    %rdx,%rax
shr    $0x2,%rcx
and    %rdx,%rcx
add    %rcx,%rax
mov    %rax,%rcx
shr    $0x4,%rcx
add    %rcx,%rax
movabs $0xf0f0f0f0f0f0f0f,%rcx
0f 0f 0f
and    %rcx,%rax
movabs $0x101010101010101,%rcx
01 01 01
imul   %rcx,%rax
shr    $0x38,%rax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo1>:
mov    %rdi,%rax
shr    %rax
movabs $0x5555555555555555,%rcx
55 55 55
and    %rax,%rcx
sub    %rcx,%rdi
movabs $0x3333333333333333,%rax
33 33 33
mov    %rdi,%rcx
and    %rax,%rcx
shr    $0x2,%rdi
and    %rdi,%rax
add    %rcx,%rax
mov    %rax,%rcx
shr    $0x4,%rcx
add    %rax,%rcx
movabs $0xf0f0f0f0f0f0f0f,%rdx
0f 0f 0f
and    %rcx,%rdx
movabs $0x101010101010101,%rax
01 01 01
imul   %rdx,%rax
shr    $0x38,%rax
ret

LLVM IR (-O0):
define i64 @foo1(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i64 @llvm.ctpop.i64(i64 %3)
%5 = trunc i64 %4 to i32
%6 = sext i32 %5 to i64
ret i64 %6
}

LLVM IR (-O2):
define i64 @foo1(i64 %0) {
%2 = tail call i64 @llvm.ctpop.i64(i64 %0)
ret i64 %2
}
int print_ledger_default(parameter) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @print_ledger_default(i32 %0) {
ret i32 1
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint32_t;

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


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

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

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

LLVM IR (-O2):
define i32 @u8to32(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = trunc i64 %2 to i32
%4 = getelementptr inbounds i64, i64* %0, i64 1
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = shl i32 %6, 8
%8 = or i32 %7, %3
%9 = getelementptr inbounds i64, i64* %0, i64 2
%10 = load i64, i64* %9
%11 = trunc i64 %10 to i32
%12 = shl i32 %11, 16
%13 = or i32 %8, %12
%14 = getelementptr inbounds i64, i64* %0, i64 3
%15 = load i64, i64* %14
%16 = trunc i64 %15 to i32
%17 = shl i32 %16, 24
%18 = or i32 %13, %17
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ debug_board_write_byte(int /*<<< orphan*/);
void debug_board_write_str(const char *str) {
  while (*str)
    debug_board_write_byte(*str++);
}


x86 assembly (clang, -O0):
<debug_board_write_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1145 <debug_board_write_str+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <debug_board_write_byte@plt>
jmp    111c <debug_board_write_str+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<debug_board_write_str>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <debug_board_write_str+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <debug_board_write_byte@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <debug_board_write_str+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @debug_board_write_str(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = sext i8 %5 to i32
%9 = tail call i32 @debug_board_write_byte(i32 %8)
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ volatile uint8_t;

/* Variables and functions */
void set_pins(volatile uint8_t *port, uint8_t bit_set_mask) {
  *port |= bit_set_mask;
}


x86 assembly (clang, -O0):
<set_pins>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
or     %edx,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_pins>:
mov    %esi,-0x4(%rsp)
mov    -0x4(%rsp),%eax
or     %eax,(%rdi)
ret

LLVM IR (-O0):
define void @set_pins(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store volatile i32 %1, i32* %4
%5 = load volatile i32, i32* %4
%6 = load i32*, i32** %3
%7 = load volatile i32, i32* %6
%8 = or i32 %7, %5
store volatile i32 %8, i32* %6
ret void
}

LLVM IR (-O2):
define void @set_pins(i32* %0, i32 %1) {
%3 = alloca i32
store volatile i32 %1, i32* %3
%4 = load volatile i32, i32* %3
%5 = load volatile i32, i32* %0
%6 = or i32 %5, %4
store volatile i32 %6, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ parser_run_tests();
int main(int argc, const char *argv[]) {
  parser_run_tests();
  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    $0x0,%al
call   1030 <parser_run_tests@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @parser_run_tests()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *malloc(unsigned int);
int /*<<< orphan*/ stderr;
void *errorchecked_malloc(unsigned int size) {
  void *ptr;
  ptr = malloc(size);
  if (ptr == NULL) {
    fprintf(stderr, "Error: could not allocate heap memory.\n");
    exit(-1);
  }
  return ptr;
}


x86 assembly (clang, -O0):
<errorchecked_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1171 <errorchecked_malloc+0x41>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
lea    0xe9e(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<errorchecked_malloc>:
push   %rax
call   1040 <malloc@plt>
test   %rax,%rax
je     113d <errorchecked_malloc+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [40 x i8] c"Error: could not allocate heap memory.\0A\00"
define i8* @errorchecked_malloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 -1)
unreachable
12: ; preds = %1
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [40 x i8] c"Error: could not allocate heap memory.\0A\00"
define noalias i8* @errorchecked_malloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 -1)
unreachable
8: ; preds = %1
ret i8* %2
}
void midi_reset(void) {}


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

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

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

LLVM IR (-O2):
define void @midi_reset() {
ret void
}
void mem_chunk_init_openmp(void) { return; }


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

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

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

LLVM IR (-O2):
define void @mem_chunk_init_openmp() {
ret void
}
int test_imm_47uint16_mem(unsigned short *val) {
  return ((*val) & (0x47 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_47uint16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzwl (%rax),%edx
and    $0x47,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_47uint16_mem>:
testb  $0x47,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_47uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 71
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("System doesn't support full POSIX capabilities.\n");
  return 1;
}


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

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

LLVM IR (-O0):
@.str = [49 x i8] c"System doesn't support full POSIX capabilities.\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@str = [48 x i8] c"System doesn't support full POSIX capabilities.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
ret i32 1
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
struct AES_ctx {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ AES_CTR_xcrypt_buffer(struct AES_ctx *, int /*<<< orphan*/ *,
                                         size_t);
void AES_encrypt_buf(struct AES_ctx *ctx, uint8_t *buf, size_t length) {
  AES_CTR_xcrypt_buffer(ctx, buf, length);
}


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

x86 assembly (clang, -O2):
<AES_encrypt_buf>:
jmp    1030 <AES_CTR_xcrypt_buffer@plt>

LLVM IR (-O0):
%struct.AES_ctx = type { i32 }
define void @AES_encrypt_buf(%struct.AES_ctx* %0, i32* %1, i64 %2) {
%4 = alloca %struct.AES_ctx*
%5 = alloca i32*
%6 = alloca i64
store %struct.AES_ctx* %0, %struct.AES_ctx** %4
store i32* %1, i32** %5
store i64 %2, i64* %6
%7 = load %struct.AES_ctx*, %struct.AES_ctx** %4
%8 = load i32*, i32** %5
%9 = load i64, i64* %6
%10 = call i32 @AES_CTR_xcrypt_buffer(%struct.AES_ctx* %7, i32* %8, i64 %9)
ret void
}

LLVM IR (-O2):
%struct.AES_ctx = type { i32 }
define void @AES_encrypt_buf(%struct.AES_ctx* %0, i32* %1, i64 %2) {
%4 = tail call i32 @AES_CTR_xcrypt_buffer(%struct.AES_ctx* %0, i32* %1, i64 %2)
ret void
}
int test_imm_ACint16_reg(short val) {
  return ((val) & (-0xAC << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_ACint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0xffffff54,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_ACint16_reg(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, -172
%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_ACint16_reg(i16 signext %0) {
%2 = and i16 %0, -172
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int stringcmp(char *s1, char *s2, int a) {
  int i;
  for (i = 0; i < a; i++) {
    if (*(s1 + i) != *(s2 + i))
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<stringcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1161 <stringcmp+0x61>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x18(%rbp),%rcx
movslq -0x20(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     114e <stringcmp+0x4e>
movl   $0x0,-0x4(%rbp)
jmp    1168 <stringcmp+0x68>
jmp    1153 <stringcmp+0x53>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1116 <stringcmp+0x16>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<stringcmp>:
mov    $0x1,%eax
test   %edx,%edx
jle    1122 <stringcmp+0x22>
mov    %edx,%r8d
xor    %edx,%edx
xchg   %ax,%ax
movzbl (%rdi,%rdx,1),%ecx
cmp    (%rsi,%rdx,1),%cl
jne    1123 <stringcmp+0x23>
add    $0x1,%rdx
cmp    %rdx,%r8
jne    1110 <stringcmp+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @stringcmp(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %9
7: ; preds = %9
%8 = icmp eq i64 %16, %6
br i1 %8, label %17, label %9
9: ; preds = %5, %7
%10 = phi i64 [ 0, %5 ], [ %16, %7 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = getelementptr inbounds i8, i8* %1, i64 %10
%14 = load i8, i8* %13
%15 = icmp eq i8 %12, %14
%16 = add nuw nsw i64 %10, 1
br i1 %15, label %7, label %17
17: ; preds = %9, %7, %3
%18 = phi i32 [ 1, %3 ], [ 1, %7 ], [ 0, %9 ]
ret i32 %18
}
/* Variables and functions */
char *dirname(char *);
char *uniquestr(char *);
int /*<<< orphan*/ xfree(char *);
char *xstrdup(char const *);
const char *give_dirname(const char *c) {
  char *tmp = xstrdup(c);
  char *dirname_tmp = dirname(tmp);
  const char *result = uniquestr(dirname_tmp);
  xfree(tmp);
  return result;
}


x86 assembly (clang, -O0):
<give_dirname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <xstrdup@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <dirname@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <uniquestr@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <xfree@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<give_dirname>:
push   %r14
push   %rbx
push   %rax
call   1060 <xstrdup@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <dirname@plt>
mov    %rax,%rdi
call   1050 <uniquestr@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <xfree@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @give_dirname(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i8* @xstrdup(i8* %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = call i8* @dirname(i8* %8)
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = call i8* @uniquestr(i8* %10)
store i8* %11, i8** %5
%12 = load i8*, i8** %3
%13 = call i32 @xfree(i8* %12)
%14 = load i8*, i8** %5
ret i8* %14
}

LLVM IR (-O2):
define i8* @give_dirname(i8* %0) {
%2 = tail call i8* @xstrdup(i8* %0)
%3 = tail call i8* @dirname(i8* %2)
%4 = tail call i8* @uniquestr(i8* %3)
%5 = tail call i32 @xfree(i8* %2)
ret i8* %4
}
int GetParentIDX(int idx) { return idx / 2; }


x86 assembly (clang, -O0):
<GetParentIDX>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetParentIDX>:
mov    %edi,%eax
shr    $0x1f,%eax
add    %edi,%eax
sar    %eax
ret

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

LLVM IR (-O2):
define i32 @GetParentIDX(i32 %0) {
%2 = sdiv i32 %0, 2
ret i32 %2
}
/* Type definitions */
struct cache_extent {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct cache_extent *);
void free_cache_extent(struct cache_extent *pe) { free(pe); }


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

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

LLVM IR (-O0):
%struct.cache_extent = type { i32 }
define void @free_cache_extent(%struct.cache_extent* %0) {
%2 = alloca %struct.cache_extent*
store %struct.cache_extent* %0, %struct.cache_extent** %2
%3 = load %struct.cache_extent*, %struct.cache_extent** %2
%4 = call i32 @free(%struct.cache_extent* %3)
ret void
}

LLVM IR (-O2):
%struct.cache_extent = type { i32 }
define void @free_cache_extent(%struct.cache_extent* nocapture %0) {
%2 = tail call i32 @free(%struct.cache_extent* %0)
ret void
}
int test_imm_42int32_mem(int *val) {
  return ((*val) & (0x42 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_42int32_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
and    $0x42,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_42int32_mem>:
testb  $0x42,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_42int32_mem(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = and i32 %4, 66
%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_42int32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 66
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ AF_UNSPEC;
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ test_browsers(int /*<<< orphan*/);
int /*<<< orphan*/ test_matched_entries();
int /*<<< orphan*/ test_options_file();
int main() {
  printf("======================\n");
  test_matched_entries();
  test_options_file();
  test_browsers(AF_UNSPEC);
  test_browsers(AF_INET);
  printf("==========END=========\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <test_matched_entries@plt>
mov    $0x0,%al
call   1050 <test_options_file@plt>
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
call   1030 <test_browsers@plt>
mov    0x2e6a(%rip),%rax
mov    (%rax),%edi
call   1030 <test_browsers@plt>
lea    0xe8c(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1060 <test_matched_entries@plt>
xor    %eax,%eax
call   1050 <test_options_file@plt>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
call   1030 <test_browsers@plt>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
call   1030 <test_browsers@plt>
lea    0xe99(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"======================\0A\00"
@AF_UNSPEC = global i32 0
@AF_INET = global i32 0
@.str.1 = [24 x i8] c"==========END=========\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @test_matched_entries()
%4 = call i32 (...) @test_options_file()
%5 = load i32, i32* @AF_UNSPEC
%6 = call i32 @test_browsers(i32 %5)
%7 = load i32, i32* @AF_INET
%8 = call i32 @test_browsers(i32 %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@AF_UNSPEC = global i32 0
@AF_INET = global i32 0
@str = [23 x i8] c"======================\00"
@str.2 = [23 x i8] c"==========END=========\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @test_matched_entries()
%3 = tail call i32 (...) @test_options_file()
%4 = load i32, i32* @AF_UNSPEC
%5 = tail call i32 @test_browsers(i32 %4)
%6 = load i32, i32* @AF_INET
%7 = tail call i32 @test_browsers(i32 %6)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
void termCPU(void) {}


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

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

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

LLVM IR (-O2):
define void @termCPU() {
ret void
}
extern void socket_startup() {}


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

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

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

LLVM IR (-O2):
define void @socket_startup() {
ret void
}
/* Variables and functions */
int printf(char *, ...);
int main(int argc, char *argv[]) {
  int ret;
  ret = printf("%j123");
  printf("ret"
         ":%d\n",
         (ret));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"%j123\00"
@.str.1 = [8 x i8] c"ret:%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret i32 0
}
int main() { long x; }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i64
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isdigit(int);
void t_isdigit_0x46() {
  Assert_real((isdigit(70) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isdigit.c",
              355, ("isdigit should be 0 for F"));
}


x86 assembly (clang, -O0):
<t_isdigit_0x46>:
push   %rbp
mov    %rsp,%rbp
mov    $0x46,%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x163,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isdigit_0x46>:
push   %rax
mov    $0x46,%edi
call   1030 <isdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x163,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isdigit.c\00"
@.str.1 = [26 x i8] c"isdigit should be 0 for F\00"
define void @t_isdigit_0x46() {
%1 = call i64 @isdigit(i32 70)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 355, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isdigit.c\00"
@.str.1 = [26 x i8] c"isdigit should be 0 for F\00"
define void @t_isdigit_0x46() {
%1 = tail call i64 @isdigit(i32 70)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 355, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int batadv_nc_mesh_init(struct batadv_priv *bat_priv) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.batadv_priv = type opaque
define i32 @batadv_nc_mesh_init(%struct.batadv_priv* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ errx(int, char *, void *);
void *sthread_cb(void *arg) {
  if (arg != (void *)0x666)
    errx(1, "arg %p", arg);
  return (void *)0x69;
}


x86 assembly (clang, -O0):
<sthread_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x666,%eax
cmp    %rax,-0x8(%rbp)
je     1140 <sthread_cb+0x30>
mov    -0x8(%rbp),%rdx
mov    $0x1,%edi
lea    0xec5(%rip),%rsi
call   1030 <errx@plt>
mov    $0x69,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sthread_cb>:
cmp    $0x666,%rdi
je     1132 <sthread_cb+0x22>
push   %rax
mov    %rdi,%rdx
lea    0xedc(%rip),%rsi
mov    $0x1,%edi
call   1030 <errx@plt>
add    $0x8,%rsp
mov    $0x69,%eax
ret

LLVM IR (-O0):
@.str = [7 x i8] c"arg %p\00"
define i8* @sthread_cb(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, inttoptr (i64 1638 to i8*)
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @errx(i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %8
8: ; preds = %5, %1
ret i8* inttoptr (i64 105 to i8*)
}

LLVM IR (-O2):
@.str = [7 x i8] c"arg %p\00"
define i8* @sthread_cb(i8* %0) {
%2 = icmp eq i8* %0, inttoptr (i64 1638 to i8*)
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @errx(i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %5
5: ; preds = %3, %1
ret i8* inttoptr (i64 105 to i8*)
}
/* Variables and functions */
int /*<<< orphan*/ erase();
void clrscreen(void) { erase(); }


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

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

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

LLVM IR (-O2):
define void @clrscreen() {
%1 = tail call i32 (...) @erase()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int open(char const *, int /*<<< orphan*/);
int readstat_open(const char *filename) { return open(filename, O_RDONLY); }


x86 assembly (clang, -O0):
<readstat_open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ec1(%rip),%rax
mov    (%rax),%esi
call   1030 <open@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readstat_open>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
jmp    1030 <open@plt>

LLVM IR (-O0):
@O_RDONLY = global i32 0
define i32 @readstat_open(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @O_RDONLY
%5 = call i32 @open(i8* %3, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
define i32 @readstat_open(i8* nocapture %0) {
%2 = load i32, i32* @O_RDONLY
%3 = tail call i32 @open(i8* %0, i32 %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(
      stderr,
      "Usage: lavpipe [options] <pipe list>\n"
      "Options: -o num   Frame offset - skip num frames in the beginning\n"
      "                  if num is negative, all but the last num frames are "
      "skipped\n"
      "         -n num   Only num frames are processed (0 means all frames)\n"
      "         -v num  Verbosity of output [0..2]\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [295 x i8] c"Usage: lavpipe [options] <pipe list>\0AOptions: -o num Frame offset - skip num frames in the beginning\0A if num is negative, all but the last num frames are skipped\0A -n num Only num frames are processed (0 means all frames)\0A -v num Verbosity of output [0..2]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([295 x i8], [295 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [295 x i8] c"Usage: lavpipe [options] <pipe list>\0AOptions: -o num Frame offset - skip num frames in the beginning\0A if num is negative, all but the last num frames are skipped\0A -n num Only num frames are processed (0 means all frames)\0A -v num Verbosity of output [0..2]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([295 x i8], [295 x i8]* @.str, i64 0, i64 0))
ret void
}
int EInRange(int a, int low, int high) { return ((a >= low) && (a <= high)); }


x86 assembly (clang, -O0):
<EInRange>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%ecx
xor    %eax,%eax
cmp    -0x8(%rbp),%ecx
mov    %al,-0xd(%rbp)
jl     112a <EInRange+0x2a>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
setle  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<EInRange>:
cmp    %esi,%edi
setge  %al
cmp    %edx,%edi
setle  %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @EInRange(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = icmp sge i32 %7, %8
br i1 %9, label %10, label %14
10: ; preds = %3
%11 = load i32, i32* %4
%12 = load i32, i32* %6
%13 = icmp sle i32 %11, %12
br label %14
14: ; preds = %10, %3
%15 = phi i1 [ false, %3 ], [ %13, %10 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @EInRange(i32 %0, i32 %1, i32 %2) {
%4 = icmp sge i32 %0, %1
%5 = icmp sle i32 %0, %2
%6 = and i1 %4, %5
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
scalar_t__ eval(int /*<<< orphan*/);
scalar_t__ f();
int /*<<< orphan*/ op_if(int, int /*<<< orphan*/, scalar_t__);
int /*<<< orphan*/ t();
int is_f(int cell) { return eval(op_if(cell, t(), f())) == f(); }


x86 assembly (clang, -O0):
<is_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <t@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1040 <f@plt>
mov    -0x18(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    %rax,%rdx
call   1050 <op_if@plt>
mov    %eax,%edi
call   1060 <eval@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <f@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_f>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <t@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <f@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %rax,%rdx
call   1050 <op_if@plt>
mov    %eax,%edi
call   1060 <eval@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <f@plt>
xor    %ecx,%ecx
cmp    %rax,%rbx
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @is_f(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 (...) @t()
%5 = call i64 (...) @f()
%6 = call i32 @op_if(i32 %3, i32 %4, i64 %5)
%7 = call i64 @eval(i32 %6)
%8 = call i64 (...) @f()
%9 = icmp eq i64 %7, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @is_f(i32 %0) {
%2 = tail call i32 (...) @t()
%3 = tail call i64 (...) @f()
%4 = tail call i32 @op_if(i32 %0, i32 %2, i64 %3)
%5 = tail call i64 @eval(i32 %4)
%6 = tail call i64 (...) @f()
%7 = icmp eq i64 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ GPIOPinTypeGPIOOutput(int, int);
int /*<<< orphan*/ SysCtlPeripheralEnable(int);
void LedInit() {
  SysCtlPeripheralEnable(0xf0000805);
  GPIOPinTypeGPIOOutput(0x40025000, 0x00000002 | 0x00000004 | 0x00000008);
}


x86 assembly (clang, -O0):
<LedInit>:
push   %rbp
mov    %rsp,%rbp
mov    $0xf0000805,%edi
call   1030 <SysCtlPeripheralEnable@plt>
mov    $0x40025000,%edi
mov    $0xe,%esi
call   1040 <GPIOPinTypeGPIOOutput@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<LedInit>:
push   %rax
mov    $0xf0000805,%edi
call   1030 <SysCtlPeripheralEnable@plt>
mov    $0x40025000,%edi
mov    $0xe,%esi
pop    %rax
jmp    1040 <GPIOPinTypeGPIOOutput@plt>

LLVM IR (-O0):
define void @LedInit() {
%1 = call i32 @SysCtlPeripheralEnable(i32 -268433403)
%2 = call i32 @GPIOPinTypeGPIOOutput(i32 1073893376, i32 14)
ret void
}

LLVM IR (-O2):
define void @LedInit() {
%1 = tail call i32 @SysCtlPeripheralEnable(i32 -268433403)
%2 = tail call i32 @GPIOPinTypeGPIOOutput(i32 1073893376, i32 14)
ret void
}
int execute_swapon() { return 0; }


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

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

LLVM IR (-O0):
define i32 @execute_swapon() {
ret i32 0
}

LLVM IR (-O2):
define i32 @execute_swapon() {
ret i32 0
}
void HardExp_Init(void) {}


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

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

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

LLVM IR (-O2):
define void @HardExp_Init() {
ret void
}
void gtk_notebook_set_tab_pos() {}


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

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

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

LLVM IR (-O2):
define void @gtk_notebook_set_tab_pos() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ function();
int /*<<< orphan*/ puts(char *);
int main() {
  puts("yay main!");
  function();
  puts("back into main.");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [10 x i8] c"yay main!\00"
@.str.1 = [16 x i8] c"back into main.\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @puts(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @function()
%4 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"yay main!\00"
@.str.1 = [16 x i8] c"back into main.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @function()
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct Edge {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ edge_invRot(struct Edge *);
int /*<<< orphan*/ edge_oNext(int /*<<< orphan*/);
struct Edge *edge_rot(int /*<<< orphan*/);
struct Edge *edge_lNext(struct Edge *edge) {
  return edge_rot(edge_oNext(edge_invRot(edge)));
}


x86 assembly (clang, -O0):
<edge_lNext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <edge_invRot@plt>
mov    %eax,%edi
call   1050 <edge_oNext@plt>
mov    %eax,%edi
call   1040 <edge_rot@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<edge_lNext>:
push   %rax
call   1030 <edge_invRot@plt>
mov    %eax,%edi
call   1050 <edge_oNext@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <edge_rot@plt>

LLVM IR (-O0):
%struct.Edge = type { i32 }
define %struct.Edge* @edge_lNext(%struct.Edge* %0) {
%2 = alloca %struct.Edge*
store %struct.Edge* %0, %struct.Edge** %2
%3 = load %struct.Edge*, %struct.Edge** %2
%4 = call i32 @edge_invRot(%struct.Edge* %3)
%5 = call i32 @edge_oNext(i32 %4)
%6 = call %struct.Edge* @edge_rot(i32 %5)
ret %struct.Edge* %6
}

LLVM IR (-O2):
%struct.Edge = type { i32 }
define %struct.Edge* @edge_lNext(%struct.Edge* %0) {
%2 = tail call i32 @edge_invRot(%struct.Edge* %0)
%3 = tail call i32 @edge_oNext(i32 %2)
%4 = tail call %struct.Edge* @edge_rot(i32 %3)
ret %struct.Edge* %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
int main(int argc, char const *argv[]) {
  char x[4] = {0, 127, 0, 0};
  printf("%u\n", *((unsigned int *)x));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xedb(%rip),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%u\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 32512)
ret i32 0
}
long SETUID(uid)
long *uid;
{ return ((long)setuid(*uid)); }


x86 assembly (clang, -O0):
<SETUID>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    $0x0,%al
call   1030 <setuid@plt>
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SETUID>:
push   %rax
mov    (%rdi),%rdi
xor    %eax,%eax
call   1030 <setuid@plt>
cltq
pop    %rcx
ret

LLVM IR (-O0):
define i64 @SETUID(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = call i32 (i64, ...) bitcast (i32 (...)* @setuid to i32 (i64, ...)*)(i64 %4)
%6 = sext i32 %5 to i64
ret i64 %6
}

LLVM IR (-O2):
define i64 @SETUID(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = tail call i32 (i64, ...) bitcast (i32 (...)* @setuid to i32 (i64, ...)*)(i64 %2)
%4 = sext i32 %3 to i64
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
void wserror_fun(char *msg) {
  printf("Failed with error: %s\n", msg);
  exit(-1);
}


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

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

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

LLVM IR (-O2):
@.str = [23 x i8] c"Failed with error: %s\0A\00"
define void @wserror_fun(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 -1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ load_dll(char *);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char **argv) {
  printf("try to load DLL %s\n", argv[1]);
  load_dll(argv[1]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <load_dll@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
mov    0x8(%rsi),%rsi
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
mov    0x8(%rbx),%rdi
call   1040 <load_dll@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [20 x i8] c"try to load DLL %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i8*, i8** %3
%7 = tail call i32 @load_dll(i8* %6)
ret i32 0
}
void SMP_W_BARRIER_R(void) {
  volatile long temp;
  __asm__ __volatile__("lock xorl $1, %0" : "+m"(temp) : : "cc", "memory");
}


x86 assembly (clang, -O0):
<SMP_W_BARRIER_R>:
push   %rbp
mov    %rsp,%rbp
lock xorl $0x1,-0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SMP_W_BARRIER_R>:
lock xorl $0x1,-0x8(%rsp)
ret

LLVM IR (-O0):
define void @SMP_W_BARRIER_R() {
%1 = alloca i64
ret void
}

LLVM IR (-O2):
define void @SMP_W_BARRIER_R() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
ret void
}
void SPI_LEDS_SaveConfig(void) {}


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

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

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

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