xunge/DecIR huggingface dataset:
int in_long(int port) {
  int v = 0;
  __asm__("movl %1, %%edx;		        inl %%dx, %%eax;	"
          "	        movl %%eax,%0;"
          : "=r"(v)
          : "r"(port)
          : "%eax", "%edx");
  return v;
}


x86 assembly (clang, -O0):
<in_long>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%ecx
mov    %ecx,%edx
in     (%dx),%eax
mov    %eax,%ecx
mov    %ecx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<in_long>:
mov    %edi,%edx
in     (%dx),%eax
mov    %eax,%ecx
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @in_long(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
%5 = call i32 asm "movl $1, %edx;\09\09 inl %dx, %eax;\09\09 movl %eax,$0;", "=r,r,~{eax},~{edx},~{dirflag},~{fpsr},~{flags}"(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @in_long(i32 %0) {
%2 = tail call i32 asm "movl $1, %edx;\09\09 inl %dx, %eax;\09\09 movl %eax,$0;", "=r,r,~{eax},~{edx},~{dirflag},~{fpsr},~{flags}"(i32 %0)
ret i32 %2
}
/* Variables and functions */
int close(int);
int closesocket(int fd) { return close(fd); }


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

x86 assembly (clang, -O2):
<closesocket>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define i32 @closesocket(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret i32 %2
}
void av_audio_fifo_read() {}


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

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

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

LLVM IR (-O2):
define void @av_audio_fifo_read() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void bar() { printf("Hello from (imported) third lib\n"); }


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

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

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

LLVM IR (-O2):
@str = [32 x i8] c"Hello from (imported) third lib\00"
define void @bar() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *realloc(void *, size_t);
int /*<<< orphan*/ stderr;
void *xrealloc(void *old, size_t size) {
  void *p = realloc(old, size);
  if (!p) {
    fprintf(stderr, "Virtual memory exhausted\n");
    abort();
  }
  return p;
}


x86 assembly (clang, -O0):
<xrealloc>:
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   1050 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1178 <xrealloc+0x48>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
lea    0xe94(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrealloc>:
push   %rax
call   1050 <realloc@plt>
test   %rax,%rax
je     113d <xrealloc+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [26 x i8] c"Virtual memory exhausted\0A\00"
define i8* @xrealloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %15, label %11
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%14 = call i32 (...) @abort()
unreachable
15: ; preds = %2
%16 = load i8*, i8** %5
ret i8* %16
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [26 x i8] c"Virtual memory exhausted\0A\00"
define noalias i8* @xrealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 (...) @abort()
unreachable
9: ; preds = %2
ret i8* %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, unsigned char);
void fprint_xch_Rn(FILE *stream, unsigned char n) {
  fprintf(stream, "XCH   A, R%X                     ", n);
}


x86 assembly (clang, -O0):
<fprint_xch_Rn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed3(%rip),%rsi
movzbl -0x9(%rbp),%edx
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fprint_xch_Rn>:
mov    %esi,%edx
lea    0xee7(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"XCH A, R%X \00"
define void @fprint_xch_Rn(i32* %0, i8 zeroext %1) {
%3 = alloca i32*
%4 = alloca i8
store i32* %0, i32** %3
store i8 %1, i8* %4
%5 = load i32*, i32** %3
%6 = load i8, i8* %4
%7 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8 zeroext %6)
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"XCH A, R%X \00"
define void @fprint_xch_Rn(i32* nocapture %0, i8 zeroext %1) {
%3 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8 zeroext %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __builtin_ldwio(unsigned int *);
void test_ldwio(unsigned int *p1, unsigned int *p2) {
  __builtin_ldwio(p1);
  __builtin_ldwio(p2);
  __builtin_ldwio(p2 + 1);
  __builtin_ldwio(p2 + 2);
  __builtin_ldwio(p2 + 511);
  __builtin_ldwio(p2 + 512);
}


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

x86 assembly (clang, -O2):
<test_ldwio>:
push   %rbx
mov    %rsi,%rbx
call   1030 <__builtin_ldwio@plt>
mov    %rbx,%rdi
call   1030 <__builtin_ldwio@plt>
lea    0x4(%rbx),%rdi
call   1030 <__builtin_ldwio@plt>
lea    0x8(%rbx),%rdi
call   1030 <__builtin_ldwio@plt>
lea    0x7fc(%rbx),%rdi
call   1030 <__builtin_ldwio@plt>
add    $0x800,%rbx
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <__builtin_ldwio@plt>

LLVM IR (-O0):
define void @test_ldwio(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 = call i32 @__builtin_ldwio(i32* %5)
%7 = load i32*, i32** %4
%8 = call i32 @__builtin_ldwio(i32* %7)
%9 = load i32*, i32** %4
%10 = getelementptr inbounds i32, i32* %9, i64 1
%11 = call i32 @__builtin_ldwio(i32* %10)
%12 = load i32*, i32** %4
%13 = getelementptr inbounds i32, i32* %12, i64 2
%14 = call i32 @__builtin_ldwio(i32* %13)
%15 = load i32*, i32** %4
%16 = getelementptr inbounds i32, i32* %15, i64 511
%17 = call i32 @__builtin_ldwio(i32* %16)
%18 = load i32*, i32** %4
%19 = getelementptr inbounds i32, i32* %18, i64 512
%20 = call i32 @__builtin_ldwio(i32* %19)
ret void
}

LLVM IR (-O2):
define void @test_ldwio(i32* %0, i32* %1) {
%3 = tail call i32 @__builtin_ldwio(i32* %0)
%4 = tail call i32 @__builtin_ldwio(i32* %1)
%5 = getelementptr inbounds i32, i32* %1, i64 1
%6 = tail call i32 @__builtin_ldwio(i32* %5)
%7 = getelementptr inbounds i32, i32* %1, i64 2
%8 = tail call i32 @__builtin_ldwio(i32* %7)
%9 = getelementptr inbounds i32, i32* %1, i64 511
%10 = tail call i32 @__builtin_ldwio(i32* %9)
%11 = getelementptr inbounds i32, i32* %1, i64 512
%12 = tail call i32 @__builtin_ldwio(i32* %11)
ret void
}
/* Variables and functions */
scalar_t__ errno;
int /*<<< orphan*/ perror(char const *);
int /*<<< orphan*/ printf(char *, char const *);
void die(const char *message) {
  if (errno) {
    perror(message);
  } else {
    printf("ERROR: %s\n", message);
  }
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
cmpq   $0x0,(%rax)
je     114b <die+0x2b>
mov    -0x8(%rbp),%rdi
call   1040 <perror@plt>
jmp    115b <die+0x3b>
mov    -0x8(%rbp),%rsi
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<die>:
mov    %rdi,%rsi
mov    0x2eb6(%rip),%rax
cmpq   $0x0,(%rax)
jne    113c <die+0x1c>
lea    0xec9(%rip),%rdi
jmp    1030 <printf@plt>
mov    %rsi,%rdi
jmp    1040 <perror@plt>

LLVM IR (-O0):
@errno = global i64 0
@.str = [11 x i8] c"ERROR: %s\0A\00"
define void @die(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i64, i64* @errno
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @perror(i8* %6)
br label %11
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %11
11: ; preds = %8, %5
ret void
}

LLVM IR (-O2):
@errno = global i64 0
@.str = [11 x i8] c"ERROR: %s\0A\00"
define void @die(i8* %0) {
%2 = load i64, i64* @errno
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @perror(i8* %0)
br label %8
6: ; preds = %1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %8
8: ; preds = %6, %4
ret void
}
unsigned long mtspr(unsigned char spr, unsigned char rs) {
  return (31 << 26) | (rs << 21) | (spr << 16) | (467 << 1);
}


x86 assembly (clang, -O0):
<mtspr>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x15,%eax
or     $0x7c000000,%eax
movzbl -0x1(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
or     $0x3a6,%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<mtspr>:
mov    %esi,%ecx
shl    $0x15,%rcx
mov    %edi,%eax
shl    $0x10,%rax
or     %rcx,%rax
or     $0x7c0003a6,%rax
ret

LLVM IR (-O0):
define i64 @mtspr(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 = zext i8 %5 to i32
%7 = shl i32 %6, 21
%8 = or i32 2080374784, %7
%9 = load i8, i8* %3
%10 = zext i8 %9 to i32
%11 = shl i32 %10, 16
%12 = or i32 %8, %11
%13 = or i32 %12, 934
%14 = sext i32 %13 to i64
ret i64 %14
}

LLVM IR (-O2):
define i64 @mtspr(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %1 to i64
%4 = shl nuw nsw i64 %3, 21
%5 = zext i8 %0 to i64
%6 = shl nuw nsw i64 %5, 16
%7 = or i64 %6, %4
%8 = or i64 %7, 2080375718
ret i64 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int string_length(char *);
int main() {
  int len;
  static char *message = "hello world";
  len = string_length(message);
  printf("%d\n", len);
  return 0;
}


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

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

LLVM IR (-O0):
@main.message = internal global i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0)
@.str = [12 x i8] c"hello world\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = load i8*, i8** @main.message
%4 = call i32 @string_length(i8* %3)
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"hello world\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @string_length(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %1)
ret i32 0
}
int format_dollars(int cents) { return (float)cents / 100; }


x86 assembly (clang, -O0):
<format_dollars>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
movss  0xeec(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<format_dollars>:
cvtsi2ss %edi,%xmm0
divss  0xef4(%rip),%xmm0
cvttss2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @format_dollars(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sitofp i32 %3 to float
%5 = fdiv float %4, 1.000000e+02
%6 = fptosi float %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @format_dollars(i32 %0) {
%2 = sitofp i32 %0 to float
%3 = fdiv float %2, 1.000000e+02
%4 = fptosi float %3 to i32
ret i32 %4
}
int gray(int x) { return ((x >> 1) ^ x); }


x86 assembly (clang, -O0):
<gray>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
xor    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gray>:
mov    %edi,%eax
sar    %eax
xor    %edi,%eax
ret

LLVM IR (-O0):
define i32 @gray(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 1
%5 = load i32, i32* %2
%6 = xor i32 %4, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @gray(i32 %0) {
%2 = ashr i32 %0, 1
%3 = xor i32 %2, %0
ret i32 %3
}
int acpi_lpat_raw_to_temp(struct acpi_lpat_conversion_table *lpat_table,
                          int raw) {
  return 0;
}


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

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

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

LLVM IR (-O2):
%struct.acpi_lpat_conversion_table = type opaque
define i32 @acpi_lpat_raw_to_temp(%struct.acpi_lpat_conversion_table* nocapture readnone %0, i32 %1) {
ret i32 0
}
void cache_enable(unsigned int cache_bit) { return; }


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

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

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

LLVM IR (-O2):
define void @cache_enable(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Re_EEPROM_Enable();
void Re_EEPROM_Start(void) { Re_EEPROM_Enable(); }


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

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

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

LLVM IR (-O2):
define void @Re_EEPROM_Start() {
%1 = tail call i32 (...) @Re_EEPROM_Enable()
ret void
}
int fun143() { return 143; }


x86 assembly (clang, -O0):
<fun143>:
push   %rbp
mov    %rsp,%rbp
mov    $0x8f,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @fun143() {
ret i32 143
}

LLVM IR (-O2):
define i32 @fun143() {
ret i32 143
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ test();
int main(void) {
  int i;
  for (i = 0; i < 100; i++)
    test();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    1155 <main+0x35>
mov    $0x0,%al
call   1040 <test@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x64,%ebx
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <test@plt>
add    $0xffffffff,%ebx
jne    1130 <main+0x10>
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %8, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 100
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = call i32 (...) @test()
br label %8
8: ; preds = %6
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 1
store i32 %10, i32* %2
br label %3
11: ; preds = %3
%12 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %4, %1 ]
%3 = tail call i32 (...) @test()
%4 = add nuw nsw i32 %2, 1
%5 = icmp eq i32 %4, 100
br i1 %5, label %6, label %1
6: ; preds = %1
%7 = tail call i32 @exit(i32 0)
unreachable
}
int execute_fchown32() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @execute_fchown32() {
ret i32 0
}
/* Variables and functions */
scalar_t__ isspace(char);
char *trim(char *c) {
  while (c && isspace(*c))
    c++;
  return c;
}


x86 assembly (clang, -O0):
<trim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     1142 <trim+0x32>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1152 <trim+0x42>
jmp    1163 <trim+0x53>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <trim+0xc>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trim>:
push   %rbx
test   %rdi,%rdi
je     1134 <trim+0x24>
mov    %rdi,%rbx
add    $0xffffffffffffffff,%rbx
nopl   (%rax)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1030 <isspace@plt>
test   %rax,%rax
jne    1120 <trim+0x10>
jmp    1136 <trim+0x26>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @trim(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %13, %1
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = load i8*, i8** %2
%8 = load i8, i8* %7
%9 = call i64 @isspace(i8 signext %8)
%10 = icmp ne i64 %9, 0
br label %11
11: ; preds = %6, %3
%12 = phi i1 [ false, %3 ], [ %10, %6 ]
br i1 %12, label %13, label %16
13: ; preds = %11
%14 = load i8*, i8** %2
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %2
br label %3
16: ; preds = %11
%17 = load i8*, i8** %2
ret i8* %17
}

LLVM IR (-O2):
define i8* @trim(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i8* [ %8, %3 ], [ %0, %1 ]
%5 = load i8, i8* %4
%6 = tail call i64 @isspace(i8 signext %5)
%7 = icmp eq i64 %6, 0
%8 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %7, label %9, label %3
9: ; preds = %3, %1
%10 = phi i8* [ null, %1 ], [ %4, %3 ]
ret i8* %10
}
int compare_shallow_void_pointer(const void *first_data,
                                 const void *second_data) {
  if (first_data == second_data)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<compare_shallow_void_pointer>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    1126 <compare_shallow_void_pointer+0x26>
movl   $0x0,-0x4(%rbp)
jmp    112d <compare_shallow_void_pointer+0x2d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_shallow_void_pointer>:
xor    %eax,%eax
cmp    %rsi,%rdi
setne  %al
ret

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

LLVM IR (-O2):
define i32 @compare_shallow_void_pointer(i8* readnone %0, i8* readnone %1) {
%3 = icmp ne i8* %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef scalar_t__ u_int32_t;

/* Variables and functions */
void flowd_crc32_start(u_int32_t *crcp) { *crcp = 0; }


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

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

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

LLVM IR (-O2):
define void @flowd_crc32_start(i64* nocapture writeonly %0) {
store i64 0, i64* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int main() {
  char *p;
  *p = 'K';
  printf("%c\n", *p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x4b,(%rax)
mov    -0x10(%rbp),%rax
lea    0xecf(%rip),%rdi
movsbl (%rax),%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
@.str = [4 x i8] c"%c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = load i8*, i8** %2
store i8 75, i8* %3
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %5)
ret i32 0
}

LLVM IR (-O2):
/* Type definitions */
typedef scalar_t__ base;

/* Variables and functions */
int /*<<< orphan*/ barrier();
unsigned long get_uart_base();
void flush(void) {
  unsigned long base = get_uart_base();
  if (!base)
    return;
  while ((*(volatile unsigned char *)((base) + 0x18)) & (1 << 3))
    barrier();
}


x86 assembly (clang, -O0):
<flush>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <get_uart_base@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1143 <flush+0x23>
jmp    116a <flush+0x4a>
jmp    1148 <flush+0x28>
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%al
movzbl %al,%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     116a <flush+0x4a>
mov    $0x0,%al
call   1030 <barrier@plt>
jmp    1148 <flush+0x28>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flush>:
push   %rbx
xor    %eax,%eax
call   1040 <get_uart_base@plt>
test   %rax,%rax
je     114d <flush+0x2d>
mov    %rax,%rbx
testb  $0x8,0x18(%rbx)
je     114d <flush+0x2d>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <barrier@plt>
testb  $0x8,0x18(%rbx)
jne    1140 <flush+0x20>
pop    %rbx
ret

LLVM IR (-O0):
define void @flush() {
%1 = alloca i64
%2 = call i64 (...) @get_uart_base()
store i64 %2, i64* %1
%3 = load i64, i64* %1
%4 = icmp ne i64 %3, 0
br i1 %4, label %6, label %5
5: ; preds = %0
br label %17
6: ; preds = %0
br label %7
7: ; preds = %15, %6
%8 = load i64, i64* %1
%9 = add i64 %8, 24
%10 = inttoptr i64 %9 to i8*
%11 = load volatile i8, i8* %10
%12 = zext i8 %11 to i32
%13 = and i32 %12, 8
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %7
%16 = call i32 (...) @barrier()
br label %7
17: ; preds = %5, %7
ret void
}

LLVM IR (-O2):
define void @flush() {
%1 = tail call i64 (...) @get_uart_base()
%2 = icmp eq i64 %1, 0
br i1 %2, label %14, label %3
3: ; preds = %0
%4 = add i64 %1, 24
%5 = inttoptr i64 %4 to i8*
%6 = load volatile i8, i8* %5
%7 = and i8 %6, 8
%8 = icmp eq i8 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %3, %9
%10 = tail call i32 (...) @barrier()
%11 = load volatile i8, i8* %5
%12 = and i8 %11, 8
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %9
14: ; preds = %9, %3, %0
ret void
}
void f_doublecomplex(double __complex__ a) {}


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

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

LLVM IR (-O0):
define void @f_doublecomplex(double %0, double %1) {
%3 = alloca { double, double }
%4 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 0
store double %0, double* %4
%5 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 1
store double %1, double* %5
ret void
}

LLVM IR (-O2):
define void @f_doublecomplex(double %0, double %1) {
ret void
}
float f_1(float a, float b, float c, float d) {
  if (a > 0.0)
    return c;
  else
    return 2.0;
}


x86 assembly (clang, -O0):
<f_1>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  %xmm3,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    113d <f_1+0x3d>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    114a <f_1+0x4a>
movss  0xebb(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_1>:
xorps  %xmm1,%xmm1
cmpltss %xmm0,%xmm1
andps  %xmm1,%xmm2
movss  0xeed(%rip),%xmm0
andnps %xmm0,%xmm1
orps   %xmm2,%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @f_1(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
store float %0, float* %6
store float %1, float* %7
store float %2, float* %8
store float %3, float* %9
%10 = load float, float* %6
%11 = fpext float %10 to double
%12 = fcmp ogt double %11, 0.000000e+00
br i1 %12, label %13, label %15
13: ; preds = %4
%14 = load float, float* %8
store float %14, float* %5
br label %16
15: ; preds = %4
store float 2.000000e+00, float* %5
br label %16
16: ; preds = %15, %13
%17 = load float, float* %5
ret float %17
}

LLVM IR (-O2):
define float @f_1(float %0, float %1, float %2, float %3) {
%5 = fcmp ogt float %0, 0.000000e+00
%6 = select i1 %5, float %2, float 2.000000e+00
ret float %6
}
/* Variables and functions */
int /*<<< orphan*/ aguard2l_(float *, int *, int *, int *, int *);
void caguard2l(float q[], int nx, int ny, int nxe, int nye) {
  aguard2l_(q, &nx, &ny, &nxe, &nye);
  return;
}


x86 assembly (clang, -O0):
<caguard2l>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rcx
lea    -0x18(%rbp),%r8
call   1030 <aguard2l_@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<caguard2l>:
sub    $0x18,%rsp
mov    %esi,0x14(%rsp)
mov    %edx,0x10(%rsp)
mov    %ecx,0xc(%rsp)
mov    %r8d,0x8(%rsp)
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
call   1030 <aguard2l_@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @caguard2l(float* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca float*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store float* %0, float** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load float*, float** %6
%12 = call i32 @aguard2l_(float* %11, i32* %7, i32* %8, i32* %9, i32* %10)
ret void
}

LLVM IR (-O2):
define void @caguard2l(float* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 %4, i32* %9
%10 = call i32 @aguard2l_(float* %0, i32* %6, i32* %7, i32* %8, i32* %9)
ret void
}
/* Type definitions */
struct atm {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ update_tm(struct atm *, struct atm *, int);
void date_yesterday(struct atm *tm, struct atm *now, int *num) {
  update_tm(tm, now, 24 * 60 * 60);
}


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

x86 assembly (clang, -O2):
<date_yesterday>:
mov    $0x15180,%edx
jmp    1030 <update_tm@plt>

LLVM IR (-O0):
%struct.atm = type { i32 }
define void @date_yesterday(%struct.atm* %0, %struct.atm* %1, i32* %2) {
%4 = alloca %struct.atm*
%5 = alloca %struct.atm*
%6 = alloca i32*
store %struct.atm* %0, %struct.atm** %4
store %struct.atm* %1, %struct.atm** %5
store i32* %2, i32** %6
%7 = load %struct.atm*, %struct.atm** %4
%8 = load %struct.atm*, %struct.atm** %5
%9 = call i32 @update_tm(%struct.atm* %7, %struct.atm* %8, i32 86400)
ret void
}

LLVM IR (-O2):
%struct.atm = type { i32 }
define void @date_yesterday(%struct.atm* %0, %struct.atm* %1, i32* nocapture readnone %2) {
%4 = tail call i32 @update_tm(%struct.atm* %0, %struct.atm* %1, i32 86400)
ret void
}
void batadv_nc_skb_store_for_decoding(struct batadv_priv *bat_priv,
                                      struct sk_buff *skb) {}


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

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

LLVM IR (-O0):
%struct.batadv_priv = type opaque
%struct.sk_buff = type opaque
define void @batadv_nc_skb_store_for_decoding(%struct.batadv_priv* %0, %struct.sk_buff* %1) {
%3 = alloca %struct.batadv_priv*
%4 = alloca %struct.sk_buff*
store %struct.batadv_priv* %0, %struct.batadv_priv** %3
store %struct.sk_buff* %1, %struct.sk_buff** %4
ret void
}

LLVM IR (-O2):
%struct.batadv_priv = type opaque
%struct.sk_buff = type opaque
define void @batadv_nc_skb_store_for_decoding(%struct.batadv_priv* nocapture %0, %struct.sk_buff* nocapture %1) {
ret void
}
void gtk_widget_style_get_property() {}


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

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

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

LLVM IR (-O2):
define void @gtk_widget_style_get_property() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ fwrite(char *, int, unsigned long, int /*<<< orphan*/ *);
int WriteIMG(char *buffer, unsigned long lSize) {
  FILE *pFile;
  pFile = fopen("/var/img.bmp", "w");
  fwrite(buffer, 1, lSize, pFile);
  free(buffer);
  fclose(pFile);
  return 0;
}


x86 assembly (clang, -O0):
<WriteIMG>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea9(%rip),%rdi
lea    0xeaf(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   1060 <fwrite@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WriteIMG>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xeae(%rip),%rdi
lea    0xeb4(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    $0x1,%esi
mov    %r14,%rdx
mov    %rax,%rcx
call   1060 <fwrite@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"/var/img.bmp\00"
@.str.1 = [2 x i8] c"w\00"
define i32 @WriteIMG(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %6, i32** %5
%7 = load i8*, i8** %3
%8 = load i64, i64* %4
%9 = load i32*, i32** %5
%10 = call i32 @fwrite(i8* %7, i32 1, i64 %8, i32* %9)
%11 = load i8*, i8** %3
%12 = call i32 @free(i8* %11)
%13 = load i32*, i32** %5
%14 = call i32 @fclose(i32* %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"/var/img.bmp\00"
@.str.1 = [2 x i8] c"w\00"
define i32 @WriteIMG(i8* nocapture %0, i64 %1) {
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @fwrite(i8* %0, i32 1, i64 %1, i32* %3)
%5 = tail call i32 @free(i8* %0)
%6 = tail call i32 @fclose(i32* %3)
ret i32 0
}
char PR7218(char a) {
  char buf[2];
  buf[0] = a;
  return buf[1];
}


x86 assembly (clang, -O0):
<PR7218>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
mov    %al,-0x3(%rbp)
movsbl -0x2(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i8 @PR7218(i8 signext %0) {
%2 = alloca i8
%3 = alloca [2 x i8]
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
store i8 %4, i8* %5
%6 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 1
%7 = load i8, i8* %6
ret i8 %7
}

LLVM IR (-O2):
define signext i8 @PR7218(i8 signext %0) {
ret i8 undef
}
/* Type definitions */
struct anm_track {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ anm_destroy_track(struct anm_track *);
int /*<<< orphan*/ free(struct anm_track *);
void anm_free_track(struct anm_track *track) {
  anm_destroy_track(track);
  free(track);
}


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

x86 assembly (clang, -O2):
<anm_free_track>:
push   %rbx
mov    %rdi,%rbx
call   1040 <anm_destroy_track@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.anm_track = type { i32 }
define void @anm_free_track(%struct.anm_track* %0) {
%2 = alloca %struct.anm_track*
store %struct.anm_track* %0, %struct.anm_track** %2
%3 = load %struct.anm_track*, %struct.anm_track** %2
%4 = call i32 @anm_destroy_track(%struct.anm_track* %3)
%5 = load %struct.anm_track*, %struct.anm_track** %2
%6 = call i32 @free(%struct.anm_track* %5)
ret void
}

LLVM IR (-O2):
%struct.anm_track = type { i32 }
define void @anm_free_track(%struct.anm_track* %0) {
%2 = tail call i32 @anm_destroy_track(%struct.anm_track* %0)
%3 = tail call i32 @free(%struct.anm_track* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ funcion1();
int /*<<< orphan*/ funcion2();
int main(void) {
  funcion1();
  funcion2();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @funcion1()
%2 = tail call i32 (...) @funcion2()
ret i32 0
}
signed short int signedshortint_ignoring_unsignedlong(signed short int x,
                                                      unsigned long y) {
  return x;
}


x86 assembly (clang, -O0):
<signedshortint_ignoring_unsignedlong>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
movswl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<signedshortint_ignoring_unsignedlong>:
mov    %edi,%eax
ret

LLVM IR (-O0):
define signext i16 @signedshortint_ignoring_unsignedlong(i16 signext %0, i64 %1) {
%3 = alloca i16
%4 = alloca i64
store i16 %0, i16* %3
store i64 %1, i64* %4
%5 = load i16, i16* %3
ret i16 %5
}

LLVM IR (-O2):
define signext i16 @signedshortint_ignoring_unsignedlong(i16 returned signext %0, i64 %1) {
ret i16 %0
}
/* Variables and functions */
char *BGBCP_EatWhite(char *);
char *BGBCC_SHXA_EatWhite(char *cs) { return (BGBCP_EatWhite(cs)); }


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

x86 assembly (clang, -O2):
<BGBCC_SHXA_EatWhite>:
jmp    1030 <BGBCP_EatWhite@plt>

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

LLVM IR (-O2):
define i8* @BGBCC_SHXA_EatWhite(i8* %0) {
%2 = tail call i8* @BGBCP_EatWhite(i8* %0)
ret i8* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t adc_getChannel(uint8_t channel) { return 512; }


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

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

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

LLVM IR (-O2):
define i32 @adc_getChannel(i32 %0) {
ret i32 512
}
long long foo(long long a, signed char b, signed char c) {
  int bc = b * c;
  return a + (short)bc;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movsbl -0x9(%rbp),%eax
movsbl -0xa(%rbp),%ecx
imul   %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
movswq %cx,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
movslq %esi,%rcx
movslq %edx,%rax
imul   %rcx,%rax
add    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @foo(i64 %0, i8 signext %1, i8 signext %2) {
%4 = alloca i64
%5 = alloca i8
%6 = alloca i8
%7 = alloca i32
store i64 %0, i64* %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%8 = load i8, i8* %5
%9 = sext i8 %8 to i32
%10 = load i8, i8* %6
%11 = sext i8 %10 to i32
%12 = mul nsw i32 %9, %11
store i32 %12, i32* %7
%13 = load i64, i64* %4
%14 = load i32, i32* %7
%15 = trunc i32 %14 to i16
%16 = sext i16 %15 to i64
%17 = add nsw i64 %13, %16
ret i64 %17
}

LLVM IR (-O2):
define i64 @foo(i64 %0, i8 signext %1, i8 signext %2) {
%4 = sext i8 %1 to i64
%5 = sext i8 %2 to i64
%6 = mul nsw i64 %5, %4
%7 = add nsw i64 %6, %0
ret i64 %7
}
void print_inst_LS_RS_IM13_RD(char *mnemonic, int rs1, int im13, int rd) { ; }


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

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

LLVM IR (-O0):
define void @print_inst_LS_RS_IM13_RD(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
ret void
}

LLVM IR (-O2):
define void @print_inst_LS_RS_IM13_RD(i8* nocapture %0, i32 %1, i32 %2, i32 %3) {
ret void
}
int main(void) {
  unsigned i, j;
  for (i = 1, j = 0; i != 0; i += 2) {
    j += 500;
    if (j % 7) {
      j++;
    } else {
      j--;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     116d <main+0x6d>
mov    -0xc(%rbp),%eax
add    $0x1f4,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x7,%ecx
xor    %edx,%edx
div    %ecx
cmp    $0x0,%edx
je     1151 <main+0x51>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115a <main+0x5a>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    115f <main+0x5f>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
jmp    1119 <main+0x19>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isascii(int);
void t_isascii_0x8f() {
  Assert_real((isascii(143) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isascii.c",
              720, ("isascii should be 0 for 0x8f"));
}


x86 assembly (clang, -O0):
<t_isascii_0x8f>:
push   %rbp
mov    %rsp,%rbp
mov    $0x8f,%edi
call   1030 <isascii@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x2d0,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isascii_0x8f>:
push   %rax
mov    $0x8f,%edi
call   1030 <isascii@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x2d0,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isascii.c\00"
@.str.1 = [29 x i8] c"isascii should be 0 for 0x8f\00"
define void @t_isascii_0x8f() {
%1 = call i64 @isascii(i32 143)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 720, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isascii.c\00"
@.str.1 = [29 x i8] c"isascii should be 0 for 0x8f\00"
define void @t_isascii_0x8f() {
%1 = tail call i64 @isascii(i32 143)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 720, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ IsLeapYear(int);
int MonthDays(int month, int year) {
  switch (month) {
  case 2:
    if (IsLeapYear(year))
      return (29);
    return 28;
  case 4:
  case 6:
  case 9:
  case 11:
    return (30);
  default:
    return (31);
  }
}


x86 assembly (clang, -O0):
<MonthDays>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x2,%eax
je     1176 <MonthDays+0x66>
jmp    1132 <MonthDays+0x22>
mov    -0x10(%rbp),%eax
sub    $0x4,%eax
je     119f <MonthDays+0x8f>
jmp    1143 <MonthDays+0x33>
mov    -0x10(%rbp),%eax
sub    $0x6,%eax
je     119f <MonthDays+0x8f>
jmp    1154 <MonthDays+0x44>
mov    -0x10(%rbp),%eax
sub    $0x9,%eax
je     119f <MonthDays+0x8f>
jmp    1165 <MonthDays+0x55>
mov    -0x10(%rbp),%eax
sub    $0xb,%eax
je     119f <MonthDays+0x8f>
jmp    11ab <MonthDays+0x9b>
mov    -0xc(%rbp),%edi
call   1030 <IsLeapYear@plt>
cmp    $0x0,%eax
je     1193 <MonthDays+0x83>
movl   $0x1d,-0x4(%rbp)
jmp    11b2 <MonthDays+0xa2>
movl   $0x1c,-0x4(%rbp)
jmp    11b2 <MonthDays+0xa2>
movl   $0x1e,-0x4(%rbp)
jmp    11b2 <MonthDays+0xa2>
movl   $0x1f,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MonthDays>:
cmp    $0xb,%edi
ja     1142 <MonthDays+0x32>
mov    $0x1e,%eax
mov    $0xa50,%ecx
bt     %edi,%ecx
jae    1125 <MonthDays+0x15>
ret
cmp    $0x2,%edi
jne    1142 <MonthDays+0x32>
push   %rax
mov    %esi,%edi
call   1030 <IsLeapYear@plt>
cmp    $0x1,%eax
mov    $0x1d,%eax
sbb    $0x0,%eax
add    $0x8,%rsp
ret
mov    $0x1f,%eax
ret

LLVM IR (-O0):
define i32 @MonthDays(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
switch i32 %6, label %14 [
i32 2, label %7
i32 4, label %13
i32 6, label %13
i32 9, label %13
i32 11, label %13
]
7: ; preds = %2
%8 = load i32, i32* %5
%9 = call i32 @IsLeapYear(i32 %8)
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %7
store i32 29, i32* %3
br label %15
12: ; preds = %7
store i32 28, i32* %3
br label %15
13: ; preds = %2, %2, %2, %2
store i32 30, i32* %3
br label %15
14: ; preds = %2
store i32 31, i32* %3
br label %15
15: ; preds = %14, %13, %12, %11
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @MonthDays(i32 %0, i32 %1) {
switch i32 %0, label %7 [
i32 2, label %3
i32 4, label %8
i32 6, label %8
i32 9, label %8
i32 11, label %8
]
3: ; preds = %2
%4 = tail call i32 @IsLeapYear(i32 %1)
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i32 28, i32 29
br label %8
7: ; preds = %2
br label %8
8: ; preds = %2, %2, %2, %2, %3, %7
%9 = phi i32 [ 31, %7 ], [ %6, %3 ], [ 30, %2 ], [ 30, %2 ], [ 30, %2 ], [ 30, %2 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ internal_function_is_not_visible();
int /*<<< orphan*/ printf(char *, int);
void foo(int x) {
  internal_function_is_not_visible();
  printf("foo@@V1: %d\n", x);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <internal_function_is_not_visible@plt>
mov    -0x4(%rbp),%esi
lea    0xec4(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <internal_function_is_not_visible@plt>
lea    0xecf(%rip),%rdi
mov    %ebx,%esi
pop    %rbx
jmp    1040 <printf@plt>

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

LLVM IR (-O2):
@.str = [13 x i8] c"foo@@V1: %d\0A\00"
define void @foo(i32 %0) {
%2 = tail call i32 (...) @internal_function_is_not_visible()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}