xunge/DecIR huggingface dataset:
/* Variables and functions */
char *ask_for_parameter(char *, char);
char *read_optional_parameter(int, char **, char *);
char *read_optional_parameter_or_ask(int argc, char *argv[], char *parameter,
                                     char *question, char EndChar) {
  char *value = read_optional_parameter(argc, argv, parameter);
  if (value == NULL)
    return ask_for_parameter(question, EndChar);
  else
    return value;
}


x86 assembly (clang, -O0):
<read_optional_parameter_or_ask>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %r8b,%al
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %al,-0x29(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <read_optional_parameter@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1172 <read_optional_parameter_or_ask+0x52>
mov    -0x28(%rbp),%rdi
movsbl -0x29(%rbp),%esi
call   1030 <ask_for_parameter@plt>
mov    %rax,-0x8(%rbp)
jmp    117a <read_optional_parameter_or_ask+0x5a>
mov    -0x38(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_optional_parameter_or_ask>:
push   %rbp
push   %rbx
push   %rax
mov    %r8d,%ebp
mov    %rcx,%rbx
call   1040 <read_optional_parameter@plt>
test   %rax,%rax
je     113a <read_optional_parameter_or_ask+0x1a>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
movsbl %bpl,%esi
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <ask_for_parameter@plt>

LLVM IR (-O0):
define i8* @read_optional_parameter_or_ask(i32 %0, i8** %1, i8* %2, i8* %3, i8 signext %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8**
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8
%12 = alloca i8*
store i32 %0, i32* %7
store i8** %1, i8*** %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i8 %4, i8* %11
%13 = load i32, i32* %7
%14 = load i8**, i8*** %8
%15 = load i8*, i8** %9
%16 = call i8* @read_optional_parameter(i32 %13, i8** %14, i8* %15)
store i8* %16, i8** %12
%17 = load i8*, i8** %12
%18 = icmp eq i8* %17, null
br i1 %18, label %19, label %23
19: ; preds = %5
%20 = load i8*, i8** %10
%21 = load i8, i8* %11
%22 = call i8* @ask_for_parameter(i8* %20, i8 signext %21)
store i8* %22, i8** %6
br label %25
23: ; preds = %5
%24 = load i8*, i8** %12
store i8* %24, i8** %6
br label %25
25: ; preds = %23, %19
%26 = load i8*, i8** %6
ret i8* %26
}

LLVM IR (-O2):
define i8* @read_optional_parameter_or_ask(i32 %0, i8** %1, i8* %2, i8* %3, i8 signext %4) {
%6 = tail call i8* @read_optional_parameter(i32 %0, i8** %1, i8* %2)
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i8* @ask_for_parameter(i8* %3, i8 signext %4)
br label %10
10: ; preds = %5, %8
%11 = phi i8* [ %9, %8 ], [ %6, %5 ]
ret i8* %11
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ encoding_is_wchar;
};
typedef TYPE_1__ XIMText;

/* Variables and functions */
int get_XIMText_encoding_is_wchar(void *_p) {
  return (int)((XIMText *)_p)->encoding_is_wchar;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i32 @get_XIMText_encoding_is_wchar(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @get_XIMText_encoding_is_wchar(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
void type_7_data_transfer(void) {}


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

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

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

LLVM IR (-O2):
define void @type_7_data_transfer() {
ret void
}
void test_three(int x, int y) {
#pragma omp distribute collapse(1)
  for (int i = 0; i < x; i++)
    for (int i = 0; i < y; i++)
      ;
}


x86 assembly (clang, -O0):
<test_three>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1156 <test_three+0x56>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1143 <test_three+0x43>
jmp    1135 <test_three+0x35>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1124 <test_three+0x24>
jmp    1148 <test_three+0x48>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1111 <test_three+0x11>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @test_three(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %7
7: ; preds = %21, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %3
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %24
11: ; preds = %7
store i32 0, i32* %6
br label %12
12: ; preds = %17, %11
%13 = load i32, i32* %6
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %20
16: ; preds = %12
br label %17
17: ; preds = %16
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 1
store i32 %19, i32* %6
br label %12
20: ; preds = %12
br label %21
21: ; preds = %20
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %7
24: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @test_three(i32 %0, i32 %1) {
ret void
}
/* Type definitions */
typedef scalar_t__ ssize_t;
typedef int /*<<< orphan*/ ch;

/* Variables and functions */
int /*<<< orphan*/ err(int, char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ recv(int, char *, int, int /*<<< orphan*/);
void receive_and_exit(int s) {
  ssize_t ssize;
  char ch;
  ssize = recv(s, &ch, sizeof(ch), 0);
  if (ssize < 0)
    err(-1, "receive_and_exit: recv");
  exit(0);
}


x86 assembly (clang, -O0):
<receive_and_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x11(%rbp),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jge    116e <receive_and_exit+0x3e>
mov    $0xffffffff,%edi
lea    0xe97(%rip),%rsi
call   1040 <err@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<receive_and_exit>:
push   %rax
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %rax,%rax
jns    1158 <receive_and_exit+0x28>
lea    0xeb2(%rip),%rsi
mov    $0xffffffff,%edi
call   1040 <err@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"receive_and_exit: recv\00"
define void @receive_and_exit(i32 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca i8
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call i64 @recv(i32 %5, i8* %4, i32 1, i32 0)
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @err(i32 -1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %1
%12 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [23 x i8] c"receive_and_exit: recv\00"
define void @receive_and_exit(i32 %0) {
%2 = alloca i8
%3 = call i64 @recv(i32 %0, i8* %2, i32 1, i32 0)
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @err(i32 -1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
%8 = call i32 @exit(i32 0)
unreachable
}
unsigned find_msb(unsigned val) {
  unsigned nbits;
  if (val == 0)
    return 0;
  for (nbits = 8 * sizeof(val) - 1; val < (1u << nbits); --nbits)
    ;
  return nbits + 1;
}


x86 assembly (clang, -O0):
<find_msb>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    111d <find_msb+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    1157 <find_msb+0x57>
movl   $0x1f,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
cmp    %ecx,%eax
jae    114e <find_msb+0x4e>
jmp    1140 <find_msb+0x40>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1124 <find_msb+0x24>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_msb>:
test   %edi,%edi
je     111f <find_msb+0x1f>
mov    $0x21,%eax
nopl   0x0(%rax)
lea    -0x2(%rax),%ecx
mov    %edi,%edx
shr    %cl,%edx
add    $0xffffffff,%eax
test   %edx,%edx
je     1110 <find_msb+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @find_msb(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 0, i32* %2
br label %21
8: ; preds = %1
store i32 31, i32* %4
br label %9
9: ; preds = %15, %8
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = shl i32 1, %11
%13 = icmp ult i32 %10, %12
br i1 %13, label %14, label %18
14: ; preds = %9
br label %15
15: ; preds = %14
%16 = load i32, i32* %4
%17 = add i32 %16, -1
store i32 %17, i32* %4
br label %9
18: ; preds = %9
%19 = load i32, i32* %4
%20 = add i32 %19, 1
store i32 %20, i32* %2
br label %21
21: ; preds = %18, %7
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
define i32 @find_msb(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 31, %1 ]
%5 = lshr i32 %0, %4
%6 = icmp eq i32 %5, 0
%7 = add i32 %4, -1
br i1 %6, label %3, label %8
8: ; preds = %3
%9 = add i32 %4, 1
br label %10
10: ; preds = %1, %8
%11 = phi i32 [ %9, %8 ], [ 0, %1 ]
ret i32 %11
}
void INT_Excep_SCI12_SCIX1(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_SCI12_SCIX1() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void *check_alloc(void *_ptr) {
  if (_ptr == NULL) {
    fprintf(stderr, "Out of memory.\n");
    exit(EXIT_FAILURE);
  }
  return _ptr;
}


x86 assembly (clang, -O0):
<check_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    115a <check_alloc+0x3a>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
lea    0xeb9(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_alloc>:
test   %rdi,%rdi
je     1129 <check_alloc+0x9>
mov    %rdi,%rax
ret
push   %rax
mov    0x2eaf(%rip),%rax
mov    (%rax),%edi
lea    0xec6(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [16 x i8] c"Out of memory.\0A\00"
@EXIT_FAILURE = global i32 0
define i8* @check_alloc(i8* readnone returned %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %8
3: ; preds = %1
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %1
ret i8* %0
}
/* Variables and functions */
unsigned int ATM_CELL_PAYLOAD;
int ATM_CELL_SIZE;
unsigned tc_align_to_atm(unsigned size) {
  int linksize, cells;
  cells = size / ATM_CELL_PAYLOAD;
  if ((size % ATM_CELL_PAYLOAD) > 0)
    cells++;
  linksize = cells * ATM_CELL_SIZE;
  return linksize;
}


x86 assembly (clang, -O0):
<tc_align_to_atm>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2ec7(%rip),%rcx
xor    %edx,%edx
divl   (%rcx)
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2eb6(%rip),%rcx
xor    %edx,%edx
divl   (%rcx)
cmp    $0x0,%edx
jbe    1138 <tc_align_to_atm+0x38>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2ea6(%rip),%rcx
imul   (%rcx),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tc_align_to_atm>:
mov    %edi,%eax
mov    0x2ecf(%rip),%rcx
xor    %edx,%edx
divl   (%rcx)
cmp    $0x1,%edx
sbb    $0xffffffff,%eax
mov    0x2ece(%rip),%rcx
imul   (%rcx),%eax
ret

LLVM IR (-O0):
@ATM_CELL_PAYLOAD = global i32 0
@ATM_CELL_SIZE = global i32 0
define i32 @tc_align_to_atm(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = load i32, i32* @ATM_CELL_PAYLOAD
%7 = udiv i32 %5, %6
store i32 %7, i32* %4
%8 = load i32, i32* %2
%9 = load i32, i32* @ATM_CELL_PAYLOAD
%10 = urem i32 %8, %9
%11 = icmp ugt i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %1
%13 = load i32, i32* %4
%14 = add nsw i32 %13, 1
store i32 %14, i32* %4
br label %15
15: ; preds = %12, %1
%16 = load i32, i32* %4
%17 = load i32, i32* @ATM_CELL_SIZE
%18 = mul nsw i32 %16, %17
store i32 %18, i32* %3
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@ATM_CELL_PAYLOAD = global i32 0
@ATM_CELL_SIZE = global i32 0
define i32 @tc_align_to_atm(i32 %0) {
%2 = load i32, i32* @ATM_CELL_PAYLOAD
%3 = udiv i32 %0, %2
%4 = urem i32 %0, %2
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i32
%7 = add nsw i32 %3, %6
%8 = load i32, i32* @ATM_CELL_SIZE
%9 = mul nsw i32 %7, %8
ret i32 %9
}
void caller_1_2_1_1_1_2_1() {}


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

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

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

LLVM IR (-O2):
define void @caller_1_2_1_1_1_2_1() {
ret void
}
int test_imm_A5int64_midword_reg(long long val) {
  return ((val >> 16) & (0xA5 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_A5int64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 16
%5 = and i64 %4, 165
%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_A5int64_midword_reg(i64 %0) {
%2 = and i64 %0, 10813440
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ scanf(char *, int *);
int get_int() {
  int x, c;
  scanf(" %d", &x);
  while ((c = getchar()) != '\n' && c != EOF) {
  }
  return x;
}


x86 assembly (clang, -O0):
<get_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0x8(%rbp)
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x9(%rbp)
je     1164 <get_int+0x44>
mov    -0x8(%rbp),%eax
mov    0x2e8c(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1174 <get_int+0x54>
jmp    1179 <get_int+0x59>
jmp    1138 <get_int+0x18>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_int>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x2eab(%rip),%rbx
nopl   (%rax)
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%eax
je     1150 <get_int+0x30>
cmp    (%rbx),%eax
jne    1140 <get_int+0x20>
mov    0xc(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c" %d\00"
@EOF = global i32 0
define i32 @get_int() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
br label %4
4: ; preds = %13, %0
%5 = call i32 (...) @getchar()
store i32 %5, i32* %2
%6 = icmp ne i32 %5, 10
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = load i32, i32* %2
%9 = load i32, i32* @EOF
%10 = icmp ne i32 %8, %9
br label %11
11: ; preds = %7, %4
%12 = phi i1 [ false, %4 ], [ %10, %7 ]
br i1 %12, label %13, label %14
13: ; preds = %11
br label %4
14: ; preds = %11
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@.str = [4 x i8] c" %d\00"
@EOF = global i32 0
define i32 @get_int() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
br label %4
4: ; preds = %4, %0
%5 = call i32 (...) @getchar()
%6 = icmp ne i32 %5, 10
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %5, %7
%9 = select i1 %6, i1 %8, i1 false
br i1 %9, label %4, label %10
10: ; preds = %4
%11 = load i32, i32* %1
ret i32 %11
}
/* Variables and functions */
scalar_t__ EINTR;
scalar_t__ errno;
int ioctl(int, int, void *);
int dx_ioctl(int fd, int request, void *arg) {
  int r;
  do {
    r = ioctl(fd, request, arg);
  } while (-1 == r && EINTR == errno);
  return r;
}


x86 assembly (clang, -O0):
<dx_ioctl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1030 <ioctl@plt>
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
mov    $0xffffffff,%ecx
cmp    -0x14(%rbp),%ecx
mov    %al,-0x15(%rbp)
jne    1161 <dx_ioctl+0x51>
mov    0x2e8a(%rip),%rax
mov    (%rax),%rax
mov    0x2e88(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1122 <dx_ioctl+0x12>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dx_ioctl>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%r14
mov    %esi,%ebp
mov    %edi,%ebx
mov    0x2eb2(%rip),%r15
mov    0x2eb3(%rip),%r12
nopl   (%rax)
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r14,%rdx
call   1030 <ioctl@plt>
cmp    $0xffffffff,%eax
jne    114a <dx_ioctl+0x3a>
mov    (%r12),%rcx
cmp    %rcx,(%r15)
je     1130 <dx_ioctl+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EINTR = global i64 0
@errno = global i64 0
define i32 @dx_ioctl(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
br label %8
8: ; preds = %20, %3
%9 = load i32, i32* %4
%10 = load i32, i32* %5
%11 = load i8*, i8** %6
%12 = call i32 @ioctl(i32 %9, i32 %10, i8* %11)
store i32 %12, i32* %7
br label %13
13: ; preds = %8
%14 = load i32, i32* %7
%15 = icmp eq i32 -1, %14
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i64, i64* @EINTR
%18 = load i64, i64* @errno
%19 = icmp eq i64 %17, %18
br label %20
20: ; preds = %16, %13
%21 = phi i1 [ false, %13 ], [ %19, %16 ]
br i1 %21, label %8, label %22
22: ; preds = %20
%23 = load i32, i32* %7
ret i32 %23
}

LLVM IR (-O2):
@EINTR = global i64 0
@errno = global i64 0
define i32 @dx_ioctl(i32 %0, i32 %1, i8* %2) {
br label %4
4: ; preds = %4, %3
%5 = tail call i32 @ioctl(i32 %0, i32 %1, i8* %2)
%6 = icmp eq i32 %5, -1
%7 = load i64, i64* @EINTR
%8 = load i64, i64* @errno
%9 = icmp eq i64 %7, %8
%10 = select i1 %6, i1 %9, i1 false
br i1 %10, label %4, label %11
11: ; preds = %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ usleep(int);
void g(void) {
  int i = 0;
  while (1) {
    printf("in g (%d)\n", i++);
    usleep(10000);
  }
}


x86 assembly (clang, -O0):
<g>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    %eax,-0x4(%rbp)
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    $0x2710,%edi
call   1040 <usleep@plt>
jmp    112f <g+0xf>

x86 assembly (clang, -O2):
<g>:
push   %rbp
push   %rbx
push   %rax
xor    %esi,%esi
lea    0xed4(%rip),%rbx
nopl   0x0(%rax)
lea    0x1(%rsi),%ebp
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    $0x2710,%edi
call   1040 <usleep@plt>
mov    %ebp,%esi
jmp    1130 <g+0x10>

LLVM IR (-O0):
@.str = [11 x i8] c"in g (%d)\0A\00"
define void @g() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %0, %2
%3 = load i32, i32* %1
%4 = add nsw i32 %3, 1
store i32 %4, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %3)
%6 = call i32 @usleep(i32 10000)
br label %2
}

LLVM IR (-O2):
@.str = [11 x i8] c"in g (%d)\0A\00"
define void @g() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 0, %0 ], [ %3, %1 ]
%3 = add nuw nsw i32 %2, 1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %2)
%5 = tail call i32 @usleep(i32 10000)
br label %1
}
/* Variables and functions */
int getchar();
int c_getchar() { return getchar(); }


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

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

LLVM IR (-O0):
define i32 @c_getchar() {
%1 = call i32 (...) @getchar()
ret i32 %1
}

LLVM IR (-O2):
define i32 @c_getchar() {
%1 = tail call i32 (...) @getchar()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ write(char *, char *, int /*<<< orphan*/ *);
void end_task_section() { write("msproject.xml", "</Tasks>\n", NULL); }


x86 assembly (clang, -O0):
<end_task_section>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xeec(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <write@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<end_task_section>:
lea    0xee9(%rip),%rdi
lea    0xef0(%rip),%rsi
xor    %edx,%edx
jmp    1030 <write@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"msproject.xml\00"
@.str.1 = [10 x i8] c"</Tasks>\0A\00"
define void @end_task_section() {
%1 = call i32 @write(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32* null)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"msproject.xml\00"
@.str.1 = [10 x i8] c"</Tasks>\0A\00"
define void @end_task_section() {
%1 = tail call i32 @write(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32* null)
ret void
}
int test_imm_48uint8_mem(unsigned char *val) {
  return ((*val) & (0x48 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_48uint8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = and i32 %5, 72
%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_48uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 72
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
double pow(float, double);
float toSRGB(float color) {
  return color < 0.0031308 ? (12.92 * color)
                           : (1.055 * pow(color, 1.0 / 2.4) - 0.055);
}


x86 assembly (clang, -O0):
<toSRGB>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xed2(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1157 <toSRGB+0x47>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xed7(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1186 <toSRGB+0x76>
movss  -0x4(%rbp),%xmm0
movsd  0xeb4(%rip),%xmm1
call   1030 <pow@plt>
movsd  0xe97(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe93(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<toSRGB>:
push   %rax
movaps %xmm0,%xmm2
cvtss2sd %xmm0,%xmm0
movsd  0xee0(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1130 <toSRGB+0x20>
mulsd  0xef2(%rip),%xmm0
jmp    1150 <toSRGB+0x40>
movsd  0xed0(%rip),%xmm1
movaps %xmm2,%xmm0
call   1030 <pow@plt>
mulsd  0xec8(%rip),%xmm0
addsd  0xec8(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @toSRGB(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = fcmp olt double %4, 3.130800e-03
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load float, float* %2
%8 = fpext float %7 to double
%9 = fmul double 1.292000e+01, %8
br label %14
10: ; preds = %1
%11 = load float, float* %2
%12 = call double @pow(float %11, double 0x3FDAAAAAAAAAAAAB)
%13 = call double @llvm.fmuladd.f64(double 1.055000e+00, double %12, double -5.500000e-02)
br label %14
14: ; preds = %10, %6
%15 = phi double [ %9, %6 ], [ %13, %10 ]
%16 = fptrunc double %15 to float
ret float %16
}

LLVM IR (-O2):
define float @toSRGB(float %0) {
%2 = fpext float %0 to double
%3 = fcmp olt double %2, 3.130800e-03
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = fmul double %2, 1.292000e+01
br label %9
6: ; preds = %1
%7 = tail call double @pow(float %0, double 0x3FDAAAAAAAAAAAAB)
%8 = tail call double @llvm.fmuladd.f64(double %7, double 1.055000e+00, double -5.500000e-02)
br label %9
9: ; preds = %6, %4
%10 = phi double [ %5, %4 ], [ %8, %6 ]
%11 = fptrunc double %10 to float
ret float %11
}
/* Type definitions */
typedef int /*<<< orphan*/ wint_t;
typedef int /*<<< orphan*/ wchar_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ WEOF;
wint_t putwc(wchar_t wc, FILE *stream) {
  ;
  return WEOF;
}


x86 assembly (clang, -O0):
<putwc>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ece(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<putwc>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@WEOF = global i32 0
define i32 @putwc(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
%5 = load i32, i32* @WEOF
ret i32 %5
}

LLVM IR (-O2):
@WEOF = global i32 0
define i32 @putwc(i32 %0, i32* nocapture readnone %1) {
%3 = load i32, i32* @WEOF
ret i32 %3
}
int ffs(int i) {
  unsigned int j = i;
  for (i = 1; j && !(j & 1); j >>= 1, i++)
    ;
  if (j)
    return i;
  return 0;
}


x86 assembly (clang, -O0):
<ffs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x1,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0xd(%rbp)
je     1134 <ffs+0x34>
mov    -0xc(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1144 <ffs+0x44>
jmp    1160 <ffs+0x60>
jmp    1149 <ffs+0x49>
mov    -0xc(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1114 <ffs+0x14>
cmpl   $0x0,-0xc(%rbp)
je     1175 <ffs+0x75>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117c <ffs+0x7c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ffs>:
mov    $0x1,%ecx
test   %edi,%edi
setne  %dl
je     1136 <ffs+0x36>
mov    %edi,%eax
and    $0x1,%eax
jne    1136 <ffs+0x36>
mov    $0x1,%ecx
nopl   0x0(%rax,%rax,1)
add    $0x1,%ecx
cmp    $0x2,%edi
setae  %dl
jb     1136 <ffs+0x36>
mov    %edi,%eax
shr    %eax
and    $0x2,%edi
mov    %eax,%edi
je     1120 <ffs+0x20>
xor    %eax,%eax
test   %dl,%dl
cmovne %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @ffs(i32 %0) {
%2 = icmp ne i32 %0, 0
%3 = and i32 %0, 1
%4 = icmp eq i32 %3, 0
%5 = and i1 %2, %4
br i1 %5, label %6, label %15
6: ; preds = %1, %6
%7 = phi i32 [ %9, %6 ], [ %0, %1 ]
%8 = phi i32 [ %10, %6 ], [ 1, %1 ]
%9 = lshr i32 %7, 1
%10 = add nuw nsw i32 %8, 1
%11 = icmp ugt i32 %7, 1
%12 = and i32 %7, 2
%13 = icmp eq i32 %12, 0
%14 = and i1 %11, %13
br i1 %14, label %6, label %15
15: ; preds = %6, %1
%16 = phi i32 [ 1, %1 ], [ %10, %6 ]
%17 = phi i1 [ %2, %1 ], [ %11, %6 ]
%18 = select i1 %17, i32 %16, i32 0
ret i32 %18
}
int intcmp(int i1, int i2) {
  if (i1 > i2)
    return 1;
  if (i1 < i2)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<intcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1122 <intcmp+0x22>
movl   $0x1,-0x4(%rbp)
jmp    1141 <intcmp+0x41>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    113a <intcmp+0x3a>
movl   $0xffffffff,-0x4(%rbp)
jmp    1141 <intcmp+0x41>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<intcmp>:
xor    %ecx,%ecx
cmp    %esi,%edi
setl   %cl
neg    %ecx
cmp    %esi,%edi
mov    $0x1,%eax
cmovle %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @intcmp(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = icmp slt i32 %0, %1
%5 = sext i1 %4 to i32
%6 = select i1 %3, i32 1, i32 %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ Lut_N(double *, double *, int);
void Lut_8(double *out, double *in) { Lut_N(out, in, 8); }


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

x86 assembly (clang, -O2):
<Lut_8>:
mov    $0x8,%edx
jmp    1030 <Lut_N@plt>

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

LLVM IR (-O2):
define void @Lut_8(double* %0, double* %1) {
%3 = tail call i32 @Lut_N(double* %0, double* %1, i32 8)
ret void
}
void test3() {
  printf("\t*** %s ***\n", __func__);
  small_string_test("1,,2");
  printf("\t*** %s: done ***\n ", __func__);
}


x86 assembly (clang, -O0):
<test3>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xedb(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <small_string_test@plt>
lea    0xeca(%rip),%rdi
lea    0xeb8(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test3>:
push   %rbx
lea    0xed8(%rip),%rdi
lea    0xede(%rip),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed3(%rip),%rdi
xor    %eax,%eax
call   1030 <small_string_test@plt>
lea    0xeca(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"\09*** %s ***\0A\00"
@__func__.test3 = [6 x i8] c"test3\00"
@.str.1 = [5 x i8] c"1,,2\00"
@.str.2 = [20 x i8] c"\09*** %s: done ***\0A \00"
define void @test3() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @__func__.test3, i64 0, i64 0))
%2 = call i32 (i8*, ...) bitcast (i32 (...)* @small_string_test to i32 (i8*, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @__func__.test3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"\09*** %s ***\0A\00"
@__func__.test3 = [6 x i8] c"test3\00"
@.str.1 = [5 x i8] c"1,,2\00"
@.str.2 = [20 x i8] c"\09*** %s: done ***\0A \00"
define void @test3() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @__func__.test3, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @small_string_test to i32 (i8*, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @__func__.test3, i64 0, i64 0))
ret void
}
/* Variables and functions */
unsigned char *iconv_convert4(char const *, char const *, int /*<<< orphan*/,
                              size_t *);
int /*<<< orphan*/ strlen(char const *);
unsigned char *iconv_convert(const char *str, const char *from) {
  size_t outlen = 0;
  return iconv_convert4(str, from, strlen(str), &outlen);
}


x86 assembly (clang, -O0):
<iconv_convert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
lea    -0x18(%rbp),%rcx
call   1040 <iconv_convert4@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iconv_convert>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
movq   $0x0,(%rsp)
call   1030 <strlen@plt>
mov    %rsp,%rcx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1040 <iconv_convert4@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @iconv_convert(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
store i8* %0, i8** %3
store i8* %1, i8** %4
store i64 0, i64* %5
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = load i8*, i8** %3
%9 = call i32 @strlen(i8* %8)
%10 = call i8* @iconv_convert4(i8* %6, i8* %7, i32 %9, i64* %5)
ret i8* %10
}

LLVM IR (-O2):
define i8* @iconv_convert(i8* %0, i8* %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
store i64 0, i64* %3
%5 = tail call i32 @strlen(i8* %0)
%6 = call i8* @iconv_convert4(i8* %0, i8* %1, i32 %5, i64* %3)
ret i8* %6
}
int hash(char *p) {
  int s = 0;
  while (*p)
    s += *p++;
  return s % 16384;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1139 <hash+0x39>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    110f <hash+0xf>
mov    -0xc(%rbp),%eax
mov    $0x4000,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1134 <hash+0x34>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash+0x10>
lea    0x3fff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffffc000,%ecx
sub    %ecx,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %11, %4 ], [ %2, %1 ]
%6 = phi i32 [ %10, %4 ], [ 0, %1 ]
%7 = phi i8* [ %8, %4 ], [ %0, %1 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = sext i8 %5 to i32
%10 = add nsw i32 %6, %9
%11 = load i8, i8* %8
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4
%14 = srem i32 %10, 16384
br label %15
15: ; preds = %13, %1
%16 = phi i32 [ 0, %1 ], [ %14, %13 ]
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main(void) {
  int a, b;
  scanf("%d %d", &a, &b);
  printf("%d\n", ((a) > (b) ? (a) : (b)));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    115a <main+0x3a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1160 <main+0x40>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe9c(%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
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
mov    (%rsp),%esi
cmp    %esi,%eax
cmovg  %eax,%esi
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = icmp sgt i32 %6, %7
%9 = select i1 %8, i32 %6, i32 %7
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %9)
ret i32 0
}
/* Variables and functions */
double findMedianSortedArrays(int *, int, int *, int);
double getMedian(int *a, int n, int *b, int m) {
  return findMedianSortedArrays(a, n, b, m);
}


x86 assembly (clang, -O0):
<getMedian>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1030 <findMedianSortedArrays@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getMedian>:
jmp    1030 <findMedianSortedArrays@plt>

LLVM IR (-O0):
define double @getMedian(i32* %0, i32 %1, i32* %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i32 %3, i32* %8
%9 = load i32*, i32** %5
%10 = load i32, i32* %6
%11 = load i32*, i32** %7
%12 = load i32, i32* %8
%13 = call double @findMedianSortedArrays(i32* %9, i32 %10, i32* %11, i32 %12)
ret double %13
}

LLVM IR (-O2):
define double @getMedian(i32* %0, i32 %1, i32* %2, i32 %3) {
%5 = tail call double @findMedianSortedArrays(i32* %0, i32 %1, i32* %2, i32 %3)
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(char *s) {
  fprintf(stderr, "usage: gf_example_5\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
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 <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 = [21 x i8] c"usage: gf_example_5\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"usage: gf_example_5\0A\00"
define void @usage(i8* nocapture readnone %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
long umfpack_dl_scale(double *, double *, void *);
void umf4scal_(double x[], double b[], void **Numeric, long *status) {
  *status = umfpack_dl_scale(x, b, *Numeric);
}


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

x86 assembly (clang, -O2):
<umf4scal_>:
push   %rbx
mov    %rcx,%rbx
mov    (%rdx),%rdx
call   1030 <umfpack_dl_scale@plt>
mov    %rax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @umf4scal_(double* %0, double* %1, i8** %2, i64* %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca i8**
%8 = alloca i64*
store double* %0, double** %5
store double* %1, double** %6
store i8** %2, i8*** %7
store i64* %3, i64** %8
%9 = load double*, double** %5
%10 = load double*, double** %6
%11 = load i8**, i8*** %7
%12 = load i8*, i8** %11
%13 = call i64 @umfpack_dl_scale(double* %9, double* %10, i8* %12)
%14 = load i64*, i64** %8
store i64 %13, i64* %14
ret void
}

LLVM IR (-O2):
define void @umf4scal_(double* %0, double* %1, i8** nocapture %2, i64* nocapture writeonly %3) {
%5 = load i8*, i8** %2
%6 = tail call i64 @umfpack_dl_scale(double* %0, double* %1, i8* %5)
store i64 %6, i64* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
main() { puts("Hello world!"); }


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"Hello world!\00"
define i32 @main() {
%1 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"Hello world!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ wait(int);
int main(void) {
  unsigned long i = 0;
  (*(volatile unsigned long *)0x56000050) =
      (1 << (4 * 2)) | (1 << (5 * 2)) | (1 << (6 * 2));
  while (1) {
    wait(30000);
    (*(volatile unsigned long *)0x56000054) = (~(i << 4));
    if (++i == 8)
      i = 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    $0x56000050,%eax
movq   $0x1500,(%rax)
mov    $0x7530,%edi
call   1030 <wait@plt>
mov    -0x10(%rbp),%rcx
shl    $0x4,%rcx
xor    $0xffffffffffffffff,%rcx
mov    $0x56000054,%eax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
cmp    $0x8,%rax
jne    116f <main+0x5f>
movq   $0x0,-0x10(%rbp)
jmp    1133 <main+0x23>

x86 assembly (clang, -O2):
<main>:
push   %rbx
movq   $0x1500,0x56000050
xor    %ebx,%ebx
nop
mov    $0x7530,%edi
call   1030 <wait@plt>
mov    %rbx,%rax
shl    $0x4,%rax
not    %rax
mov    %rax,0x56000054
56
add    $0x1,%rbx
cmp    $0x8,%rbx
mov    $0x0,%eax
cmove  %rax,%rbx
jmp    1120 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
store i32 0, i32* %1
store i64 0, i64* %2
store volatile i64 5376, i64* inttoptr (i64 1442840656 to i64*)
br label %3
3: ; preds = %0, %12
%4 = call i32 @wait(i32 30000)
%5 = load i64, i64* %2
%6 = shl i64 %5, 4
%7 = xor i64 %6, -1
store volatile i64 %7, i64* inttoptr (i64 1442840660 to i64*)
%8 = load i64, i64* %2
%9 = add i64 %8, 1
store i64 %9, i64* %2
%10 = icmp eq i64 %9, 8
br i1 %10, label %11, label %12
11: ; preds = %3
store i64 0, i64* %2
br label %12
12: ; preds = %11, %3
br label %3
}

LLVM IR (-O2):
define i32 @main() {
store volatile i64 5376, i64* inttoptr (i64 1442840656 to i64*)
br label %1
1: ; preds = %1, %0
%2 = phi i64 [ 0, %0 ], [ %8, %1 ]
%3 = tail call i32 @wait(i32 30000)
%4 = shl i64 %2, 4
%5 = xor i64 %4, -1
store volatile i64 %5, i64* inttoptr (i64 1442840660 to i64*)
%6 = add i64 %2, 1
%7 = icmp eq i64 %6, 8
%8 = select i1 %7, i64 0, i64 %6
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ db(int);
void cli() { db(0xFA); }


x86 assembly (clang, -O0):
<cli>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfa,%edi
call   1030 <db@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cli>:
mov    $0xfa,%edi
jmp    1030 <db@plt>

LLVM IR (-O0):
define void @cli() {
%1 = call i32 @db(i32 250)
ret void
}

LLVM IR (-O2):
define void @cli() {
%1 = tail call i32 @db(i32 250)
ret void
}