xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int INT64_MIN;
int div_trunc(int, int, int, int *);
int64_t div_floor(int64_t nhi, int64_t nlo, int64_t m, int64_t *q) {
  int64_t r = div_trunc(nhi, nlo, m, q);
  int64_t diff = (nhi ^ m) >> 63;
  *q += diff;
  r += (diff & -(r != INT64_MIN) & m);
  return r;
}


x86 assembly (clang, -O0):
<div_floor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
call   1030 <div_trunc@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%eax
xor    -0xc(%rbp),%eax
mov    $0x3f,%ecx
sar    %cl,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%ecx
mov    -0x18(%rbp),%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x20(%rbp),%eax
mov    -0x1c(%rbp),%ecx
mov    0x2e86(%rip),%rdx
cmp    (%rdx),%ecx
setne  %cl
and    $0x1,%cl
movzbl %cl,%edx
xor    %ecx,%ecx
sub    %edx,%ecx
and    %ecx,%eax
and    -0xc(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<div_floor>:
jmp    1030 <div_trunc@plt>

LLVM IR (-O0):
@INT64_MIN = global i32 0
define i32 @div_floor(i32 %0, i32 %1, i32 %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32* %3, i32** %8
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = load i32*, i32** %8
%15 = call i32 @div_trunc(i32 %11, i32 %12, i32 %13, i32* %14)
store i32 %15, i32* %9
%16 = load i32, i32* %5
%17 = load i32, i32* %7
%18 = xor i32 %16, %17
%19 = ashr i32 %18, 63
store i32 %19, i32* %10
%20 = load i32, i32* %10
%21 = load i32*, i32** %8
%22 = load i32, i32* %21
%23 = add nsw i32 %22, %20
store i32 %23, i32* %21
%24 = load i32, i32* %10
%25 = load i32, i32* %9
%26 = load i32, i32* @INT64_MIN
%27 = icmp ne i32 %25, %26
%28 = zext i1 %27 to i32
%29 = sub nsw i32 0, %28
%30 = and i32 %24, %29
%31 = load i32, i32* %7
%32 = and i32 %30, %31
%33 = load i32, i32* %9
%34 = add nsw i32 %33, %32
store i32 %34, i32* %9
%35 = load i32, i32* %9
ret i32 %35
}

LLVM IR (-O2):
@INT64_MIN = global i32 0
define i32 @div_floor(i32 %0, i32 %1, i32 %2, i32* %3) {
%5 = tail call i32 @div_trunc(i32 %0, i32 %1, i32 %2, i32* %3)
ret i32 poison
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ polyglot_array_typeid(int /*<<< orphan*/,
                                         int /*<<< orphan*/);
void *polyglot_as_typed(void *, int /*<<< orphan*/);
int /*<<< orphan*/ polyglot_i64_typeid();
__attribute__((always_)) int64_t *polyglot_as_i64_array(void *p) {
  void *ret =
      polyglot_as_typed(p, polyglot_array_typeid(polyglot_i64_typeid(), 0));
  return (int64_t *)ret;
}


x86 assembly (clang, -O0):
<polyglot_as_i64_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1040 <polyglot_i64_typeid@plt>
mov    %eax,%edi
xor    %esi,%esi
call   1050 <polyglot_array_typeid@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1030 <polyglot_as_typed@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<polyglot_as_i64_array>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <polyglot_i64_typeid@plt>
mov    %eax,%edi
xor    %esi,%esi
call   1050 <polyglot_array_typeid@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1030 <polyglot_as_typed@plt>

LLVM IR (-O0):
define i32* @polyglot_as_i64_array(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 (...) @polyglot_i64_typeid()
%6 = call i32 @polyglot_array_typeid(i32 %5, i32 0)
%7 = call i8* @polyglot_as_typed(i8* %4, i32 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = bitcast i8* %8 to i32*
ret i32* %9
}

LLVM IR (-O2):
define i32* @polyglot_as_i64_array(i8* %0) {
%2 = tail call i32 (...) @polyglot_i64_typeid()
%3 = tail call i32 @polyglot_array_typeid(i32 %2, i32 0)
%4 = tail call i8* @polyglot_as_typed(i8* %0, i32 %3)
%5 = bitcast i8* %4 to i32*
ret i32* %5
}
int test_imm_39uint16_mem(unsigned short *val) {
  return ((*val) & (-0x39 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_39uint16_mem>:
movzwl (%rdi),%eax
test   $0xffc7,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_39uint16_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, -57
%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_39uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -57
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "usage: ahost {host|addr} ...\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [30 x i8] c"usage: ahost {host|addr} ...\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [30 x i8] c"usage: ahost {host|addr} ...\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ foo03();
void bar03() { foo03(); }


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

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

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

LLVM IR (-O2):
define void @bar03() {
%1 = tail call i32 (...) @foo03()
ret void
}
int Operand_mr0_decode(unsigned int *valp __attribute__((__unused__))) {
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @Operand_mr0_decode(i32* nocapture readnone %0) {
ret i32 0
}
/* Type definitions */
typedef int uint32_t;
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
uint32_t USBFrameNumberGet(uint32_t ui32Base) {
  ASSERT(ui32Base == 0x40050000);
  return ((*((volatile uint16_t *)(ui32Base + 0x0000000C))));
}


x86 assembly (clang, -O0):
<USBFrameNumberGet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x40050000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x4(%rbp),%eax
add    $0xc,%eax
cltq
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBFrameNumberGet>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
cmp    $0x40050000,%ebx
sete   %dil
call   1030 <ASSERT@plt>
movslq %ebx,%rax
mov    0xc(%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @USBFrameNumberGet(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 1074069504
%5 = zext i1 %4 to i32
%6 = call i32 @ASSERT(i32 %5)
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 12
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i32*
%11 = load volatile i32, i32* %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @USBFrameNumberGet(i32 %0) {
%2 = icmp eq i32 %0, 1074069504
%3 = zext i1 %2 to i32
%4 = tail call i32 @ASSERT(i32 %3)
%5 = add nsw i32 %0, 12
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
%8 = load volatile i32, i32* %7
ret i32 %8
}
/* Variables and functions */
int and_l(int *, int *);
int intr_wrap_509(int p1, int p2) { return and_l(&p1, &p2); }


x86 assembly (clang, -O0):
<intr_wrap_509>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <and_l@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @intr_wrap_509(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @and_l(i32* %3, i32* %4)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ _Error(long, char *);
void Error_ConstantSyntaxArgumentMustBindToInParameter(long p_position) {
  _Error(p_position, "Constant syntax arguments must bind to in parameter");
}


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

x86 assembly (clang, -O2):
<Error_ConstantSyntaxArgumentMustBindToInParameter>:
lea    0xee9(%rip),%rsi
jmp    1030 <_Error@plt>

LLVM IR (-O0):
@.str = [52 x i8] c"Constant syntax arguments must bind to in parameter\00"
define void @Error_ConstantSyntaxArgumentMustBindToInParameter(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @_Error(i64 %3, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [52 x i8] c"Constant syntax arguments must bind to in parameter\00"
define void @Error_ConstantSyntaxArgumentMustBindToInParameter(i64 %0) {
%2 = tail call i32 @_Error(i64 %0, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ putnonblank(char);
void skipline() {
  int c;
  while ((c = getchar()) != EOF)
    if (c == '\n') {
      putnonblank('\n');
      return;
    }
}


x86 assembly (clang, -O0):
<skipline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x4(%rbp)
mov    0x2eaf(%rip),%rcx
cmp    (%rcx),%eax
je     115f <skipline+0x3f>
cmpl   $0xa,-0x4(%rbp)
jne    115a <skipline+0x3a>
mov    $0xa,%edi
call   1030 <putnonblank@plt>
jmp    115f <skipline+0x3f>
jmp    1128 <skipline+0x8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skipline>:
push   %rbx
mov    0x2ec0(%rip),%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%rbx),%eax
je     114b <skipline+0x2b>
cmp    $0xa,%eax
jne    1130 <skipline+0x10>
mov    $0xa,%edi
pop    %rbx
jmp    1030 <putnonblank@plt>
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i32 0
define void @skipline() {
%1 = alloca i32
br label %2
2: ; preds = %11, %0
%3 = call i32 (...) @getchar()
store i32 %3, i32* %1
%4 = load i32, i32* @EOF
%5 = icmp ne i32 %3, %4
br i1 %5, label %6, label %12
6: ; preds = %2
%7 = load i32, i32* %1
%8 = icmp eq i32 %7, 10
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 @putnonblank(i8 signext 10)
br label %12
11: ; preds = %6
br label %2
12: ; preds = %9, %2
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
define void @skipline() {
br label %1
1: ; preds = %5, %0
%2 = tail call i32 (...) @getchar()
%3 = load i32, i32* @EOF
%4 = icmp eq i32 %2, %3
br i1 %4, label %9, label %5
5: ; preds = %1
%6 = icmp eq i32 %2, 10
br i1 %6, label %7, label %1
7: ; preds = %5
%8 = tail call i32 @putnonblank(i8 signext 10)
br label %9
9: ; preds = %1, %7
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void bar(void) { printf("library bar\n"); }


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

x86 assembly (clang, -O2):
<bar>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"library bar\0A\00"
define void @bar() {
%1 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [12 x i8] c"library bar\00"
define void @bar() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
void *ptr_from_address(uintptr_t addr) { return (void *)addr; }


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

x86 assembly (clang, -O2):
<ptr_from_address>:
mov    %rdi,%rax
ret

LLVM IR (-O0):
define i8* @ptr_from_address(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}

LLVM IR (-O2):
define i8* @ptr_from_address(i64 %0) {
%2 = inttoptr i64 %0 to i8*
ret i8* %2
}
int krait_pmic_pre_multiphase_enable(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @krait_pmic_pre_multiphase_enable() {
ret i32 0
}
/* Type definitions */
typedef int const uint16_t;

/* Variables and functions */
int _chk_bit(uint16_t *x, const int b) { return ((*x >> b) & 1); }


x86 assembly (clang, -O0):
<_chk_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0xc(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_chk_bit>:
mov    %esi,%ecx
mov    (%rdi),%eax
shr    %cl,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @_chk_bit(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %5
%7 = load i32, i32* %4
%8 = ashr i32 %6, %7
%9 = and i32 %8, 1
ret i32 %9
}

LLVM IR (-O2):
define i32 @_chk_bit(i32* nocapture %0, i32 %1) {
%3 = load i32, i32* %0
%4 = lshr i32 %3, %1
%5 = and i32 %4, 1
ret i32 %5
}
/* Variables and functions */
scalar_t__ bar();
long *foo2(void) { return (long *)bar(); }


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

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

LLVM IR (-O0):
define i64* @foo2() {
%1 = call i64 (...) @bar()
%2 = inttoptr i64 %1 to i64*
ret i64* %2
}

LLVM IR (-O2):
define i64* @foo2() {
%1 = tail call i64 (...) @bar()
%2 = inttoptr i64 %1 to i64*
ret i64* %2
}
/* Variables and functions */
double **free_arrayN(void *, int);
double **free_double(double **array, int first) {
  return free_arrayN((void *)array, 2);
}


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

x86 assembly (clang, -O2):
<free_double>:
mov    $0x2,%esi
jmp    1030 <free_arrayN@plt>

LLVM IR (-O0):
define double** @free_double(double** %0, i32 %1) {
%3 = alloca double**
%4 = alloca i32
store double** %0, double*** %3
store i32 %1, i32* %4
%5 = load double**, double*** %3
%6 = bitcast double** %5 to i8*
%7 = call double** @free_arrayN(i8* %6, i32 2)
ret double** %7
}

LLVM IR (-O2):
define double** @free_double(double** %0, i32 %1) {
%3 = bitcast double** %0 to i8*
%4 = tail call double** @free_arrayN(i8* %3, i32 2)
ret double** %4
}
void pthread_rwlock_timedrdlock() {}


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

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

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

LLVM IR (-O2):
define void @pthread_rwlock_timedrdlock() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
double sancus_frll(long long v, long long a, long long b) {
  assert((v >= a) && (v <= b));
  return (double)v;
}


x86 assembly (clang, -O0):
<sancus_frll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
cmp    -0x10(%rbp),%rcx
mov    %al,-0x19(%rbp)
jl     1145 <sancus_frll+0x35>
mov    -0x8(%rbp),%rax
cmp    -0x18(%rbp),%rax
setle  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cvtsi2sdq -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sancus_frll>:
push   %rbx
mov    %rdi,%rbx
cmp    %rsi,%rdi
setge  %al
cmp    %rdx,%rdi
setle  %cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
cvtsi2sd %rbx,%xmm0
pop    %rbx
ret

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

LLVM IR (-O2):
define double @sancus_frll(i64 %0, i64 %1, i64 %2) {
%4 = icmp sge i64 %0, %1
%5 = icmp sle i64 %0, %2
%6 = and i1 %4, %5
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = sitofp i64 %0 to double
ret double %9
}
/* Variables and functions */
int fdevent_fcntl_set_nb(int);
int /*<<< orphan*/ fdevent_setfd_cloexec(int);
int fdevent_fcntl_set_nb_cloexec(int fd) {
  fdevent_setfd_cloexec(fd);
  return fdevent_fcntl_set_nb(fd);
}


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

x86 assembly (clang, -O2):
<fdevent_fcntl_set_nb_cloexec>:
push   %rbx
mov    %edi,%ebx
call   1030 <fdevent_setfd_cloexec@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <fdevent_fcntl_set_nb@plt>

LLVM IR (-O0):
define i32 @fdevent_fcntl_set_nb_cloexec(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @fdevent_setfd_cloexec(i32 %3)
%5 = load i32, i32* %2
%6 = call i32 @fdevent_fcntl_set_nb(i32 %5)
ret i32 %6
}

LLVM IR (-O2):
define i32 @fdevent_fcntl_set_nb_cloexec(i32 %0) {
%2 = tail call i32 @fdevent_setfd_cloexec(i32 %0)
%3 = tail call i32 @fdevent_fcntl_set_nb(i32 %0)
ret i32 %3
}
int and2(int a) { return (a & 3) != 0; }


x86 assembly (clang, -O0):
<and2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x3,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<and2>:
xor    %eax,%eax
test   $0x3,%dil
setne  %al
ret

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

LLVM IR (-O2):
define i32 @and2(i32 %0) {
%2 = and i32 %0, 3
%3 = icmp ne i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
int poe_isendbrace(char c) { return c == ')' || c == ']' || c == '}'; }


x86 assembly (clang, -O0):
<poe_isendbrace>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x29,%ecx
mov    %al,-0x2(%rbp)
je     113b <poe_isendbrace+0x3b>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x5d,%ecx
mov    %al,-0x2(%rbp)
je     113b <poe_isendbrace+0x3b>
movsbl -0x1(%rbp),%eax
cmp    $0x7d,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<poe_isendbrace>:
mov    $0x1,%eax
cmp    $0x29,%dil
je     1111 <poe_isendbrace+0x11>
cmp    $0x5d,%dil
jne    1112 <poe_isendbrace+0x12>
ret
xor    %eax,%eax
cmp    $0x7d,%dil
sete   %al
ret

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

LLVM IR (-O2):
define i32 @poe_isendbrace(i8 signext %0) {
switch i8 %0, label %2 [
i8 93, label %5
i8 41, label %5
]
2: ; preds = %1
%3 = icmp eq i8 %0, 125
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %1, %1, %2
%6 = phi i32 [ 1, %1 ], [ %4, %2 ], [ 1, %1 ]
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int MPI_Send(const void *buf, int count, int datatype, int dest, int tag,
             int comm) {
  printf("MPI Stub WARNING: Should not send message to self\n");
  return 0;
}


x86 assembly (clang, -O0):
<MPI_Send>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [51 x i8] c"MPI Stub WARNING: Should not send message to self\0A\00"
define i32 @MPI_Send(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%13 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [50 x i8] c"MPI Stub WARNING: Should not send message to self\00"
define i32 @MPI_Send(i8* nocapture readnone %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int fn5(void *frame) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @fn5(i8* nocapture readnone %0) {
ret i32 0
}
/* Type definitions */
typedef int uint32_t;
typedef int uint16_t;
typedef scalar_t__ msb;
typedef int lsb;

/* Variables and functions */
int us_bits_get_doublet(void const *, int);
uint16_t us_bits_get_doublet_bitfield(const void *base, uint16_t offset,
                                      uint16_t msb, uint16_t lsb) {
  uint32_t v = us_bits_get_doublet(base, offset);
  uint32_t r =
      ((((v)) & (((0xffff) >> (16 - ((lsb) - (msb) + 1))) << (15 - ((lsb))))) >>
       (15 - ((lsb))));
  return r;
}


x86 assembly (clang, -O0):
<us_bits_get_doublet_bitfield>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <us_bits_get_doublet@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%edx
sub    -0x10(%rbp),%edx
add    $0x1,%edx
mov    $0x10,%ecx
sub    %edx,%ecx
mov    $0xffff,%edx
sar    %cl,%edx
mov    $0xf,%ecx
sub    -0x14(%rbp),%ecx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
mov    $0xf,%ecx
sub    -0x14(%rbp),%ecx
sar    %cl,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<us_bits_get_doublet_bitfield>:
push   %rbp
push   %rbx
push   %rax
mov    %ecx,%ebx
mov    %edx,%ebp
call   1030 <us_bits_get_doublet@plt>
sub    %ebx,%ebp
add    $0xf,%bpl
mov    $0xffff,%edx
mov    %ebp,%ecx
shr    %cl,%edx
mov    $0xf,%cl
sub    %bl,%cl
shl    %cl,%edx
and    %edx,%eax
sar    %cl,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @us_bits_get_doublet_bitfield(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i8*, i8** %5
%12 = load i32, i32* %6
%13 = call i32 @us_bits_get_doublet(i8* %11, i32 %12)
store i32 %13, i32* %9
%14 = load i32, i32* %9
%15 = load i32, i32* %8
%16 = load i32, i32* %7
%17 = sub nsw i32 %15, %16
%18 = add nsw i32 %17, 1
%19 = sub nsw i32 16, %18
%20 = ashr i32 65535, %19
%21 = load i32, i32* %8
%22 = sub nsw i32 15, %21
%23 = shl i32 %20, %22
%24 = and i32 %14, %23
%25 = load i32, i32* %8
%26 = sub nsw i32 15, %25
%27 = ashr i32 %24, %26
store i32 %27, i32* %10
%28 = load i32, i32* %10
ret i32 %28
}

LLVM IR (-O2):
define i32 @us_bits_get_doublet_bitfield(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @us_bits_get_doublet(i8* %0, i32 %1)
%6 = add i32 %2, 15
%7 = sub i32 %6, %3
%8 = lshr i32 65535, %7
%9 = sub nsw i32 15, %3
%10 = shl i32 %8, %9
%11 = and i32 %5, %10
%12 = ashr i32 %11, %9
ret i32 %12
}
__attribute__((no, noclone)) unsigned __int128 t162_3add(signed __int128 y) {
  unsigned __int128 r;
  if (__builtin_add_overflow(
          (signed __int128)((
              -((signed __int128)(((unsigned __int128)1 << (16 * 8 - 1)) - 1)) -
              1)),
          y, &r))
    bar();
  return r;
}


x86 assembly (clang, -O0):
<t162_3add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    %rcx,%r9
sar    $0x3f,%r9
movabs $0x8000000000000000,%rax
add    %rax,%rcx
mov    %r9,%r8
adc    $0xffffffffffffffff,%r8
adc    $0xffffffffffffffff,%r9
mov    %r8d,%eax
and    $0x1,%eax
mov    %eax,%esi
mov    %rsi,%rax
neg    %rax
mov    %rax,%rdi
xor    %r9,%rdi
xor    %r8,%rax
or     %rdi,%rax
or     %rsi,%rax
setne  %al
mov    %rdx,-0x40(%rbp)
mov    %rcx,-0x38(%rbp)
test   $0x1,%al
jne    118c <t162_3add+0x7c>
jmp    1193 <t162_3add+0x83>
mov    $0x0,%al
call   1030 <bar@plt>
mov    -0x40(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t162_3add>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
movabs $0x8000000000000000,%rbx
add    %rsi,%rbx
xor    %eax,%eax
call   1030 <bar@plt>
mov    %r14,%rax
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define { i64, i64 } @t162_3add(i64 %0, i64 %1) {
%3 = alloca i128
%4 = alloca i128
%5 = alloca i128
%6 = alloca i128
%7 = bitcast i128* %4 to { i64, i64 }*
%8 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %7, i32 0, i32 0
store i64 %0, i64* %8
%9 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %7, i32 0, i32 1
store i64 %1, i64* %9
%10 = load i128, i128* %4
store i128 %10, i128* %5
%11 = load i128, i128* %5
%12 = sext i128 %11 to i129
%13 = call { i129, i1 } @llvm.sadd.with.overflow.i129(i129 -170141183460469231731687303715884105728, i129 %12)
%14 = extractvalue { i129, i1 } %13, 1
%15 = extractvalue { i129, i1 } %13, 0
%16 = trunc i129 %15 to i128
%17 = zext i128 %16 to i129
%18 = icmp ne i129 %15, %17
%19 = or i1 %14, %18
store i128 %16, i128* %6
br i1 %19, label %20, label %22
20: ; preds = %2
%21 = call i32 (...) @bar()
br label %22
22: ; preds = %20, %2
%23 = load i128, i128* %6
store i128 %23, i128* %3
%24 = bitcast i128* %3 to { i64, i64 }*
%25 = load { i64, i64 }, { i64, i64 }* %24
ret { i64, i64 } %25
}

LLVM IR (-O2):
define { i64, i64 } @t162_3add(i64 %0, i64 %1) {
%3 = zext i64 %1 to i128
%4 = shl nuw i128 %3, 64
%5 = zext i64 %0 to i128
%6 = or i128 %4, %5
%7 = zext i128 %6 to i129
%8 = add nsw i129 %7, -170141183460469231731687303715884105728
%9 = tail call i32 (...) @bar()
%10 = trunc i129 %8 to i64
%11 = lshr i129 %8, 64
%12 = trunc i129 %11 to i64
%13 = insertvalue { i64, i64 } poison, i64 %10, 0
%14 = insertvalue { i64, i64 } %13, i64 %12, 1
ret { i64, i64 } %14
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  assert(3 > 2);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ f(int, int);
int main(void) { f(5, 6); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x5,%edi
mov    $0x6,%esi
call   1030 <f@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @f(i32 5, i32 6)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 5, i32 6)
ret i32 0
}
unsigned long insert_li(insn, value, errmsg)
unsigned long insn;
long value;
const char **errmsg;
{ return insn | (value & 0x3fffffc); }


x86 assembly (clang, -O0):
<insert_li>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
and    $0x3fffffc,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<insert_li>:
mov    %rsi,%rax
and    $0x3fffffc,%eax
or     %rdi,%rax
ret

LLVM IR (-O0):
define i64 @insert_li(i64 %0, i64 %1, i8** %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8**
store i64 %0, i64* %4
store i64 %1, i64* %5
store i8** %2, i8*** %6
%7 = load i64, i64* %4
%8 = load i64, i64* %5
%9 = and i64 %8, 67108860
%10 = or i64 %7, %9
ret i64 %10
}

LLVM IR (-O2):
define i64 @insert_li(i64 %0, i64 %1, i8** nocapture readnone %2) {
%4 = and i64 %1, 67108860
%5 = or i64 %4, %0
ret i64 %5
}
/* Variables and functions */
scalar_t__ malloc(size_t);
int /*<<< orphan*/ strncpy(char *, char const *, size_t);
char *strndup(const char *str, size_t n) {
  char *ret = (char *)malloc(n);
  strncpy(ret, str, n);
  return ret;
}


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

x86 assembly (clang, -O2):
<strndup>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <strncpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @strndup(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 i64, i64* %4
%7 = call i64 @malloc(i64 %6)
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = load i8*, i8** %3
%11 = load i64, i64* %4
%12 = call i32 @strncpy(i8* %9, i8* %10, i64 %11)
%13 = load i8*, i8** %5
ret i8* %13
}

LLVM IR (-O2):
define i8* @strndup(i8* %0, i64 %1) {
%3 = tail call i64 @malloc(i64 %1)
%4 = inttoptr i64 %3 to i8*
%5 = tail call i32 @strncpy(i8* %4, i8* %0, i64 %1)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ _I8080_CALL();
void do0xCD() { _I8080_CALL(); }


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

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

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

LLVM IR (-O2):
define void @do0xCD() {
%1 = tail call i32 (...) @_I8080_CALL()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ kill(int /*<<< orphan*/, int);
int raise(int sig) { kill(getpid(), sig); }


x86 assembly (clang, -O0):
<raise>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%edi
mov    -0x8(%rbp),%esi
call   1040 <kill@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<raise>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1040 <kill@plt>

LLVM IR (-O0):
define i32 @raise(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i32 (...) @getpid()
%5 = load i32, i32* %3
%6 = call i32 @kill(i32 %4, i32 %5)
%7 = load i32, i32* %2
ret i32 %7
}

LLVM IR (-O2):
define i32 @raise(i32 %0) {
%2 = tail call i32 (...) @getpid()
%3 = tail call i32 @kill(i32 %2, i32 %0)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  scanf("%d", &n);
  printf("%d\n", n);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret i32 0
}
void board_gpio_deinit(const struct mxt_platform_data *pdata) {}


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

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

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

LLVM IR (-O2):
%struct.mxt_platform_data = type opaque
define void @board_gpio_deinit(%struct.mxt_platform_data* nocapture %0) {
ret void
}
int is_space(char c) { return c == ' '; }


x86 assembly (clang, -O0):
<is_space>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x20,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_space>:
xor    %eax,%eax
cmp    $0x20,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @is_space(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 32
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @is_space(i8 signext %0) {
%2 = icmp eq i8 %0, 32
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, char *);
void get_card(char *card_name) {
  puts("Enter the card_name: ");
  scanf("%2s", card_name);
}


x86 assembly (clang, -O0):
<get_card>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <puts@plt>
mov    -0x8(%rbp),%rsi
lea    0xed3(%rip),%rdi
call   1040 <scanf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_card>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
lea    0xedf(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1040 <scanf@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"Enter the card_name: \00"
@.str.1 = [4 x i8] c"%2s\00"
define void @get_card(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"Enter the card_name: \00"
@.str.1 = [4 x i8] c"%2s\00"
define void @get_card(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char const *, int);
void RTE_SLUB_BUG(const char *name, int line) {
  printf("SLUB_BUG On file %s line %d.\n", name, line);
  assert(0);
}


x86 assembly (clang, -O0):
<RTE_SLUB_BUG>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RTE_SLUB_BUG>:
push   %rax
mov    %esi,%edx
mov    %rdi,%rsi
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
pop    %rax
jmp    1040 <assert@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"SLUB_BUG On file %s line %d.\0A\00"
define void @RTE_SLUB_BUG(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %6)
%8 = call i32 @assert(i32 0)
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"SLUB_BUG On file %s line %d.\0A\00"
define void @RTE_SLUB_BUG(i8* %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
%4 = tail call i32 @assert(i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ report_stats();
void mmalloc_report_stats() { report_stats(); }


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

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

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

LLVM IR (-O2):
define void @mmalloc_report_stats() {
%1 = tail call i32 (...) @report_stats()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _I8080_SBI();
void do0xDE() { _I8080_SBI(); }


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

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

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

LLVM IR (-O2):
define void @do0xDE() {
%1 = tail call i32 (...) @_I8080_SBI()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
int /*<<< orphan*/ LC_ALL;
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int /*<<< orphan*/ wcstombs(char *, int /*<<< orphan*/ const *, int);
char *wstr2mbstr(const wchar_t *wide_string) {
  static char retstr[1024];
  setlocale(LC_ALL, "en_US.UTF-8");
  wcstombs(retstr, wide_string, 1024);
  return retstr;
}


x86 assembly (clang, -O0):
<wstr2mbstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
lea    0xec4(%rip),%rsi
call   1030 <setlocale@plt>
mov    -0x8(%rbp),%rsi
lea    0x2ef4(%rip),%rdi
mov    $0x400,%edx
call   1040 <wcstombs@plt>
lea    0x2ee3(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wstr2mbstr>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
lea    0xec9(%rip),%rsi
call   1030 <setlocale@plt>
lea    0x2efd(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x400,%edx
call   1040 <wcstombs@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@wstr2mbstr.retstr = internal global [1024 x i8] zeroinitializer
@LC_ALL = global i32 0
@.str = [12 x i8] c"en_US.UTF-8\00"
define i8* @wstr2mbstr(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32, i32* @LC_ALL
%4 = call i32 @setlocale(i32 %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%5 = load i32*, i32** %2
%6 = call i32 @wcstombs(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @wstr2mbstr.retstr, i64 0, i64 0), i32* %5, i32 1024)
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @wstr2mbstr.retstr, i64 0, i64 0)
}

LLVM IR (-O2):
@wstr2mbstr.retstr = internal global [1024 x i8] zeroinitializer
@LC_ALL = global i32 0
@.str = [12 x i8] c"en_US.UTF-8\00"
define i8* @wstr2mbstr(i32* %0) {
%2 = load i32, i32* @LC_ALL
%3 = tail call i32 @setlocale(i32 %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @wcstombs(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @wstr2mbstr.retstr, i64 0, i64 0), i32* %0, i32 1024)
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @wstr2mbstr.retstr, i64 0, i64 0)
}
void nseel_asm_min_fp(void) {
  __asm__("fcom\n"
          "fstsw %ax\n"
          "testl $256, %eax\n"
          "jz 0f\n"
          "fxch\n"
          "0:\n"
          "fstp %st(0)\n");
}


x86 assembly (clang, -O0):
<nseel_asm_min_fp>:
push   %rbp
mov    %rsp,%rbp
fcom   %st(1)
fstsw  %ax
test   $0x100,%eax
je     1116 <nseel_asm_min_fp+0x16>
fxch   %st(1)
fstp   %st(0)
pop    %rbp
ret

x86 assembly (clang, -O2):
<nseel_asm_min_fp>:
fcom   %st(1)
fstsw  %ax
test   $0x100,%eax
je     110e <nseel_asm_min_fp+0xe>
fxch   %st(1)
fstp   %st(0)
ret

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

LLVM IR (-O2):
define void @nseel_asm_min_fp() {
tail call void asm sideeffect "fcom\0Afstsw %ax\0Atestl $$256, %eax\0Ajz 0f\0Afxch\0A0:\0Afstp %st(0)\0A", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ inicia(int *);
int /*<<< orphan*/ mostra(int *);
int main() {
  int vetor[5];
  inicia(vetor);
  mostra(vetor);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x20(%rbp),%rdi
call   1030 <inicia@plt>
lea    -0x20(%rbp),%rdi
call   1040 <mostra@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <inicia@plt>
mov    %rbx,%rdi
call   1040 <mostra@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca [5 x i32]
%2 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%3 = call i32 @inicia(i32* %2)
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%5 = call i32 @mostra(i32* %4)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%4 = call i32 @inicia(i32* %3)
%5 = call i32 @mostra(i32* %3)
ret i32 0
}
void ctest2(int *i) { *i = 5; }


x86 assembly (clang, -O0):
<ctest2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x5,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ctest2>:
movl   $0x5,(%rdi)
ret

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

LLVM IR (-O2):
define void @ctest2(i32* nocapture writeonly %0) {
store i32 5, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SIGTERM;
int /*<<< orphan*/ sig_block(int /*<<< orphan*/);
void sig_termblock() { sig_block(SIGTERM); }


x86 assembly (clang, -O0):
<sig_termblock>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <sig_block@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_termblock>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <sig_block@plt>

LLVM IR (-O0):
@SIGTERM = global i32 0
define void @sig_termblock() {
%1 = load i32, i32* @SIGTERM
%2 = call i32 @sig_block(i32 %1)
ret void
}

LLVM IR (-O2):
@SIGTERM = global i32 0
define void @sig_termblock() {
%1 = load i32, i32* @SIGTERM
%2 = tail call i32 @sig_block(i32 %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int /*<<< orphan*/ findlongest(char *, int);
void main() {
  char a[] = "geeksforgeeks";
  int len = sizeof(a) / sizeof(a[0]);
  findlongest(a, len);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0xe(%rbp)
mov    0xedf(%rip),%eax
mov    %eax,-0x6(%rbp)
mov    0xed9(%rip),%ax
mov    %ax,-0x2(%rbp)
movl   $0xe,-0x14(%rbp)
lea    -0xe(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <findlongest@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movabs $0x736b656567726f,%rax
mov    %rax,0xe(%rsp)
movabs $0x726f66736b656567,%rax
66 6f 72
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
mov    $0xe,%esi
call   1030 <findlongest@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [14 x i8] c"geeksforgeeks\00"
define void @main() {
%1 = alloca [14 x i8]
%2 = alloca i32
%3 = bitcast [14 x i8]* %1 to i8*
store i32 14, i32* %2
%4 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 0
%5 = load i32, i32* %2
%6 = call i32 @findlongest(i8* %4, i32 %5)
ret void
}

LLVM IR (-O2):
@__const.main.a = [14 x i8] c"geeksforgeeks\00"
define void @main() {
%1 = alloca [14 x i8]
%2 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 0
%3 = call i32 @findlongest(i8* %2, i32 14)
ret void
}