xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ DSA;

/* Variables and functions */
int /*<<< orphan*/ DSA_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *DSA_new();
scalar_t__ xDSA_paramgen(int /*<<< orphan*/ *, int);
DSA *xDSA_generate_parameters(int bits) {
  DSA *dsa = DSA_new();
  if (xDSA_paramgen(dsa, bits) != 0) {
    return dsa;
  }
  DSA_free(dsa);
  return NULL;
}


x86 assembly (clang, -O0):
<xDSA_generate_parameters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    $0x0,%al
call   1040 <DSA_new@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <xDSA_paramgen@plt>
cmp    $0x0,%rax
je     1169 <xDSA_generate_parameters+0x39>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    117a <xDSA_generate_parameters+0x4a>
mov    -0x18(%rbp),%rdi
call   1050 <DSA_free@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xDSA_generate_parameters>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <DSA_new@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %ebp,%esi
call   1030 <xDSA_paramgen@plt>
test   %rax,%rax
jne    1158 <xDSA_generate_parameters+0x28>
mov    %rbx,%rdi
call   1050 <DSA_free@plt>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32* @xDSA_generate_parameters(i32 %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
%5 = call i32* (...) @DSA_new()
store i32* %5, i32** %4
%6 = load i32*, i32** %4
%7 = load i32, i32* %3
%8 = call i64 @xDSA_paramgen(i32* %6, i32 %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = load i32*, i32** %4
store i32* %11, i32** %2
br label %15
12: ; preds = %1
%13 = load i32*, i32** %4
%14 = call i32 @DSA_free(i32* %13)
store i32* null, i32** %2
br label %15
15: ; preds = %12, %10
%16 = load i32*, i32** %2
ret i32* %16
}

LLVM IR (-O2):
define i32* @xDSA_generate_parameters(i32 %0) {
%2 = tail call i32* (...) @DSA_new()
%3 = tail call i64 @xDSA_paramgen(i32* %2, i32 %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @DSA_free(i32* %2)
br label %7
7: ; preds = %1, %5
%8 = phi i32* [ null, %5 ], [ %2, %1 ]
ret i32* %8
}
/* Variables and functions */
int /*<<< orphan*/ analyze_hand();
int /*<<< orphan*/ print_result();
int /*<<< orphan*/ read_cards();
int main(void) {
  for (;;) {
    read_cards();
    analyze_hand();
    print_result();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <read_cards@plt>
mov    $0x0,%al
call   1050 <analyze_hand@plt>
mov    $0x0,%al
call   1040 <print_result@plt>
jmp    113f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <read_cards@plt>
xor    %eax,%eax
call   1050 <analyze_hand@plt>
xor    %eax,%eax
call   1040 <print_result@plt>
jmp    1140 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %2, %0
%3 = call i32 (...) @read_cards()
%4 = call i32 (...) @analyze_hand()
%5 = call i32 (...) @print_result()
br label %2
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 (...) @read_cards()
%3 = tail call i32 (...) @analyze_hand()
%4 = tail call i32 (...) @print_result()
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ USHRT_MAX;
unsigned int __sw_hweight16(unsigned int);
int /*<<< orphan*/ gen___sw_hweight16(unsigned int, unsigned int);
int /*<<< orphan*/ limit2_u32(unsigned int *, int /*<<< orphan*/,
                              int /*<<< orphan*/);
unsigned int mksym_u32();
int test_3() {
  unsigned int w;
  unsigned int res;
  w = mksym_u32();
  limit2_u32(&w, 0, USHRT_MAX);
  res = 0;
  res = __sw_hweight16(w);
  gen___sw_hweight16(w, res);
  return 0;
}


x86 assembly (clang, -O0):
<test_3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <mksym_u32@plt>
mov    %eax,-0x4(%rbp)
mov    0x2e8f(%rip),%rax
mov    (%rax),%edx
lea    -0x4(%rbp),%rdi
xor    %esi,%esi
call   1030 <limit2_u32@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <__sw_hweight16@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1060 <gen___sw_hweight16@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_3>:
push   %rax
xor    %eax,%eax
call   1040 <mksym_u32@plt>
mov    %eax,0x4(%rsp)
mov    0x2e95(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rdi
xor    %esi,%esi
call   1030 <limit2_u32@plt>
mov    0x4(%rsp),%edi
call   1050 <__sw_hweight16@plt>
mov    0x4(%rsp),%edi
mov    %eax,%esi
call   1060 <gen___sw_hweight16@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@USHRT_MAX = global i32 0
define i32 @test_3() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @mksym_u32()
store i32 %3, i32* %1
%4 = load i32, i32* @USHRT_MAX
%5 = call i32 @limit2_u32(i32* %1, i32 0, i32 %4)
store i32 0, i32* %2
%6 = load i32, i32* %1
%7 = call i32 @__sw_hweight16(i32 %6)
store i32 %7, i32* %2
%8 = load i32, i32* %1
%9 = load i32, i32* %2
%10 = call i32 @gen___sw_hweight16(i32 %8, i32 %9)
ret i32 0
}

LLVM IR (-O2):
@USHRT_MAX = global i32 0
define i32 @test_3() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (...) @mksym_u32()
store i32 %3, i32* %1
%4 = load i32, i32* @USHRT_MAX
%5 = call i32 @limit2_u32(i32* %1, i32 0, i32 %4)
%6 = load i32, i32* %1
%7 = call i32 @__sw_hweight16(i32 %6)
%8 = load i32, i32* %1
%9 = call i32 @gen___sw_hweight16(i32 %8, i32 %7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ pr30828(int /*<<< orphan*/);
void call_pr30828() { pr30828(0); }


x86 assembly (clang, -O0):
<call_pr30828>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <pr30828@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_pr30828>:
xor    %edi,%edi
jmp    1030 <pr30828@plt>

LLVM IR (-O0):
define void @call_pr30828() {
%1 = call i32 @pr30828(i32 0)
ret void
}

LLVM IR (-O2):
define void @call_pr30828() {
%1 = tail call i32 @pr30828(i32 0)
ret void
}
char upperc(ch)
char ch;
{
  if ((('a' <= ch && 'z' >= ch)))
    return (ch - 0x20);
  else
    return (ch);
}


x86 assembly (clang, -O0):
<upperc>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%ecx
mov    $0x61,%eax
cmp    %ecx,%eax
jg     113b <upperc+0x3b>
movsbl -0x2(%rbp),%ecx
mov    $0x7a,%eax
cmp    %ecx,%eax
jl     113b <upperc+0x3b>
movsbl -0x2(%rbp),%eax
sub    $0x20,%eax
mov    %al,-0x1(%rbp)
jmp    1141 <upperc+0x41>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<upperc>:
mov    %edi,%eax
shl    $0x18,%eax
add    $0x9fffffff,%eax
lea    -0x20(%rdi),%ecx
cmp    $0x1affffff,%eax
movzbl %cl,%eax
cmovae %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @upperc(i32 %0) {
%2 = alloca i8
%3 = alloca i8
%4 = trunc i32 %0 to i8
store i8 %4, i8* %3
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = icmp sle i32 97, %6
br i1 %7, label %8, label %17
8: ; preds = %1
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = icmp sge i32 122, %10
br i1 %11, label %12, label %17
12: ; preds = %8
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = sub nsw i32 %14, 32
%16 = trunc i32 %15 to i8
store i8 %16, i8* %2
br label %19
17: ; preds = %8, %1
%18 = load i8, i8* %3
store i8 %18, i8* %2
br label %19
19: ; preds = %17, %12
%20 = load i8, i8* %2
ret i8 %20
}

LLVM IR (-O2):
define signext i8 @upperc(i32 %0) {
%2 = shl i32 %0, 24
%3 = add i32 %2, -1610612737
%4 = icmp ult i32 %3, 452984831
%5 = add i32 %0, 224
%6 = select i1 %4, i32 %5, i32 %0
%7 = trunc i32 %6 to i8
ret i8 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_main_menu() {
  printf("\n=== Menu ===================\n");
  printf("1. Register User\n");
  printf("2. Login User\n");
  printf("3. Quit\n");
  printf("> ");
}


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

x86 assembly (clang, -O2):
<print_main_menu>:
push   %rax
lea    0xedb(%rip),%rdi
call   1030 <puts@plt>
lea    0xeed(%rip),%rdi
call   1030 <puts@plt>
lea    0xef2(%rip),%rdi
call   1030 <puts@plt>
lea    0xef4(%rip),%rdi
call   1030 <puts@plt>
lea    0xea8(%rip),%rdi
pop    %rax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"\0A=== Menu ===================\0A\00"
@.str.1 = [18 x i8] c"1. Register User\0A\00"
@.str.2 = [15 x i8] c"2. Login User\0A\00"
@.str.3 = [9 x i8] c"3. Quit\0A\00"
@.str.4 = [3 x i8] c"> \00"
define void @print_main_menu() {
%1 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.4 = [3 x i8] c"> \00"
@str = [30 x i8] c"\0A=== Menu ===================\00"
@str.5 = [17 x i8] c"1. Register User\00"
@str.6 = [14 x i8] c"2. Login User\00"
@str.7 = [8 x i8] c"3. Quit\00"
define void @print_main_menu() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.5, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.6, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.7, i64 0, i64 0))
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
ret void
}
int roi_set_baud(unsigned char *buff, int baud) {
  buff[0] = (129);
  buff[1] = 10;
  return 2;
}


x86 assembly (clang, -O0):
<roi_set_baud>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x81,(%rax)
mov    -0x8(%rbp),%rax
movb   $0xa,0x1(%rax)
mov    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<roi_set_baud>:
movw   $0xa81,(%rdi)
mov    $0x2,%eax
ret

LLVM IR (-O0):
define i32 @roi_set_baud(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 = getelementptr inbounds i8, i8* %5, i64 0
store i8 -127, i8* %6
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i64 1
store i8 10, i8* %8
ret i32 2
}

LLVM IR (-O2):
define i32 @roi_set_baud(i8* nocapture writeonly %0, i32 %1) {
store i8 -127, i8* %0
%3 = getelementptr inbounds i8, i8* %0, i64 1
store i8 10, i8* %3
ret i32 2
}
int lower_one_mask(int n) { return (1 << n) - 1; }


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

x86 assembly (clang, -O2):
<lower_one_mask>:
mov    %edi,%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
not    %eax
ret

LLVM IR (-O0):
define i32 @lower_one_mask(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 1, %3
%5 = sub nsw i32 %4, 1
ret i32 %5
}

LLVM IR (-O2):
define i32 @lower_one_mask(i32 %0) {
%2 = shl nsw i32 -1, %0
%3 = xor i32 %2, -1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ copy_key_by_key(char const *, char *);
int get_key_by_name(char const *, char *);
int get_key(const char *input, char *key) {
  if (!copy_key_by_key(input, key)) {
    return get_key_by_name(input, key);
  }
  return 1;
}


x86 assembly (clang, -O0):
<get_key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <copy_key_by_key@plt>
cmp    $0x0,%eax
jne    115b <get_key+0x3b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <get_key_by_name@plt>
mov    %eax,-0x4(%rbp)
jmp    1162 <get_key+0x42>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_key>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <copy_key_by_key@plt>
test   %eax,%eax
je     1140 <get_key+0x20>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <get_key_by_name@plt>

LLVM IR (-O0):
define i32 @get_key(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = load i8*, i8** %5
%8 = call i32 @copy_key_by_key(i8* %6, i8* %7)
%9 = icmp ne i32 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = load i8*, i8** %5
%13 = call i32 @get_key_by_name(i8* %11, i8* %12)
store i32 %13, i32* %3
br label %15
14: ; preds = %2
store i32 1, i32* %3
br label %15
15: ; preds = %14, %10
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @get_key(i8* %0, i8* %1) {
%3 = tail call i32 @copy_key_by_key(i8* %0, i8* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @get_key_by_name(i8* %0, i8* %1)
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ %6, %5 ], [ 1, %2 ]
ret i32 %8
}
int BIO_tou_socket_non_fatal_error(int err) {
  switch (err) {
    return (1);
  default:
    break;
  }
  return (0);
}


x86 assembly (clang, -O0):
<BIO_tou_socket_non_fatal_error>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
jmp    110c <BIO_tou_socket_non_fatal_error+0xc>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @BIO_tou_socket_non_fatal_error(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %4 [
]
4: ; preds = %1
br label %5
5: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
define i32 @BIO_tou_socket_non_fatal_error(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
void testBitXor() { printf("%d ^ %d = %d\n", 10, 7, 10 ^ 7); }


x86 assembly (clang, -O0):
<testBitXor>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0xa,%esi
mov    $0x7,%edx
mov    $0xd,%ecx
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<testBitXor>:
lea    0xee9(%rip),%rdi
mov    $0xa,%esi
mov    $0x7,%edx
mov    $0xd,%ecx
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [14 x i8] c"%d ^ %d = %d\0A\00"
define void @testBitXor() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 10, i32 7, i32 13)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void arrayPointerSample1() {
  int arrA[] = {1, 2, 3, 4, 5};
  int *a = arrA;
  int *b = &arrA[0];
  printf("*a = %d ,*b =  %d\n", *a, *b);
}


x86 assembly (clang, -O0):
<arrayPointerSample1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xedc(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%esi
mov    -0x30(%rbp),%rax
mov    (%rax),%edx
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arrayPointerSample1>:
lea    0xee9(%rip),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [19 x i8] c"*a = %d ,*b = %d\0A\00"
define void @arrayPointerSample1() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 1, i32 1)
ret void
}
void g_utf8_to_ucs4_fast() {}


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

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

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

LLVM IR (-O2):
define void @g_utf8_to_ucs4_fast() {
ret void
}
unsigned replace_byte(unsigned x, unsigned char b, int i) {
  int w = sizeof(int) - 1;
  int shift_left = (i & w) << 3;
  unsigned m = x & ~(0xFF << shift_left);
  unsigned int n = (unsigned)b << shift_left;
  return m + n;
}


x86 assembly (clang, -O0):
<replace_byte>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0x3,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    -0x10(%rbp),%eax
shl    $0x3,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x14(%rbp),%ecx
mov    $0xff,%edx
shl    %cl,%edx
mov    %edx,%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    %eax,-0x18(%rbp)
movzbl -0x5(%rbp),%eax
mov    -0x14(%rbp),%ecx
shl    %cl,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<replace_byte>:
lea    0x0(,%rdx,8),%ecx
mov    $0xff,%eax
shl    %cl,%eax
not    %eax
and    %edi,%eax
shl    %cl,%esi
add    %esi,%eax
ret

LLVM IR (-O0):
define i32 @replace_byte(i32 %0, i8 zeroext %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %4
store i8 %1, i8* %5
store i32 %2, i32* %6
store i32 3, i32* %7
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = and i32 %11, %12
%14 = shl i32 %13, 3
store i32 %14, i32* %8
%15 = load i32, i32* %4
%16 = load i32, i32* %8
%17 = shl i32 255, %16
%18 = xor i32 %17, -1
%19 = and i32 %15, %18
store i32 %19, i32* %9
%20 = load i8, i8* %5
%21 = zext i8 %20 to i32
%22 = load i32, i32* %8
%23 = shl i32 %21, %22
store i32 %23, i32* %10
%24 = load i32, i32* %9
%25 = load i32, i32* %10
%26 = add i32 %24, %25
ret i32 %26
}

LLVM IR (-O2):
define i32 @replace_byte(i32 %0, i8 zeroext %1, i32 %2) {
%4 = shl i32 %2, 3
%5 = and i32 %4, 24
%6 = shl nuw i32 255, %5
%7 = xor i32 %6, -1
%8 = and i32 %7, %0
%9 = zext i8 %1 to i32
%10 = shl nuw i32 %9, %5
%11 = add i32 %8, %10
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ ASL8(int /*<<< orphan*/);
int /*<<< orphan*/ SA1Direct(int);
void Op06M1(void) { ASL8(SA1Direct(3)); }


x86 assembly (clang, -O0):
<Op06M1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
call   1040 <SA1Direct@plt>
mov    %eax,%edi
call   1030 <ASL8@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Op06M1>:
push   %rax
mov    $0x3,%edi
call   1040 <SA1Direct@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <ASL8@plt>

LLVM IR (-O0):
define void @Op06M1() {
%1 = call i32 @SA1Direct(i32 3)
%2 = call i32 @ASL8(i32 %1)
ret void
}

LLVM IR (-O2):
define void @Op06M1() {
%1 = tail call i32 @SA1Direct(i32 3)
%2 = tail call i32 @ASL8(i32 %1)
ret void
}
/* Variables and functions */
scalar_t__ calloc(int, unsigned long long);
int /*<<< orphan*/ fail(char *);
unsigned char *alignedcalloc(unsigned long long len) {
  unsigned char *x = (unsigned char *)calloc(1, len + 128);
  if (!x)
    fail("out of memory");
  x += 63 & (-(unsigned long)x);
  return x;
}


x86 assembly (clang, -O0):
<alignedcalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
add    $0x80,%rsi
mov    $0x1,%edi
call   1040 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115c <alignedcalloc+0x3c>
lea    0xea9(%rip),%rdi
call   1030 <fail@plt>
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
sub    %rcx,%rax
and    $0x3f,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alignedcalloc>:
push   %rbx
lea    0x80(%rdi),%rsi
mov    $0x1,%edi
call   1040 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1146 <alignedcalloc+0x26>
lea    0xebf(%rip),%rdi
call   1030 <fail@plt>
mov    %ebx,%eax
neg    %eax
and    $0x3f,%eax
add    %rax,%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"out of memory\00"
define i8* @alignedcalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = add i64 %4, 128
%6 = call i64 @calloc(i32 1, i64 %5)
%7 = inttoptr i64 %6 to i8*
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = icmp ne i8* %8, null
br i1 %9, label %12, label %10
10: ; preds = %1
%11 = call i32 @fail(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %1
%13 = load i8*, i8** %3
%14 = ptrtoint i8* %13 to i64
%15 = sub i64 0, %14
%16 = and i64 63, %15
%17 = load i8*, i8** %3
%18 = getelementptr inbounds i8, i8* %17, i64 %16
store i8* %18, i8** %3
%19 = load i8*, i8** %3
ret i8* %19
}

LLVM IR (-O2):
@.str = [14 x i8] c"out of memory\00"
define i8* @alignedcalloc(i64 %0) {
%2 = add i64 %0, 128
%3 = tail call i64 @calloc(i32 1, i64 %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @fail(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
%8 = inttoptr i64 %3 to i8*
%9 = sub i64 0, %3
%10 = and i64 %9, 63
%11 = getelementptr inbounds i8, i8* %8, i64 %10
ret i8* %11
}
/* Variables and functions */
int /*<<< orphan*/ do_decode();
int /*<<< orphan*/ do_encode();
int /*<<< orphan*/ do_encode_alloc();
int /*<<< orphan*/ puts(char *);
int main() {
  puts("==================");
  do_encode();
  puts("------------------");
  do_encode_alloc();
  puts("__________________");
  do_decode();
  puts("==================");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1050 <do_encode@plt>
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1060 <do_encode_alloc@plt>
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1040 <do_decode@plt>
lea    0xe7c(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xeb8(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <do_encode@plt>
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <do_encode_alloc@plt>
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <do_decode@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"==================\00"
@.str.1 = [19 x i8] c"------------------\00"
@.str.2 = [19 x i8] c"__________________\00"
define i32 @main() {
%1 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @do_encode()
%3 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 (...) @do_encode_alloc()
%5 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 (...) @do_decode()
%7 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"==================\00"
@.str.1 = [19 x i8] c"------------------\00"
@.str.2 = [19 x i8] c"__________________\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @do_encode()
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 (...) @do_encode_alloc()
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 (...) @do_decode()
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct xdg_surface_listener {
  int dummy;
};
struct xdg_surface {
  int dummy;
};
struct wl_proxy {
  int dummy;
};

/* Variables and functions */
int wl_proxy_add_listener(struct wl_proxy *, void (*)(), void *);
int xdg_surface_add_listener(struct xdg_surface *xdg_surface,
                             const struct xdg_surface_listener *listener,
                             void *data) {
  return wl_proxy_add_listener((struct wl_proxy *)xdg_surface,
                               (void (**)(void))listener, data);
}


x86 assembly (clang, -O0):
<xdg_surface_add_listener>:
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 <wl_proxy_add_listener@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdg_surface_add_listener>:
jmp    1030 <wl_proxy_add_listener@plt>

LLVM IR (-O0):
%struct.xdg_surface = type { i32 }
%struct.xdg_surface_listener = type { i32 }
%struct.wl_proxy = type { i32 }
define i32 @xdg_surface_add_listener(%struct.xdg_surface* %0, %struct.xdg_surface_listener* %1, i8* %2) {
%4 = alloca %struct.xdg_surface*
%5 = alloca %struct.xdg_surface_listener*
%6 = alloca i8*
store %struct.xdg_surface* %0, %struct.xdg_surface** %4
store %struct.xdg_surface_listener* %1, %struct.xdg_surface_listener** %5
store i8* %2, i8** %6
%7 = load %struct.xdg_surface*, %struct.xdg_surface** %4
%8 = bitcast %struct.xdg_surface* %7 to %struct.wl_proxy*
%9 = load %struct.xdg_surface_listener*, %struct.xdg_surface_listener** %5
%10 = bitcast %struct.xdg_surface_listener* %9 to void ()**
%11 = bitcast void ()** %10 to void (...)*
%12 = load i8*, i8** %6
%13 = call i32 @wl_proxy_add_listener(%struct.wl_proxy* %8, void (...)* %11, i8* %12)
ret i32 %13
}

LLVM IR (-O2):
%struct.xdg_surface = type { i32 }
%struct.xdg_surface_listener = type { i32 }
%struct.wl_proxy = type { i32 }
define i32 @xdg_surface_add_listener(%struct.xdg_surface* %0, %struct.xdg_surface_listener* %1, i8* %2) {
%4 = bitcast %struct.xdg_surface* %0 to %struct.wl_proxy*
%5 = bitcast %struct.xdg_surface_listener* %1 to void (...)*
%6 = tail call i32 @wl_proxy_add_listener(%struct.wl_proxy* %4, void (...)* %5, i8* %2)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
int nxtcleanup(void *ref) {
  free(ref);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @nxtcleanup(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret i32 0
}
int floatcmp(float f1, float f2) {
  if (f1 - f2 > -1e-3 && f1 - f2 < 1e-3)
    return 0;
  else
    return 1;
}


x86 assembly (clang, -O0):
<floatcmp>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xedc(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    115a <floatcmp+0x5a>
movss  -0x8(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xec4(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    115a <floatcmp+0x5a>
movl   $0x0,-0x4(%rbp)
jmp    1161 <floatcmp+0x61>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<floatcmp>:
subss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
ucomisd 0xef0(%rip),%xmm0
setbe  %al
movsd  0xeed(%rip),%xmm1
ucomisd %xmm0,%xmm1
setbe  %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @floatcmp(float %0, float %1) {
%3 = alloca i32
%4 = alloca float
%5 = alloca float
store float %0, float* %4
store float %1, float* %5
%6 = load float, float* %4
%7 = load float, float* %5
%8 = fsub float %6, %7
%9 = fpext float %8 to double
%10 = fcmp ogt double %9, -1.000000e-03
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = load float, float* %4
%13 = load float, float* %5
%14 = fsub float %12, %13
%15 = fpext float %14 to double
%16 = fcmp olt double %15, 1.000000e-03
br i1 %16, label %17, label %18
17: ; preds = %11
store i32 0, i32* %3
br label %19
18: ; preds = %11, %2
store i32 1, i32* %3
br label %19
19: ; preds = %18, %17
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
define i32 @floatcmp(float %0, float %1) {
%3 = fsub float %0, %1
%4 = fpext float %3 to double
%5 = fcmp ule double %4, -1.000000e-03
%6 = fcmp uge double %4, 1.000000e-03
%7 = or i1 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
int test_imm_35int64_lowword_mem(long long *val) {
  return ((*val) & (0x35 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_35int64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 53
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ WNOHANG;
int /*<<< orphan*/ waitpid(int, int *, int /*<<< orphan*/);
int main(void) {
  int status;
  pid_t pid;
  pid = waitpid(-1, &status, WNOHANG);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%edi
lea    -0x8(%rbp),%rsi
call   1030 <waitpid@plt>
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rsi
mov    $0xffffffff,%edi
call   1030 <waitpid@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@WNOHANG = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = load i32, i32* @WNOHANG
%5 = call i32 @waitpid(i32 -1, i32* %2, i32 %4)
store i32 %5, i32* %3
ret i32 0
}

LLVM IR (-O2):
@WNOHANG = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = load i32, i32* @WNOHANG
%4 = call i32 @waitpid(i32 -1, i32* %1, i32 %3)
ret i32 0
}
char in(char c, char *arr, int length) {
  for (int i = 0; i < length; i++)
    if (arr[i] == c)
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<in>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1158 <in+0x58>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x2(%rbp),%ecx
cmp    %ecx,%eax
jne    1145 <in+0x45>
movb   $0x1,-0x1(%rbp)
jmp    115c <in+0x5c>
jmp    114a <in+0x4a>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1118 <in+0x18>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<in>:
test   %edx,%edx
jle    1139 <in+0x39>
mov    $0x1,%al
cmp    %dil,(%rsi)
je     1138 <in+0x38>
mov    %edx,%eax
mov    $0x1,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rdx,%rcx
cmp    %rdx,%rax
je     1132 <in+0x32>
lea    0x1(%rcx),%rdx
cmp    %dil,(%rsi,%rcx,1)
jne    1120 <in+0x20>
cmp    %rax,%rcx
setb   %al
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define signext i8 @in(i8 signext %0, i8* %1, i32 %2) {
%4 = alloca i8
%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 = %25, %3
%10 = load i32, i32* %8
%11 = load i32, i32* %7
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %28
13: ; preds = %9
%14 = load i8*, i8** %6
%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* %5
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %19, %21
br i1 %22, label %23, label %24
23: ; preds = %13
store i8 1, i8* %4
br label %29
24: ; preds = %13
br label %25
25: ; preds = %24
%26 = load i32, i32* %8
%27 = add nsw i32 %26, 1
store i32 %27, i32* %8
br label %9
28: ; preds = %9
store i8 0, i8* %4
br label %29
29: ; preds = %28, %23
%30 = load i8, i8* %4
ret i8 %30
}

LLVM IR (-O2):
define signext i8 @in(i8 signext %0, i8* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %21
5: ; preds = %3
%6 = zext i32 %2 to i64
%7 = zext i32 %2 to i64
%8 = load i8, i8* %1
%9 = icmp eq i8 %8, %0
br i1 %9, label %21, label %10
10: ; preds = %5, %13
%11 = phi i64 [ %17, %13 ], [ 1, %5 ]
%12 = icmp eq i64 %11, %7
br i1 %12, label %18, label %13
13: ; preds = %10
%14 = getelementptr inbounds i8, i8* %1, i64 %11
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, %0
%17 = add nuw nsw i64 %11, 1
br i1 %16, label %18, label %10
18: ; preds = %10, %13
%19 = icmp ult i64 %11, %6
%20 = zext i1 %19 to i8
br label %21
21: ; preds = %18, %5, %3
%22 = phi i8 [ 0, %3 ], [ 1, %5 ], [ %20, %18 ]
ret i8 %22
}
int ffsll(bits)
long long int bits;
{
  unsigned long long int ind = (bits & -bits);
  if (ind <= 0xffffffff)
    return __ffsl(bits);
  else
    return 32 + __ffsl(bits >> 32);
}


x86 assembly (clang, -O0):
<ffsll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
xor    %ecx,%ecx
sub    -0x10(%rbp),%rcx
and    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    $0xffffffff,%eax
cmp    %rax,-0x18(%rbp)
ja     114f <ffsll+0x3f>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <__ffsl@plt>
mov    %eax,-0x4(%rbp)
jmp    1164 <ffsll+0x54>
mov    -0x10(%rbp),%rdi
sar    $0x20,%rdi
mov    $0x0,%al
call   1030 <__ffsl@plt>
add    $0x20,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ffsll>:
mov    %rdi,%rax
neg    %rax
and    %rdi,%rax
shr    $0x20,%rax
jne    1126 <ffsll+0x16>
xor    %eax,%eax
jmp    1030 <__ffsl@plt>
push   %rax
sar    $0x20,%rdi
xor    %eax,%eax
call   1030 <__ffsl@plt>
add    $0x20,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @ffsll(i64 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
%5 = load i64, i64* %3
%6 = load i64, i64* %3
%7 = sub nsw i64 0, %6
%8 = and i64 %5, %7
store i64 %8, i64* %4
%9 = load i64, i64* %4
%10 = icmp ule i64 %9, 4294967295
br i1 %10, label %11, label %14
11: ; preds = %1
%12 = load i64, i64* %3
%13 = call i32 (i64, ...) bitcast (i32 (...)* @__ffsl to i32 (i64, ...)*)(i64 %12)
store i32 %13, i32* %2
br label %19
14: ; preds = %1
%15 = load i64, i64* %3
%16 = ashr i64 %15, 32
%17 = call i32 (i64, ...) bitcast (i32 (...)* @__ffsl to i32 (i64, ...)*)(i64 %16)
%18 = add nsw i32 32, %17
store i32 %18, i32* %2
br label %19
19: ; preds = %14, %11
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
define i32 @ffsll(i64 %0) {
%2 = sub nsw i64 0, %0
%3 = and i64 %2, %0
%4 = icmp ult i64 %3, 4294967296
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 (i64, ...) bitcast (i32 (...)* @__ffsl to i32 (i64, ...)*)(i64 %0)
br label %11
7: ; preds = %1
%8 = ashr i64 %0, 32
%9 = tail call i32 (i64, ...) bitcast (i32 (...)* @__ffsl to i32 (i64, ...)*)(i64 %8)
%10 = add nsw i32 %9, 32
br label %11
11: ; preds = %7, %5
%12 = phi i32 [ %6, %5 ], [ %10, %7 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ PSGPlay_Initialise();
void PSG_Init(void) { PSGPlay_Initialise(); }


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

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

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

LLVM IR (-O2):
define void @PSG_Init() {
%1 = tail call i32 (...) @PSGPlay_Initialise()
ret void
}
/* Variables and functions */
double factorial(int);
int /*<<< orphan*/ printf(char *, double);
int main() {
  printf("%f\n", factorial(16));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x10,%edi
call   1030 <factorial@plt>
lea    0xece(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = tail call double @factorial(i32 16)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %1)
ret i32 0
}
_Noreturn void a() { d0(); }


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

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

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

LLVM IR (-O2):
define void @a() {
%1 = tail call i32 (...) @d0()
ret void
}
/* Variables and functions */
int INT_MIN;
int test2(int x) { return (x ^ 0x1234) ^ INT_MIN; }


x86 assembly (clang, -O0):
<test2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    $0x1234,%eax
mov    0x2ed2(%rip),%rcx
xor    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test2>:
mov    %edi,%eax
mov    0x2edf(%rip),%rcx
xor    (%rcx),%eax
xor    $0x1234,%eax
ret

LLVM IR (-O0):
@INT_MIN = global i32 0
define i32 @test2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = xor i32 %3, 4660
%5 = load i32, i32* @INT_MIN
%6 = xor i32 %4, %5
ret i32 %6
}

LLVM IR (-O2):
@INT_MIN = global i32 0
define i32 @test2(i32 %0) {
%2 = load i32, i32* @INT_MIN
%3 = xor i32 %2, %0
%4 = xor i32 %3, 4660
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ assert_fail(char const *, int, char *, void *, void *);
void assert_ptr_equal_(const char *file, int line, void *ex, void *ac) {
  if (ex != ac) {
    assert_fail(file, line, "Expected <%p> but was <%p>", ex, ac);
  }
}


x86 assembly (clang, -O0):
<assert_ptr_equal_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
je     1150 <assert_ptr_equal_+0x40>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
lea    0xeb5(%rip),%rdx
call   1030 <assert_fail@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert_ptr_equal_>:
mov    %rcx,%r8
cmp    %rcx,%rdx
je     1127 <assert_ptr_equal_+0x17>
mov    %rdx,%rcx
lea    0xede(%rip),%rdx
jmp    1030 <assert_fail@plt>
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Expected <%p> but was <%p>\00"
define void @assert_ptr_equal_(i8* %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %7
%10 = load i8*, i8** %8
%11 = icmp ne i8* %9, %10
br i1 %11, label %12, label %18
12: ; preds = %4
%13 = load i8*, i8** %5
%14 = load i32, i32* %6
%15 = load i8*, i8** %7
%16 = load i8*, i8** %8
%17 = call i32 @assert_fail(i8* %13, i32 %14, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %15, i8* %16)
br label %18
18: ; preds = %12, %4
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"Expected <%p> but was <%p>\00"
define void @assert_ptr_equal_(i8* %0, i32 %1, i8* %2, i8* %3) {
%5 = icmp eq i8* %2, %3
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = tail call i32 @assert_fail(i8* %0, i32 %1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %3)
br label %8
8: ; preds = %6, %4
ret void
}
struct aufs_inode *AUFS_INODE(struct inode *inode) {
  return (struct aufs_inode *)inode;
}


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

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

LLVM IR (-O0):
%struct.aufs_inode = type opaque
%struct.inode = type opaque
define %struct.aufs_inode* @AUFS_INODE(%struct.inode* %0) {
%2 = alloca %struct.inode*
store %struct.inode* %0, %struct.inode** %2
%3 = load %struct.inode*, %struct.inode** %2
%4 = bitcast %struct.inode* %3 to %struct.aufs_inode*
ret %struct.aufs_inode* %4
}

LLVM IR (-O2):
%struct.aufs_inode = type opaque
%struct.inode = type opaque
define %struct.aufs_inode* @AUFS_INODE(%struct.inode* readnone %0) {
%2 = bitcast %struct.inode* %0 to %struct.aufs_inode*
ret %struct.aufs_inode* %2
}
/* Variables and functions */
int /*<<< orphan*/ remove(char *);
void remove_sock(void) { remove("/run/cpacfstatsd_socket"); }


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

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

LLVM IR (-O0):
@.str = [24 x i8] c"/run/cpacfstatsd_socket\00"
define void @remove_sock() {
%1 = call i32 @remove(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"/run/cpacfstatsd_socket\00"
define void @remove_sock() {
%1 = tail call i32 @remove(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
ret void
}
void overflow(char total[], int idx) {
  if ((total[idx] - '0') + 1 > 9)
    overflow(total, idx + 1);
  int idx_val = total[idx] - '0';
  total[idx] = ((idx_val + 1) % 10) + '0';
}


x86 assembly (clang, -O0):
<overflow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x30,%eax
add    $0x1,%eax
cmp    $0x9,%eax
jle    1149 <overflow+0x39>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
call   1030 <overflow@plt>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x30,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<overflow>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
movslq %esi,%rbx
mov    (%rdi,%rbx,1),%al
cmp    $0x39,%al
jl     1130 <overflow+0x20>
lea    0x1(%rbx),%esi
mov    %r14,%rdi
call   1030 <overflow@plt>
mov    (%r14,%rbx,1),%al
movsbl %al,%eax
add    $0xffffffd1,%eax
imul   $0x6667,%eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
shr    $0x12,%ecx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
add    $0x30,%al
mov    %al,(%r14,%rbx,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @overflow(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %6, i64 %8
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = sub nsw i32 %11, 48
%13 = add nsw i32 %12, 1
%14 = icmp sgt i32 %13, 9
br i1 %14, label %15, label %19
15: ; preds = %2
%16 = load i8*, i8** %3
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
br label %19
19: ; preds = %15, %2
%20 = load i8*, i8** %3
%21 = load i32, i32* %4
%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 = sub nsw i32 %25, 48
store i32 %26, i32* %5
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
%29 = srem i32 %28, 10
%30 = add nsw i32 %29, 48
%31 = trunc i32 %30 to i8
%32 = load i8*, i8** %3
%33 = load i32, i32* %4
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %32, i64 %34
store i8 %31, i8* %35
ret void
}

LLVM IR (-O2):
define void @overflow(i8* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp sgt i8 %5, 56
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = add nsw i32 %1, 1
tail call void @overflow(i8* %0, i32 %8)
%9 = load i8, i8* %4
br label %10
10: ; preds = %7, %2
%11 = phi i8 [ %9, %7 ], [ %5, %2 ]
%12 = sext i8 %11 to i16
%13 = add nsw i16 %12, -47
%14 = srem i16 %13, 10
%15 = trunc i16 %14 to i8
%16 = add nsw i8 %15, 48
store i8 %16, i8* %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Msp430ClockP__Msp430ClockInit__defaultSetupDcoCalibrate();
void Msp430ClockP__Msp430ClockInit__default__setupDcoCalibrate(void) {
  Msp430ClockP__Msp430ClockInit__defaultSetupDcoCalibrate();
}


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

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

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

LLVM IR (-O2):
define void @Msp430ClockP__Msp430ClockInit__default__setupDcoCalibrate() {
%1 = tail call i32 (...) @Msp430ClockP__Msp430ClockInit__defaultSetupDcoCalibrate()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ vla(int);
main() { vla(2); }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @vla(i32 2)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @vla(i32 2)
ret i32 0
}