xunge/DecIR huggingface dataset:
extern volatile smp_unlock(void *addr) { *((unsigned char *)addr) = 0; }


x86 assembly (clang, -O0):
<smp_unlock>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<smp_unlock>:
movb   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
define i32 @smp_unlock(i8* nocapture writeonly %0) {
store i8 0, i8* %0
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ UPnPResponse_ContentDirectory_DestroyObject(void *);
int /*<<< orphan*/ printf(char *, char *);
void UPnPContentDirectory_DestroyObject(void *upnptoken, char *ObjectID) {
  printf("Invoke: UPnPContentDirectory_DestroyObject(%s);\r\n", ObjectID);
  UPnPResponse_ContentDirectory_DestroyObject(upnptoken);
}


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

x86 assembly (clang, -O2):
<UPnPContentDirectory_DestroyObject>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <UPnPResponse_ContentDirectory_DestroyObject@plt>

LLVM IR (-O0):
@.str = [50 x i8] c"Invoke: UPnPContentDirectory_DestroyObject(%s);\0D\0A\00"
define void @UPnPContentDirectory_DestroyObject(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i8*, i8** %3
%8 = call i32 @UPnPResponse_ContentDirectory_DestroyObject(i8* %7)
ret void
}

LLVM IR (-O2):
@.str = [50 x i8] c"Invoke: UPnPContentDirectory_DestroyObject(%s);\0D\0A\00"
define void @UPnPContentDirectory_DestroyObject(i8* %0, i8* %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %1)
%4 = tail call i32 @UPnPResponse_ContentDirectory_DestroyObject(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void main() {
  char str[10] = "我";
  printf("%s\n", str);
  printf("%c%c%c%c\n", str[0], str[1], str[2], str[3]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0xa(%rbp)
mov    0xede(%rip),%ax
mov    %ax,-0x2(%rbp)
lea    -0xa(%rbp),%rsi
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0xa(%rbp),%esi
movsbl -0x9(%rbp),%edx
movsbl -0x8(%rbp),%ecx
movsbl -0x7(%rbp),%r8d
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movw   $0x0,0x10(%rsp)
movq   $0x9188e6,0x8(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <puts@plt>
lea    0xec5(%rip),%rdi
mov    $0xffffffe6,%esi
mov    $0xffffff88,%edx
mov    $0xffffff91,%ecx
xor    %r8d,%r8d
xor    %eax,%eax
add    $0x18,%rsp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@__const.main.str = [10 x i8] c"\E6\88\91\00\00\00\00\00\00\00"
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [10 x i8] c"%c%c%c%c\0A\00"
define void @main() {
%1 = alloca [10 x i8]
%2 = bitcast [10 x i8]* %1 to i8*
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 1
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 2
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 3
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %7, i32 %10, i32 %13, i32 %16)
ret void
}

LLVM IR (-O2):
@__const.main.str = [10 x i8] c"\E6\88\91\00\00\00\00\00\00\00"
@.str.1 = [10 x i8] c"%c%c%c%c\0A\00"
define void @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = call i32 @puts(i8* %2)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 -26, i32 -120, i32 -111, i32 0)
ret void
}
int check_fun(int a, int b) { return a < b; }


x86 assembly (clang, -O0):
<check_fun>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_fun>:
xor    %eax,%eax
cmp    %esi,%edi
setl   %al
ret

LLVM IR (-O0):
define i32 @check_fun(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp slt i32 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @check_fun(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int bit_count(int /*<<< orphan*/);
int /*<<< orphan*/ get_moves(unsigned long long const,
                             unsigned long long const);
int get_mobility(const unsigned long long P, const unsigned long long O) {
  return bit_count(get_moves(P, O));
}


x86 assembly (clang, -O0):
<get_mobility>:
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 <get_moves@plt>
mov    %eax,%edi
call   1040 <bit_count@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_mobility>:
push   %rax
call   1030 <get_moves@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <bit_count@plt>

LLVM IR (-O0):
define i32 @get_mobility(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 = call i32 @get_moves(i64 %5, i64 %6)
%8 = call i32 @bit_count(i32 %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @get_mobility(i64 %0, i64 %1) {
%3 = tail call i32 @get_moves(i64 %0, i64 %1)
%4 = tail call i32 @bit_count(i32 %3)
ret i32 %4
}
/* Variables and functions */
float __ocml_log10_f32(float);
float log10f(float x) { return __ocml_log10_f32(x); }


x86 assembly (clang, -O0):
<log10f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <__ocml_log10_f32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log10f>:
jmp    1030 <__ocml_log10_f32@plt>

LLVM IR (-O0):
define float @log10f(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @__ocml_log10_f32(float %3)
ret float %4
}

LLVM IR (-O2):
define float @log10f(float %0) {
%2 = tail call float @__ocml_log10_f32(float %0)
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
int path_exists(char *);
int path_exists_free(char *path) {
  int ret = path_exists(path);
  free(path);
  return ret;
}


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

x86 assembly (clang, -O2):
<path_exists_free>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <path_exists@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @path_exists_free(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @path_exists(i8* %4)
store i32 %5, i32* %3
%6 = load i8*, i8** %2
%7 = call i32 @free(i8* %6)
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
define i32 @path_exists_free(i8* %0) {
%2 = tail call i32 @path_exists(i8* %0)
%3 = tail call i32 @free(i8* %0)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fputc(short, int /*<<< orphan*/ *);
void writeInt16(FILE *f, short d) {
  fputc(d & 255, f);
  fputc((d >> 8) & 255, f);
}


x86 assembly (clang, -O0):
<writeInt16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
movswl -0xa(%rbp),%eax
and    $0xff,%eax
mov    -0x8(%rbp),%rsi
movswl %ax,%edi
call   1030 <fputc@plt>
movswl -0xa(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    -0x8(%rbp),%rsi
movswl %ax,%edi
call   1030 <fputc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeInt16>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
movzbl %bl,%edi
mov    %r14,%rsi
call   1030 <fputc@plt>
movzbl %bh,%edi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fputc@plt>

LLVM IR (-O0):
define void @writeInt16(i32* %0, i16 signext %1) {
%3 = alloca i32*
%4 = alloca i16
store i32* %0, i32** %3
store i16 %1, i16* %4
%5 = load i16, i16* %4
%6 = sext i16 %5 to i32
%7 = and i32 %6, 255
%8 = trunc i32 %7 to i16
%9 = load i32*, i32** %3
%10 = call i32 @fputc(i16 signext %8, i32* %9)
%11 = load i16, i16* %4
%12 = sext i16 %11 to i32
%13 = ashr i32 %12, 8
%14 = and i32 %13, 255
%15 = trunc i32 %14 to i16
%16 = load i32*, i32** %3
%17 = call i32 @fputc(i16 signext %15, i32* %16)
ret void
}

LLVM IR (-O2):
define void @writeInt16(i32* nocapture %0, i16 signext %1) {
%3 = and i16 %1, 255
%4 = tail call i32 @fputc(i16 signext %3, i32* %0)
%5 = lshr i16 %1, 8
%6 = tail call i32 @fputc(i16 signext %5, i32* %0)
ret void
}
/* Type definitions */
typedef scalar_t__ ulong;

/* Variables and functions */
ulong id(ulong x) { return x - 1; }


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

x86 assembly (clang, -O2):
<id>:
lea    -0x1(%rdi),%rax
ret

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

LLVM IR (-O2):
define i64 @id(i64 %0) {
%2 = add nsw i64 %0, -1
ret i64 %2
}
int fetch_quickparse(const char *url) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @fetch_quickparse(i8* nocapture readnone %0) {
ret i32 0
}
void Flash_Create(void) {}


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

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

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

LLVM IR (-O2):
define void @Flash_Create() {
ret void
}
void foo138(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo138(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void show_usage(void) {
  fprintf(stderr, "Usage:\n");
  fprintf(stderr, "chromakey mattefile file0 file1 [matteR matteG matteB]\n");
  fprintf(stderr, "chromakey mattefileAndfile0 file1 [matteR matteG matteB]\n");
}


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

x86 assembly (clang, -O2):
<show_usage>:
push   %rbx
mov    0x2ec8(%rip),%rbx
mov    (%rbx),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xed9(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf03(%rip),%rsi
pop    %rbx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [8 x i8] c"Usage:\0A\00"
@.str.1 = [56 x i8] c"chromakey mattefile file0 file1 [matteR matteG matteB]\0A\00"
@.str.2 = [58 x i8] c"chromakey mattefileAndfile0 file1 [matteR matteG matteB]\0A\00"
define void @show_usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [8 x i8] c"Usage:\0A\00"
@.str.1 = [56 x i8] c"chromakey mattefile file0 file1 [matteR matteG matteB]\0A\00"
@.str.2 = [58 x i8] c"chromakey mattefileAndfile0 file1 [matteR matteG matteB]\0A\00"
define void @show_usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0))
ret void
}
int test_imm_87int16_mem(short *val) {
  return ((*val) & (-0x87 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_87int16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = and i32 %5, -135
%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_87int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -135
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int DefaultParamsOverload() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @DefaultParamsOverload() {
ret i32 0
}
int useless_function_to_ensure_darwin_compiles(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @useless_function_to_ensure_darwin_compiles() {
ret i32 0
}
double abs_float(double f) {
  if (f < 0.0)
    return -f;
  else
    return f;
}


x86 assembly (clang, -O0):
<abs_float>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    113d <abs_float+0x3d>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1147 <abs_float+0x47>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<abs_float>:
movapd 0xef8(%rip),%xmm2
xorpd  %xmm0,%xmm2
xorpd  %xmm3,%xmm3
movapd %xmm0,%xmm1
cmpltsd %xmm3,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
orpd   %xmm2,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @abs_float(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp olt double %4, 0.000000e+00
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load double, double* %3
%8 = fneg double %7
store double %8, double* %2
br label %11
9: ; preds = %1
%10 = load double, double* %3
store double %10, double* %2
br label %11
11: ; preds = %9, %6
%12 = load double, double* %2
ret double %12
}

LLVM IR (-O2):
define double @abs_float(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = fneg double %0
%4 = select i1 %2, double %3, double %0
ret double %4
}
double zs_to_p(double zs) { return zs; }


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

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

LLVM IR (-O0):
define double @zs_to_p(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
ret double %3
}

LLVM IR (-O2):
define double @zs_to_p(double returned %0) {
ret double %0
}
/* Variables and functions */
int /*<<< orphan*/ ceil(int);
int log(int);
unsigned int pow(int, int /*<<< orphan*/);
unsigned int next_power_of_two1(unsigned int n) {
  return pow(2, ceil(log(n) / log(2)));
}


x86 assembly (clang, -O0):
<next_power_of_two1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <log@plt>
mov    %eax,-0x8(%rbp)
mov    $0x2,%edi
call   1040 <log@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <ceil@plt>
mov    %eax,%esi
mov    $0x2,%edi
call   1050 <pow@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_power_of_two1>:
push   %rbx
call   1040 <log@plt>
mov    %eax,%ebx
mov    $0x2,%edi
call   1040 <log@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <ceil@plt>
mov    $0x2,%edi
mov    %eax,%esi
pop    %rbx
jmp    1050 <pow@plt>

LLVM IR (-O0):
define i32 @next_power_of_two1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @log(i32 %3)
%5 = call i32 @log(i32 2)
%6 = sdiv i32 %4, %5
%7 = call i32 @ceil(i32 %6)
%8 = call i32 @pow(i32 2, i32 %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @next_power_of_two1(i32 %0) {
%2 = tail call i32 @log(i32 %0)
%3 = tail call i32 @log(i32 2)
%4 = sdiv i32 %2, %3
%5 = tail call i32 @ceil(i32 %4)
%6 = tail call i32 @pow(i32 2, i32 %5)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ set_cursor_bda(unsigned char, unsigned char);
int /*<<< orphan*/ set_cursor_scan_end(unsigned char);
int /*<<< orphan*/ set_cursor_scan_start(unsigned char);
void __attribute__((no))
__set_cursor_shape(unsigned char scan_start, unsigned char scan_end) {
  set_cursor_scan_end(scan_end);
  set_cursor_scan_start(scan_start);
  set_cursor_bda(scan_start, scan_end);
}


x86 assembly (clang, -O0):
<__set_cursor_shape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movzbl -0x2(%rbp),%edi
call   1030 <set_cursor_scan_end@plt>
movzbl -0x1(%rbp),%edi
call   1040 <set_cursor_scan_start@plt>
mov    -0x1(%rbp),%al
movzbl %al,%edi
movzbl -0x2(%rbp),%esi
call   1050 <set_cursor_bda@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__set_cursor_shape>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    %esi,%edi
call   1030 <set_cursor_scan_end@plt>
mov    %ebp,%edi
call   1040 <set_cursor_scan_start@plt>
mov    %ebp,%edi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <set_cursor_bda@plt>

LLVM IR (-O0):
define void @__set_cursor_shape(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = call i32 @set_cursor_scan_end(i8 zeroext %5)
%7 = load i8, i8* %3
%8 = call i32 @set_cursor_scan_start(i8 zeroext %7)
%9 = load i8, i8* %3
%10 = load i8, i8* %4
%11 = call i32 @set_cursor_bda(i8 zeroext %9, i8 zeroext %10)
ret void
}

LLVM IR (-O2):
define void @__set_cursor_shape(i8 zeroext %0, i8 zeroext %1) {
%3 = tail call i32 @set_cursor_scan_end(i8 zeroext %1)
%4 = tail call i32 @set_cursor_scan_start(i8 zeroext %0)
%5 = tail call i32 @set_cursor_bda(i8 zeroext %0, i8 zeroext %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ *lookup(char const *);
int proc_cache_lookup(const char *url) { return lookup(url) != NULL; }


x86 assembly (clang, -O0):
<proc_cache_lookup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <lookup@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<proc_cache_lookup>:
push   %rax
call   1030 <lookup@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @proc_cache_lookup(i8* %0) {
%2 = tail call i32* @lookup(i8* %0)
%3 = icmp ne i32* %2, null
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
char const *getenv(char *);
const char *IoTHubAccount_GetEventhubConsumerGroup(void) {
  return getenv("IOTHUB_EVENTHUB_CONSUMER_GROUP");
}


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

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

LLVM IR (-O0):
@.str = [31 x i8] c"IOTHUB_EVENTHUB_CONSUMER_GROUP\00"
define i8* @IoTHubAccount_GetEventhubConsumerGroup() {
%1 = call i8* @getenv(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}

LLVM IR (-O2):
@.str = [31 x i8] c"IOTHUB_EVENTHUB_CONSUMER_GROUP\00"
define i8* @IoTHubAccount_GetEventhubConsumerGroup() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}
scomp(a, b, s) register a, b;
register char s;
{
  if (s == '+')
    return (a > b);
  if (s == '-')
    return (a < (b * -1));
  return (a == b);
}


x86 assembly (clang, -O0):
<scomp>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
movsbl -0xd(%rbp),%eax
cmp    $0x2b,%eax
jne    1132 <scomp+0x32>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1169 <scomp+0x69>
movsbl -0xd(%rbp),%eax
cmp    $0x2d,%eax
jne    1158 <scomp+0x58>
mov    -0x8(%rbp),%eax
imul   $0xffffffff,-0xc(%rbp),%ecx
cmp    %ecx,%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1169 <scomp+0x69>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<scomp>:
shl    $0x18,%edx
cmp    $0x2d000000,%edx
je     1117 <scomp+0x17>
cmp    $0x2b000000,%edx
jne    1122 <scomp+0x22>
cmp    %esi,%edi
jmp    111b <scomp+0x1b>
neg    %esi
cmp    %edi,%esi
setg   %al
movzbl %al,%eax
ret
cmp    %esi,%edi
sete   %al
movzbl %al,%eax
ret

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

LLVM IR (-O2):
define i32 @scomp(i32 %0, i32 %1, i32 %2) {
%4 = shl i32 %2, 24
switch i32 %4, label %10 [
i32 721420288, label %5
i32 754974720, label %7
]
5: ; preds = %3
%6 = icmp sgt i32 %0, %1
br label %12
7: ; preds = %3
%8 = sub nsw i32 0, %1
%9 = icmp sgt i32 %8, %0
br label %12
10: ; preds = %3
%11 = icmp eq i32 %0, %1
br label %12
12: ; preds = %10, %7, %5
%13 = phi i1 [ %6, %5 ], [ %9, %7 ], [ %11, %10 ]
%14 = zext i1 %13 to i32
ret i32 %14
}
int maxi(int i1, int i2) { return (i1 >= i2) ? i1 : i2; }


x86 assembly (clang, -O0):
<maxi>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     1121 <maxi+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <maxi+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<maxi>:
mov    %edi,%eax
cmp    %esi,%edi
cmovl  %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @maxi(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %1, i32 %0
ret i32 %4
}
void movLL(long *src, long *dst) { *dst = *src; }


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

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

LLVM IR (-O0):
define void @movLL(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* %5
%7 = load i64*, i64** %4
store i64 %6, i64* %7
ret void
}

LLVM IR (-O2):
define void @movLL(i64* nocapture %0, i64* nocapture writeonly %1) {
%3 = load i64, i64* %0
store i64 %3, i64* %1
ret void
}
/* Variables and functions */
int randbit();
int randsign(void) { return randbit() * 2 - 1; }


x86 assembly (clang, -O0):
<randsign>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <randbit@plt>
shl    $0x1,%eax
sub    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<randsign>:
push   %rax
xor    %eax,%eax
call   1030 <randbit@plt>
add    %eax,%eax
add    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @randsign() {
%1 = call i32 (...) @randbit()
%2 = mul nsw i32 %1, 2
%3 = sub nsw i32 %2, 1
ret i32 %3
}

LLVM IR (-O2):
define i32 @randsign() {
%1 = tail call i32 (...) @randbit()
%2 = shl nsw i32 %1, 1
%3 = add nsw i32 %2, -1
ret i32 %3
}
/* Variables and functions */
int partion(int *, int, int);
void quick_sort(int array[], int begin, int end) {
  if (begin < end) {
    int partidx = partion(array, begin, end);
    quick_sort(array, begin, partidx - 1);
    quick_sort(array, partidx + 1, end);
  }
}


x86 assembly (clang, -O0):
<quick_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1174 <quick_sort+0x54>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <partion@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1040 <quick_sort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <quick_sort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quick_sort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %edx,%esi
jge    1166 <quick_sort+0x46>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <partion@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1040 <quick_sort@plt>
add    $0x1,%ebx
mov    %ebx,%ebp
cmp    %r14d,%ebx
jl     1140 <quick_sort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @quick_sort(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %11
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ %1, %3 ]
%7 = tail call i32 @partion(i32* %0, i32 %6, i32 %2)
%8 = add nsw i32 %7, -1
tail call void @quick_sort(i32* %0, i32 %6, i32 %8)
%9 = add nsw i32 %7, 1
%10 = icmp slt i32 %9, %2
br i1 %10, label %5, label %11
11: ; preds = %5, %3
ret void
}
void XAllocNamedColor() {}


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

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

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

LLVM IR (-O2):
define void @XAllocNamedColor() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print_license(char *);
int main(int argc, char **argv) {
  print_license(argv[0]);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = tail call i32 @print_license(i8* %3)
ret i32 0
}
void ASN1_TIME_free(void) {}


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

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

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

LLVM IR (-O2):
define void @ASN1_TIME_free() {
ret void
}
/* Type definitions */
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
long long tst_timeval_to_ms(struct timeval t) {
  return t.tv_sec * 1000 + (t.tv_usec + 500) / 1000;
}


x86 assembly (clang, -O0):
<tst_timeval_to_ms>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
imul   $0x3e8,-0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1f4,%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<tst_timeval_to_ms>:
imul   $0x3e8,%edi,%eax
shr    $0x20,%rdi
add    $0x1f4,%edi
movslq %edi,%rcx
imul   $0x10624dd3,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
add    %eax,%ecx
movslq %ecx,%rax
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define i64 @tst_timeval_to_ms(i64 %0) {
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i64*
store i64 %0, i64* %3
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 1
%8 = load i32, i32* %7
%9 = add nsw i32 %8, 500
%10 = sdiv i32 %9, 1000
%11 = add nsw i32 %6, %10
%12 = sext i32 %11 to i64
ret i64 %12
}

LLVM IR (-O2):
define i64 @tst_timeval_to_ms(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = lshr i64 %0, 32
%4 = trunc i64 %3 to i32
%5 = mul nsw i32 %2, 1000
%6 = add nsw i32 %4, 500
%7 = sdiv i32 %6, 1000
%8 = add nsw i32 %7, %5
%9 = sext i32 %8 to i64
ret i64 %9
}
/* Variables and functions */
char *subString(char *, int, int, int /*<<< orphan*/);
char *substring(char *text, int first, int length) {
  return subString(text, first, length, 0);
}


x86 assembly (clang, -O0):
<substring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
xor    %ecx,%ecx
call   1030 <subString@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<substring>:
xor    %ecx,%ecx
jmp    1030 <subString@plt>

LLVM IR (-O0):
define i8* @substring(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i8* @subString(i8* %7, i32 %8, i32 %9, i32 0)
ret i8* %10
}

LLVM IR (-O2):
define i8* @substring(i8* %0, i32 %1, i32 %2) {
%4 = tail call i8* @subString(i8* %0, i32 %1, i32 %2, i32 0)
ret i8* %4
}
/* Variables and functions */
scalar_t__ COND_NE();
int /*<<< orphan*/ EA_AW_8();
int /*<<< orphan*/ m68ki_write_8(int /*<<< orphan*/, int);
void m68k_op_sne_8_aw(void) { m68ki_write_8(EA_AW_8(), COND_NE() ? 0xff : 0); }


x86 assembly (clang, -O0):
<m68k_op_sne_8_aw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <EA_AW_8@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <COND_NE@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rcx
xor    %esi,%esi
mov    $0xff,%eax
cmp    $0x0,%rcx
cmovne %eax,%esi
call   1050 <m68ki_write_8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m68k_op_sne_8_aw>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <EA_AW_8@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <COND_NE@plt>
test   %rax,%rax
mov    $0xff,%esi
cmove  %ebp,%esi
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <m68ki_write_8@plt>

LLVM IR (-O0):
define void @m68k_op_sne_8_aw() {
%1 = call i32 (...) @EA_AW_8()
%2 = call i64 (...) @COND_NE()
%3 = icmp ne i64 %2, 0
%4 = zext i1 %3 to i64
%5 = select i1 %3, i32 255, i32 0
%6 = call i32 @m68ki_write_8(i32 %1, i32 %5)
ret void
}

LLVM IR (-O2):
define void @m68k_op_sne_8_aw() {
%1 = tail call i32 (...) @EA_AW_8()
%2 = tail call i64 (...) @COND_NE()
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 0, i32 255
%5 = tail call i32 @m68ki_write_8(i32 %1, i32 %4)
ret void
}
void _Block_assign_weak_default(const void *ptr, void *dest) {
  *(void **)dest = (void *)ptr;
}


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

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

LLVM IR (-O0):
define void @_Block_assign_weak_default(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 = bitcast i8* %6 to i8**
store i8* %5, i8** %7
ret void
}

LLVM IR (-O2):
define void @_Block_assign_weak_default(i8* %0, i8* nocapture writeonly %1) {
%3 = bitcast i8* %1 to i8**
store i8* %0, i8** %3
ret void
}
void freeMatrixInt(int **m, int size) {
  int i = 0;
  for (i = 0; i < size; i++) {
    free(m[i]);
  }
  free(m);
}


x86 assembly (clang, -O0):
<freeMatrixInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1158 <freeMatrixInt+0x48>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112d <freeMatrixInt+0x1d>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<freeMatrixInt>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
jle    1142 <freeMatrixInt+0x32>
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <freeMatrixInt+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @freeMatrixInt(i32** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32*, i32** %0, i64 %7
%9 = bitcast i32** %8 to i8**
%10 = load i8*, i8** %9
tail call void @free(i8* %10)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = bitcast i32** %0 to i8*
tail call void @free(i8* %14)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;
struct rte_mbuf {
  int dummy;
};

/* Variables and functions */
uint16_t in_cksum(struct rte_mbuf *m, int len) { return (0); }


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

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

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

LLVM IR (-O2):
%struct.rte_mbuf = type { i32 }
define i32 @in_cksum(%struct.rte_mbuf* nocapture readnone %0, i32 %1) {
ret i32 0
}
void _empty_process_vertex(struct Graph *graph, unsigned int vertex,
                           unsigned int neighbors, void *arg) {
  (void)graph;
  (void)vertex;
  (void)neighbors;
  (void)arg;
}


x86 assembly (clang, -O0):
<_empty_process_vertex>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.Graph = type opaque
define void @_empty_process_vertex(%struct.Graph* %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca %struct.Graph*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store %struct.Graph* %0, %struct.Graph** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%9 = load %struct.Graph*, %struct.Graph** %5
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = load i8*, i8** %8
ret void
}

LLVM IR (-O2):
%struct.Graph = type opaque
define void @_empty_process_vertex(%struct.Graph* nocapture %0, i32 %1, i32 %2, i8* nocapture %3) {
ret void
}
void t4() {
  int *array = 0;
  char sudirript = 0;
  int val = sudirript[array];
}


x86 assembly (clang, -O0):
<t4>:
push   %rbp
mov    %rsp,%rbp
movq   $0x0,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
movsbq %cl,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x10(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @t4() {
%1 = alloca i32*
%2 = alloca i8
%3 = alloca i32
store i32* null, i32** %1
store i8 0, i8* %2
%4 = load i8, i8* %2
%5 = load i32*, i32** %1
%6 = sext i8 %4 to i64
%7 = getelementptr inbounds i32, i32* %5, i64 %6
%8 = load i32, i32* %7
store i32 %8, i32* %3
ret void
}

LLVM IR (-O2):
define void @t4() {
ret void
}
/* Variables and functions */
float sqrtf(float);
float gb_rsqrt(float a) { return 1.0f / sqrtf(a); }


x86 assembly (clang, -O0):
<gb_rsqrt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <sqrtf@plt>
movaps %xmm0,%xmm1
movss  0xece(%rip),%xmm0
divss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gb_rsqrt>:
push   %rax
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     111f <gb_rsqrt+0xf>
sqrtss %xmm0,%xmm0
jmp    1124 <gb_rsqrt+0x14>
call   1030 <sqrtf@plt>
movss  0xed4(%rip),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @gb_rsqrt(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @sqrtf(float %3)
%5 = fdiv float 1.000000e+00, %4
ret float %5
}

LLVM IR (-O2):
define float @gb_rsqrt(float %0) {
%2 = tail call float @sqrtf(float %0)
%3 = fdiv float 1.000000e+00, %2
ret float %3
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ add_CRC(int *, int, int);
int rt_modbus_report_device_type(uint8_t *buf, int sz) {
  buf[2] = 5;
  buf[3] = 0;
  buf[4] = 0;
  buf[5] = 0;
  buf[6] = 0;
  buf[7] = 0;
  add_CRC(buf, 10, 0xffff);
  return 10;
}


x86 assembly (clang, -O0):
<rt_modbus_report_device_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x5,0x8(%rax)
mov    -0x8(%rbp),%rax
movl   $0x0,0xc(%rax)
mov    -0x8(%rbp),%rax
movl   $0x0,0x10(%rax)
mov    -0x8(%rbp),%rax
movl   $0x0,0x14(%rax)
mov    -0x8(%rbp),%rax
movl   $0x0,0x18(%rax)
mov    -0x8(%rbp),%rax
movl   $0x0,0x1c(%rax)
mov    -0x8(%rbp),%rdi
mov    $0xa,%esi
mov    $0xffff,%edx
call   1030 <add_CRC@plt>
mov    $0xa,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rt_modbus_report_device_type>:
push   %rax
movl   $0x5,0x8(%rdi)
xorps  %xmm0,%xmm0
movups %xmm0,0xc(%rdi)
movl   $0x0,0x1c(%rdi)
mov    $0xa,%esi
mov    $0xffff,%edx
call   1030 <add_CRC@plt>
mov    $0xa,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @rt_modbus_report_device_type(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = getelementptr inbounds i32, i32* %5, i64 2
store i32 5, i32* %6
%7 = load i32*, i32** %3
%8 = getelementptr inbounds i32, i32* %7, i64 3
store i32 0, i32* %8
%9 = load i32*, i32** %3
%10 = getelementptr inbounds i32, i32* %9, i64 4
store i32 0, i32* %10
%11 = load i32*, i32** %3
%12 = getelementptr inbounds i32, i32* %11, i64 5
store i32 0, i32* %12
%13 = load i32*, i32** %3
%14 = getelementptr inbounds i32, i32* %13, i64 6
store i32 0, i32* %14
%15 = load i32*, i32** %3
%16 = getelementptr inbounds i32, i32* %15, i64 7
store i32 0, i32* %16
%17 = load i32*, i32** %3
%18 = call i32 @add_CRC(i32* %17, i32 10, i32 65535)
ret i32 10
}

LLVM IR (-O2):
define i32 @rt_modbus_report_device_type(i32* %0, i32 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 2
store i32 5, i32* %3
%4 = getelementptr inbounds i32, i32* %0, i64 3
%5 = bitcast i32* %4 to i8*
%6 = tail call i32 @add_CRC(i32* %0, i32 10, i32 65535)
ret i32 10
}
/* Variables and functions */
int /*<<< orphan*/ die(char *);
void *malloc(size_t);
void *xmalloc(size_t size) {
  if (!size)
    die("Tried to allocate zero bytes");
  void *ret = malloc(size);
  if (!ret)
    die("Could not allocate memory");
  return ret;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1143 <xmalloc+0x23>
lea    0xec2(%rip),%rdi
call   1040 <die@plt>
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1167 <xmalloc+0x47>
lea    0xebb(%rip),%rdi
call   1040 <die@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rbx
mov    %rdi,%rbx
test   %rdi,%rdi
jne    1135 <xmalloc+0x15>
lea    0xed0(%rip),%rdi
call   1040 <die@plt>
mov    %rbx,%rdi
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1151 <xmalloc+0x31>
lea    0xed1(%rip),%rdi
call   1040 <die@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Tried to allocate zero bytes\00"
@.str.1 = [26 x i8] c"Could not allocate memory\00"
define i8* @xmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = icmp ne i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = call i32 @die(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
%9 = load i64, i64* %2
%10 = call i8* @malloc(i64 %9)
store i8* %10, i8** %3
%11 = load i8*, i8** %3
%12 = icmp ne i8* %11, null
br i1 %12, label %15, label %13
13: ; preds = %8
%14 = call i32 @die(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %13, %8
%16 = load i8*, i8** %3
ret i8* %16
}

LLVM IR (-O2):
@.str = [29 x i8] c"Tried to allocate zero bytes\00"
@.str.1 = [26 x i8] c"Could not allocate memory\00"
define noalias i8* @xmalloc(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @die(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %1
%6 = tail call i8* @malloc(i64 %0)
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @die(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %5
ret i8* %6
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int low_get_string(char **, int /*<<< orphan*/ *, int /*<<< orphan*/, int,
                   int /*<<< orphan*/);
int /*<<< orphan*/ malloc(int);
int get_string(char **str, FILE *f) {
  return low_get_string(str, f, malloc(32), 32, 0);
}


x86 assembly (clang, -O0):
<get_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x20,%edi
call   1030 <malloc@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
mov    $0x20,%ecx
xor    %r8d,%r8d
call   1040 <low_get_string@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_string>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0x20,%edi
call   1030 <malloc@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
mov    $0x20,%ecx
xor    %r8d,%r8d
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <low_get_string@plt>

LLVM IR (-O0):
define i32 @get_string(i8** %0, i32* %1) {
%3 = alloca i8**
%4 = alloca i32*
store i8** %0, i8*** %3
store i32* %1, i32** %4
%5 = load i8**, i8*** %3
%6 = load i32*, i32** %4
%7 = call i32 @malloc(i32 32)
%8 = call i32 @low_get_string(i8** %5, i32* %6, i32 %7, i32 32, i32 0)
ret i32 %8
}

LLVM IR (-O2):
define i32 @get_string(i8** %0, i32* %1) {
%3 = tail call i32 @malloc(i32 32)
%4 = tail call i32 @low_get_string(i8** %0, i32* %1, i32 %3, i32 32, i32 0)
ret i32 %4
}