xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printsignals(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ warnx(char *, char *);
void nosig(char *name) {
  warnx("unknown signal %s; valid signals:", name);
  printsignals(stderr);
  exit(1);
}


x86 assembly (clang, -O0):
<nosig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeb9(%rip),%rdi
call   1030 <warnx@plt>
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
call   1050 <printsignals@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<nosig>:
push   %rax
mov    %rdi,%rsi
lea    0xec5(%rip),%rdi
call   1030 <warnx@plt>
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
call   1050 <printsignals@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"unknown signal %s; valid signals:\00"
@stderr = global i32 0
define void @nosig(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @warnx(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = load i32, i32* @stderr
%6 = call i32 @printsignals(i32 %5)
%7 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [34 x i8] c"unknown signal %s; valid signals:\00"
@stderr = global i32 0
define void @nosig(i8* %0) {
%2 = tail call i32 @warnx(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = load i32, i32* @stderr
%4 = tail call i32 @printsignals(i32 %3)
%5 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
void swap_int16(void *a, void *b) {
  do {
    int16_t temp = *(int16_t *)a;
    *(int16_t *)a = *(int16_t *)b;
    *(int16_t *)b = temp;
  } while (0);
}


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

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

LLVM IR (-O0):
define void @swap_int16(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
br label %6
6: ; preds = %2
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i32*
%9 = load i32, i32* %8
store i32 %9, i32* %5
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to i32*
%12 = load i32, i32* %11
%13 = load i8*, i8** %3
%14 = bitcast i8* %13 to i32*
store i32 %12, i32* %14
%15 = load i32, i32* %5
%16 = load i8*, i8** %4
%17 = bitcast i8* %16 to i32*
store i32 %15, i32* %17
br label %18
18: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @swap_int16(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
store i32 %6, i32* %3
store i32 %4, i32* %5
ret void
}
/* Type definitions */
struct ac_buffer {
  int dummy;
};
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
int _buffer_write_array(struct ac_buffer *, int /*<<< orphan*/ *, int, int);
int buffer_write_short_array(struct ac_buffer *buffer, int16_t *value,
                             int size) {
  return _buffer_write_array(buffer, value, size, sizeof(short));
}


x86 assembly (clang, -O0):
<buffer_write_short_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    $0x2,%ecx
call   1030 <_buffer_write_array@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buffer_write_short_array>:
mov    $0x2,%ecx
jmp    1030 <_buffer_write_array@plt>

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

LLVM IR (-O2):
%struct.ac_buffer = type { i32 }
define i32 @buffer_write_short_array(%struct.ac_buffer* %0, i32* %1, i32 %2) {
%4 = tail call i32 @_buffer_write_array(%struct.ac_buffer* %0, i32* %1, i32 %2, i32 2)
ret i32 %4
}
int dir_sep(char x) { return x == '/'; }


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

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

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

LLVM IR (-O2):
define i32 @dir_sep(i8 signext %0) {
%2 = icmp eq i8 %0, 47
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ memmove(char *, char *, int);
int write_buf(char *buf, int size, char *src, int len) {
  if (len > size)
    len = size;
  memmove(buf, src, len);
  return len;
}


x86 assembly (clang, -O0):
<write_buf>:
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    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1138 <write_buf+0x28>
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <memmove@plt>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_buf>:
push   %rbx
mov    %ecx,%ebx
cmp    %esi,%ecx
cmovg  %esi,%ebx
mov    %rdx,%rsi
mov    %ebx,%edx
call   1030 <memmove@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @write_buf(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = icmp sgt i32 %3, %1
%6 = select i1 %5, i32 %1, i32 %3
%7 = tail call i32 @memmove(i8* %0, i8* %2, i32 %6)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ bar(int);
void h(int i) { bar(1); }


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

x86 assembly (clang, -O2):
<h>:
mov    $0x1,%edi
jmp    1030 <bar@plt>

LLVM IR (-O0):
define void @h(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @bar(i32 1)
ret void
}

LLVM IR (-O2):
define void @h(i32 %0) {
%2 = tail call i32 @bar(i32 1)
ret void
}
/* Variables and functions */
int i2c_sendCommand2(int, char *, int, char *, int);
int i2c_sendCommand(int address, int cmd, char *response, int size) {
  char buf[1];
  buf[0] = cmd;
  return i2c_sendCommand2(address, buf, 1, response, size);
}


x86 assembly (clang, -O0):
<i2c_sendCommand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    %al,-0x15(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x15(%rbp),%rsi
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%r8d
mov    $0x1,%edx
call   1030 <i2c_sendCommand2@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_sendCommand>:
push   %rax
mov    %ecx,%r8d
mov    %rdx,%rcx
mov    %sil,0x7(%rsp)
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1030 <i2c_sendCommand2@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @i2c_sendCommand(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca [1 x i8]
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = load i32, i32* %6
%11 = trunc i32 %10 to i8
%12 = getelementptr inbounds [1 x i8], [1 x i8]* %9, i64 0, i64 0
store i8 %11, i8* %12
%13 = load i32, i32* %5
%14 = getelementptr inbounds [1 x i8], [1 x i8]* %9, i64 0, i64 0
%15 = load i8*, i8** %7
%16 = load i32, i32* %8
%17 = call i32 @i2c_sendCommand2(i32 %13, i8* %14, i32 1, i8* %15, i32 %16)
ret i32 %17
}

LLVM IR (-O2):
define i32 @i2c_sendCommand(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca [1 x i8]
%6 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
%7 = trunc i32 %1 to i8
store i8 %7, i8* %6
%8 = call i32 @i2c_sendCommand2(i32 %0, i8* %6, i32 1, i8* %2, i32 %3)
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
char *easy_printf_unknown_helper(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ write_message(char *, char *);
void write_error_var_unknown_helper(const char *message, va_list va) {
  char *msg = easy_printf_unknown_helper(message, va);
  write_message(msg, "[ERROR]");
  free(msg);
}


x86 assembly (clang, -O0):
<write_error_var_unknown_helper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <easy_printf_unknown_helper@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xea6(%rip),%rsi
call   1050 <write_message@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_error_var_unknown_helper>:
push   %rbx
call   1040 <easy_printf_unknown_helper@plt>
mov    %rax,%rbx
lea    0xec0(%rip),%rsi
mov    %rax,%rdi
call   1050 <write_message@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"[ERROR]\00"
define void @write_error_var_unknown_helper(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i8* @easy_printf_unknown_helper(i8* %6, i32 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = call i32 @write_message(i8* %9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%11 = load i8*, i8** %5
%12 = call i32 @free(i8* %11)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"[ERROR]\00"
define void @write_error_var_unknown_helper(i8* %0, i32 %1) {
%3 = tail call i8* @easy_printf_unknown_helper(i8* %0, i32 %1)
%4 = tail call i32 @write_message(i8* %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @free(i8* %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ gmvexit();
int /*<<< orphan*/ stderr;
void memerr() {
  fprintf(stderr, "Not enough memory to run this problem.\n");
  gmvexit();
}


x86 assembly (clang, -O0):
<memerr>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x0,%al
call   1040 <gmvexit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<memerr>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <gmvexit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [40 x i8] c"Not enough memory to run this problem.\0A\00"
define void @memerr() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @gmvexit()
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [40 x i8] c"Not enough memory to run this problem.\0A\00"
define void @memerr() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @gmvexit()
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
unsigned int bytestream_get_be24(const uint8_t **b) {
  (*b) += 3;
  return ((((const uint8_t *)(*b - 3))[0] << 16) |
          (((const uint8_t *)(*b - 3))[1] << 8) |
          ((const uint8_t *)(*b - 3))[2]);
}


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

x86 assembly (clang, -O2):
<bytestream_get_be24>:
mov    (%rdi),%rcx
lea    0xc(%rcx),%rax
mov    %rax,(%rdi)
mov    (%rcx),%edx
mov    0x4(%rcx),%eax
shl    $0x10,%edx
shl    $0x8,%eax
or     %edx,%eax
or     0x8(%rcx),%eax
ret

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

LLVM IR (-O2):
define i32 @bytestream_get_be24(i32** nocapture %0) {
%2 = load i32*, i32** %0
%3 = getelementptr inbounds i32, i32* %2, i64 3
store i32* %3, i32** %0
%4 = load i32, i32* %2
%5 = shl i32 %4, 16
%6 = getelementptr inbounds i32, i32* %2, i64 1
%7 = load i32, i32* %6
%8 = shl i32 %7, 8
%9 = or i32 %8, %5
%10 = getelementptr inbounds i32, i32* %2, i64 2
%11 = load i32, i32* %10
%12 = or i32 %9, %11
ret i32 %12
}
int get_screen_offset(int row, int col) {
  int screen_offset;
  screen_offset = ((row * 80) + col) * 2;
  return screen_offset;
}


x86 assembly (clang, -O0):
<get_screen_offset>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
imul   $0x50,-0x4(%rbp),%eax
add    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_screen_offset>:
lea    (%rdi,%rdi,4),%eax
shl    $0x4,%eax
add    %esi,%eax
add    %eax,%eax
ret

LLVM IR (-O0):
define i32 @get_screen_offset(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = mul nsw i32 %6, 80
%8 = load i32, i32* %4
%9 = add nsw i32 %7, %8
%10 = mul nsw i32 %9, 2
store i32 %10, i32* %5
%11 = load i32, i32* %5
ret i32 %11
}

LLVM IR (-O2):
define i32 @get_screen_offset(i32 %0, i32 %1) {
%3 = mul nsw i32 %0, 80
%4 = add nsw i32 %3, %1
%5 = shl nsw i32 %4, 1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ strlcpy(char *, char const *, size_t);
int strlen(char const *);
char *xmalloc(size_t);
char *xstrdup(const char *s) {
  char *ptr;
  size_t len;
  len = strlen(s) + 1;
  ptr = xmalloc(len);
  strlcpy(ptr, s, len);
  return (ptr);
}


x86 assembly (clang, -O0):
<xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <xmalloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <strlcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrdup>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
add    $0x1,%eax
movslq %eax,%r15
mov    %r15,%rdi
call   1040 <xmalloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <strlcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @xstrdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
%7 = add nsw i32 %6, 1
%8 = sext i32 %7 to i64
store i64 %8, i64* %4
%9 = load i64, i64* %4
%10 = call i8* @xmalloc(i64 %9)
store i8* %10, i8** %3
%11 = load i8*, i8** %3
%12 = load i8*, i8** %2
%13 = load i64, i64* %4
%14 = call i32 @strlcpy(i8* %11, i8* %12, i64 %13)
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
define i8* @xstrdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = sext i32 %3 to i64
%5 = tail call i8* @xmalloc(i64 %4)
%6 = tail call i32 @strlcpy(i8* %5, i8* %0, i64 %4)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
void usage(char *progname) {
  printf("usage : %s xml_file\n", progname);
  exit(0);
}


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

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

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

LLVM IR (-O2):
@.str = [21 x i8] c"usage : %s xml_file\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 0)
unreachable
}
conv(s) char *s;
{
  int d, n;
  n = 0;
  for (;;) {
    d = *s++ - '0';
    if (0 > d || d > 9)
      break;
    n = n * 10 + d;
  }
  return (n);
}


x86 assembly (clang, -O0):
<conv>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
sub    $0x30,%eax
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
cmp    -0xc(%rbp),%eax
jg     113c <conv+0x3c>
cmpl   $0x9,-0xc(%rbp)
jle    1141 <conv+0x41>
jmp    1150 <conv+0x50>
imul   $0xa,-0x10(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    110f <conv+0xf>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<conv>:
mov    (%rdi),%cl
lea    -0x3a(%rcx),%edx
xor    %eax,%eax
cmp    $0xf6,%dl
jb     113b <conv+0x3b>
add    $0x1,%rdi
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl %cl,%ecx
lea    (%rax,%rax,4),%eax
lea    (%rcx,%rax,2),%eax
add    $0xffffffd0,%eax
movzbl (%rdi),%ecx
lea    -0x3a(%rcx),%edx
add    $0x1,%rdi
cmp    $0xf5,%dl
ja     1120 <conv+0x20>
ret

LLVM IR (-O0):
define i32 @conv(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %4
br label %5
5: ; preds = %17, %1
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i32 1
store i8* %7, i8** %2
%8 = load i8, i8* %6
%9 = sext i8 %8 to i32
%10 = sub nsw i32 %9, 48
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = icmp sgt i32 0, %11
br i1 %12, label %16, label %13
13: ; preds = %5
%14 = load i32, i32* %3
%15 = icmp sgt i32 %14, 9
br i1 %15, label %16, label %17
16: ; preds = %13, %5
br label %22
17: ; preds = %13
%18 = load i32, i32* %4
%19 = mul nsw i32 %18, 10
%20 = load i32, i32* %3
%21 = add nsw i32 %19, %20
store i32 %21, i32* %4
br label %5
22: ; preds = %16
%23 = load i32, i32* %4
ret i32 %23
}

LLVM IR (-O2):
define i32 @conv(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = add i8 %2, -58
%4 = icmp ult i8 %3, -10
br i1 %4, label %17, label %5
5: ; preds = %1, %5
%6 = phi i8 [ %14, %5 ], [ %2, %1 ]
%7 = phi i32 [ %13, %5 ], [ 0, %1 ]
%8 = phi i8* [ %10, %5 ], [ %0, %1 ]
%9 = zext i8 %6 to i32
%10 = getelementptr inbounds i8, i8* %8, i64 1
%11 = mul nsw i32 %7, 10
%12 = add i32 %11, -48
%13 = add i32 %12, %9
%14 = load i8, i8* %10
%15 = add i8 %14, -58
%16 = icmp ult i8 %15, -10
br i1 %16, label %17, label %5
17: ; preds = %5, %1
%18 = phi i32 [ 0, %1 ], [ %13, %5 ]
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ ft_putstr(char const *);
int /*<<< orphan*/ write(int, char *, int);
void ft_putendl(const char *s) {
  ft_putstr(s);
  write(1, "\n", 1);
}


x86 assembly (clang, -O0):
<ft_putendl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <ft_putstr@plt>
mov    $0x1,%edx
lea    0xebf(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putendl>:
push   %rax
call   1040 <ft_putstr@plt>
lea    0xed3(%rip),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
pop    %rax
jmp    1030 <write@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define void @ft_putendl(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @ft_putstr(i8* %3)
%5 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
define void @ft_putendl(i8* %0) {
%2 = tail call i32 @ft_putstr(i8* %0)
%3 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}
/* Variables and functions */
scalar_t__ strtod(char const *, char **);
long double strtold(const char *nptr, char **endptr) {
  return (long double)strtod(nptr, endptr);
}


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

x86 assembly (clang, -O2):
<strtold>:
push   %rax
call   1030 <strtod@plt>
mov    %rax,(%rsp)
fildll (%rsp)
pop    %rax
ret

LLVM IR (-O0):
define x86_fp80 @strtold(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
store i8* %0, i8** %3
store i8** %1, i8*** %4
%5 = load i8*, i8** %3
%6 = load i8**, i8*** %4
%7 = call i64 @strtod(i8* %5, i8** %6)
%8 = sitofp i64 %7 to x86_fp80
ret x86_fp80 %8
}

LLVM IR (-O2):
define x86_fp80 @strtold(i8* %0, i8** nocapture %1) {
%3 = tail call i64 @strtod(i8* %0, i8** %1)
%4 = sitofp i64 %3 to x86_fp80
ret x86_fp80 %4
}
/* Variables and functions */
int /*<<< orphan*/ arg_ulonglong3(unsigned long long, unsigned long long,
                                  unsigned long long);
void arg_ulonglong2(unsigned long long a, unsigned long long b) {
  arg_ulonglong3(a, b, b + 1);
}


x86 assembly (clang, -O0):
<arg_ulonglong2>:
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    -0x10(%rbp),%rdx
add    $0x1,%rdx
call   1030 <arg_ulonglong3@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arg_ulonglong2>:
lea    0x1(%rsi),%rdx
jmp    1030 <arg_ulonglong3@plt>

LLVM IR (-O0):
define void @arg_ulonglong2(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = load i64, i64* %4
%8 = add i64 %7, 1
%9 = call i32 @arg_ulonglong3(i64 %5, i64 %6, i64 %8)
ret void
}

LLVM IR (-O2):
define void @arg_ulonglong2(i64 %0, i64 %1) {
%3 = add i64 %1, 1
%4 = tail call i32 @arg_ulonglong3(i64 %0, i64 %1, i64 %3)
ret void
}
/* Type definitions */
typedef scalar_t__ uint8_t;

/* Variables and functions */
void increment256(uint8_t val[32]) {
  int i;
  for (i = 31; i >= 0; i--) {
    val[i]++;
    if (val[i] != 0)
      return;
  }
}


x86 assembly (clang, -O0):
<increment256>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x1f,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1158 <increment256+0x58>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
add    $0x1,%rdx
mov    %rdx,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1145 <increment256+0x45>
jmp    1158 <increment256+0x58>
jmp    114a <increment256+0x4a>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <increment256+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<increment256>:
mov    $0x1f,%eax
cs nopw 0x0(%rax,%rax,1)
nop
mov    %eax,%edx
sub    $0x1,%eax
setb   %cl
addq   $0x1,(%rdi,%rdx,8)
jne    1123 <increment256+0x23>
test   %cl,%cl
je     1110 <increment256+0x10>
ret

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

LLVM IR (-O2):
define void @increment256(i64* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 31, %1 ], [ %9, %2 ]
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds i64, i64* %0, i64 %4
%6 = load i64, i64* %5
%7 = add nsw i64 %6, 1
store i64 %7, i64* %5
%8 = icmp ne i64 %7, 0
%9 = add nsw i32 %3, -1
%10 = icmp eq i32 %3, 0
%11 = select i1 %8, i1 true, i1 %10
br i1 %11, label %12, label %2
12: ; preds = %2
ret void
}
int main(int argc, char *argv[]) {
  int a = 0;
  int i = 0;
  int c = 0;
  while (i < 10) {
    i++;
    a++;
  }
  c = i;
  if (a < 10) {
  ERROR:
    goto ERROR;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0xa,-0x18(%rbp)
jge    1148 <main+0x48>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <main+0x27>
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    1162 <main+0x62>
jmp    115d <main+0x5d>
jmp    115d <main+0x5d>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ cc();
main() { cc(); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @cc()
ret i32 0
}
/* Variables and functions */
scalar_t__ strncasecmp(char *, char *, int);
int parse_encoding(char *p) { return strncasecmp(p, "native", 6) == 0; }


x86 assembly (clang, -O0):
<parse_encoding>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncasecmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_encoding>:
push   %rax
lea    0xee8(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncasecmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"native\00"
define i32 @parse_encoding(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strncasecmp(i8* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 6)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
@.str = [7 x i8] c"native\00"
define i32 @parse_encoding(i8* nocapture %0) {
%2 = tail call i64 @strncasecmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 6)
%3 = icmp eq i64 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(long);
long C_exit_runtime(long code) {
  exit(((code) >> 1));
  return 0;
}


x86 assembly (clang, -O0):
<C_exit_runtime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
sar    $0x1,%rdi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<C_exit_runtime>:
push   %rax
sar    %rdi
call   1030 <exit@plt>

LLVM IR (-O0):
define i64 @C_exit_runtime(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 1
%5 = call i32 @exit(i64 %4)
unreachable
}

LLVM IR (-O2):
define i64 @C_exit_runtime(i64 %0) {
%2 = ashr i64 %0, 1
%3 = tail call i32 @exit(i64 %2)
unreachable
}
/* Variables and functions */
int aindex(char const **, char const **, int);
int weekday(char const **str) {
  static char const *days[] = {"sun", "mon", "tue", "wed",
                               "thu", "fri", "sat", NULL};
  return aindex(days, str, 3);
}


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

x86 assembly (clang, -O2):
<weekday>:
mov    %rdi,%rsi
lea    0x2f16(%rip),%rdi
mov    $0x3,%edx
jmp    1030 <aindex@plt>

LLVM IR (-O0):
@weekday.days = internal global [8 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i32 0, i32 0), i8* null]
@.str = [4 x i8] c"sun\00"
@.str.1 = [4 x i8] c"mon\00"
@.str.2 = [4 x i8] c"tue\00"
@.str.3 = [4 x i8] c"wed\00"
@.str.4 = [4 x i8] c"thu\00"
@.str.5 = [4 x i8] c"fri\00"
@.str.6 = [4 x i8] c"sat\00"
define i32 @weekday(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = call i32 @aindex(i8** getelementptr inbounds ([8 x i8*], [8 x i8*]* @weekday.days, i64 0, i64 0), i8** %3, i32 3)
ret i32 %4
}

LLVM IR (-O2):
@weekday.days = internal global [8 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i32 0, i32 0), i8* null]
@.str = [4 x i8] c"sun\00"
@.str.1 = [4 x i8] c"mon\00"
@.str.2 = [4 x i8] c"tue\00"
@.str.3 = [4 x i8] c"wed\00"
@.str.4 = [4 x i8] c"thu\00"
@.str.5 = [4 x i8] c"fri\00"
@.str.6 = [4 x i8] c"sat\00"
define i32 @weekday(i8** %0) {
%2 = tail call i32 @aindex(i8** getelementptr inbounds ([8 x i8*], [8 x i8*]* @weekday.days, i64 0, i64 0), i8** %0, i32 3)
ret i32 %2
}
int test_imm_86uint16_reg(unsigned short val) {
  return ((val) & (-0x86 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_86uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -134
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ callee();
int main(void) {
  callee();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @callee()
ret i32 0
}
int cmp_great_fp64(const void *p, const void *q) {
  const double a = *(const double *)p;
  const double b = *(const double *)q;
  if (b > a)
    return +1;
  if (a > b)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<cmp_great_fp64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1142 <cmp_great_fp64+0x42>
movl   $0x1,-0x4(%rbp)
jmp    1165 <cmp_great_fp64+0x65>
movsd  -0x20(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    115e <cmp_great_fp64+0x5e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1165 <cmp_great_fp64+0x65>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_great_fp64>:
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
xor    %ecx,%ecx
ucomisd %xmm1,%xmm0
seta   %cl
neg    %ecx
ucomisd %xmm0,%xmm1
mov    $0x1,%eax
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
define i32 @cmp_great_fp64(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca double
%7 = alloca double
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to double*
%10 = load double, double* %9
store double %10, double* %6
%11 = load i8*, i8** %5
%12 = bitcast i8* %11 to double*
%13 = load double, double* %12
store double %13, double* %7
%14 = load double, double* %7
%15 = load double, double* %6
%16 = fcmp ogt double %14, %15
br i1 %16, label %17, label %18
17: ; preds = %2
store i32 1, i32* %3
br label %24
18: ; preds = %2
%19 = load double, double* %6
%20 = load double, double* %7
%21 = fcmp ogt double %19, %20
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 -1, i32* %3
br label %24
23: ; preds = %18
store i32 0, i32* %3
br label %24
24: ; preds = %23, %22, %17
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @cmp_great_fp64(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = load double, double* %3
%5 = bitcast i8* %1 to double*
%6 = load double, double* %5
%7 = fcmp ogt double %6, %4
%8 = fcmp ogt double %4, %6
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint32_t ibv_inc_rkey(uint32_t rkey) {
  const uint32_t mask = 0x000000ff;
  uint8_t newtag = (uint8_t)((rkey + 1) & mask);
  return (rkey & ~mask) | newtag;
}


x86 assembly (clang, -O0):
<ibv_inc_rkey>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0xff,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
and    $0xff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffffff00,%eax
or     -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ibv_inc_rkey>:
lea    0x1(%rdi),%eax
movzbl %al,%eax
and    $0xffffff00,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @ibv_inc_rkey(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 255, i32* %3
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 1
%7 = and i32 %6, 255
store i32 %7, i32* %4
%8 = load i32, i32* %2
%9 = and i32 %8, -256
%10 = load i32, i32* %4
%11 = or i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @ibv_inc_rkey(i32 %0) {
%2 = add nsw i32 %0, 1
%3 = and i32 %2, 255
%4 = and i32 %0, -256
%5 = or i32 %3, %4
ret i32 %5
}
long long fll(long long a, long long b) {
  a = (a & ~(0xfffffull << 0)) | ((b << 0) & (0xfffffull << 0));
  return a;
}


x86 assembly (clang, -O0):
<fll>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
and    $0xfffffffffff00000,%rax
mov    -0x10(%rbp),%rcx
shl    $0x0,%rcx
and    $0xfffff,%rcx
or     %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fll>:
and    $0xfffffffffff00000,%rdi
and    $0xfffff,%esi
lea    (%rsi,%rdi,1),%rax
ret

LLVM IR (-O0):
define i64 @fll(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = and i64 %5, -1048576
%7 = load i64, i64* %4
%8 = shl i64 %7, 0
%9 = and i64 %8, 1048575
%10 = or i64 %6, %9
store i64 %10, i64* %3
%11 = load i64, i64* %3
ret i64 %11
}

LLVM IR (-O2):
define i64 @fll(i64 %0, i64 %1) {
%3 = and i64 %0, -1048576
%4 = and i64 %1, 1048575
%5 = or i64 %4, %3
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void foo(void) { printf("Look, I am function foo in library foo!!\n"); }


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

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

LLVM IR (-O0):
@.str = [42 x i8] c"Look, I am function foo in library foo!!\0A\00"
define void @foo() {
%1 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [41 x i8] c"Look, I am function foo in library foo!!\00"
define void @foo() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int sumSquares;
  int squareSums;
  int diff;
  int i;
  for (i = 1; i <= 100; i++) {
    sumSquares += (i * i);
    squareSums += i;
  }
  diff = (squareSums * squareSums) - sumSquares;
  printf("%d\n", diff);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jg     1154 <main+0x44>
mov    -0x14(%rbp),%eax
imul   -0x14(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <main+0x16>
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %5
br label %6
6: ; preds = %18, %0
%7 = load i32, i32* %5
%8 = icmp sle i32 %7, 100
br i1 %8, label %9, label %21
9: ; preds = %6
%10 = load i32, i32* %5
%11 = load i32, i32* %5
%12 = mul nsw i32 %10, %11
%13 = load i32, i32* %2
%14 = add nsw i32 %13, %12
store i32 %14, i32* %2
%15 = load i32, i32* %5
%16 = load i32, i32* %3
%17 = add nsw i32 %16, %15
store i32 %17, i32* %3
br label %18
18: ; preds = %9
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %6
21: ; preds = %6
%22 = load i32, i32* %3
%23 = load i32, i32* %3
%24 = mul nsw i32 %22, %23
%25 = load i32, i32* %2
%26 = sub nsw i32 %24, %25
store i32 %26, i32* %4
%27 = load i32, i32* %4
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %27)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 undef)
ret i32 0
}
/* Variables and functions */
int solve_degree_1(double const *, double *);
int polynomial_solve_degree_1(const double *c, double *x) {
  return solve_degree_1(c, x);
}


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

x86 assembly (clang, -O2):
<polynomial_solve_degree_1>:
jmp    1030 <solve_degree_1@plt>

LLVM IR (-O0):
define i32 @polynomial_solve_degree_1(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 @solve_degree_1(double* %5, double* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @polynomial_solve_degree_1(double* %0, double* %1) {
%3 = tail call i32 @solve_degree_1(double* %0, double* %1)
ret i32 %3
}
void test_28_2(int *mem) { __atomic_and_fetch(mem, 1, 4); }


x86 assembly (clang, -O0):
<test_28_2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    %ecx,-0x18(%rbp)
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%esi
mov    %eax,%edx
and    %esi,%edx
lock cmpxchg %edx,(%rcx)
sete   %cl
mov    %eax,-0x24(%rbp)
test   $0x1,%cl
mov    %eax,-0x14(%rbp)
jne    114b <test_28_2+0x4b>
jmp    1122 <test_28_2+0x22>
mov    -0x18(%rbp),%ecx
mov    -0x24(%rbp),%eax
and    %ecx,%eax
mov    %eax,-0x10(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_28_2>:
lock andl $0x1,(%rdi)
ret

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

LLVM IR (-O2):
define void @test_28_2(i32* nocapture %0) {
%2 = atomicrmw and i32* %0, i32 1 acq_rel
ret void
}
int dh_memcmp(char *a, char *b, int n) {
  int c = 0;
  while (c < n) {
    if (*a != *b)
      return c + 1;
    a++;
    b++;
    c++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<dh_memcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    116c <dh_memcmp+0x6c>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1146 <dh_memcmp+0x46>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1173 <dh_memcmp+0x73>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1116 <dh_memcmp+0x16>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dh_memcmp>:
test   %edx,%edx
jle    1121 <dh_memcmp+0x21>
mov    %edx,%ecx
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
movzbl (%rdi,%rax,1),%edx
cmp    (%rsi,%rax,1),%dl
jne    1124 <dh_memcmp+0x24>
add    $0x1,%rax
cmp    %eax,%ecx
jne    1110 <dh_memcmp+0x10>
xor    %eax,%eax
ret
add    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @dh_memcmp(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %19
5: ; preds = %3, %14
%6 = phi i32 [ %17, %14 ], [ 0, %3 ]
%7 = phi i8* [ %16, %14 ], [ %1, %3 ]
%8 = phi i8* [ %15, %14 ], [ %0, %3 ]
%9 = load i8, i8* %8
%10 = load i8, i8* %7
%11 = icmp eq i8 %9, %10
br i1 %11, label %14, label %12
12: ; preds = %5
%13 = add nuw nsw i32 %6, 1
br label %19
14: ; preds = %5
%15 = getelementptr inbounds i8, i8* %8, i64 1
%16 = getelementptr inbounds i8, i8* %7, i64 1
%17 = add nuw nsw i32 %6, 1
%18 = icmp eq i32 %17, %2
br i1 %18, label %19, label %5
19: ; preds = %14, %3, %12
%20 = phi i32 [ %13, %12 ], [ 0, %3 ], [ 0, %14 ]
ret i32 %20
}
int pmi_simple_client_unpublish_name(struct pmi_simple_client *pmi,
                                     const char *service_name) {
  return -1;
}


x86 assembly (clang, -O0):
<pmi_simple_client_unpublish_name>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.pmi_simple_client = type opaque
define i32 @pmi_simple_client_unpublish_name(%struct.pmi_simple_client* %0, i8* %1) {
%3 = alloca %struct.pmi_simple_client*
%4 = alloca i8*
store %struct.pmi_simple_client* %0, %struct.pmi_simple_client** %3
store i8* %1, i8** %4
ret i32 -1
}

LLVM IR (-O2):
%struct.pmi_simple_client = type opaque
define i32 @pmi_simple_client_unpublish_name(%struct.pmi_simple_client* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 -1
}