xunge/DecIR huggingface dataset:
/* Type definitions */
struct ttf_header {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ create_glyp_loca(int /*<<< orphan*/ *, struct ttf_header *);
int /*<<< orphan*/ create_name(struct ttf_header *);
int /*<<< orphan*/ create_post(struct ttf_header *);
void create_missingtables(FILE *pcl, struct ttf_header *hdr) {
  create_glyp_loca(pcl, hdr);
  create_post(hdr);
  create_name(hdr);
}


x86 assembly (clang, -O0):
<create_missingtables>:
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 <create_glyp_loca@plt>
mov    -0x10(%rbp),%rdi
call   1050 <create_post@plt>
mov    -0x10(%rbp),%rdi
call   1040 <create_name@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_missingtables>:
push   %rbx
mov    %rsi,%rbx
call   1030 <create_glyp_loca@plt>
mov    %rbx,%rdi
call   1050 <create_post@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <create_name@plt>

LLVM IR (-O0):
%struct.ttf_header = type { i32 }
define void @create_missingtables(i32* %0, %struct.ttf_header* %1) {
%3 = alloca i32*
%4 = alloca %struct.ttf_header*
store i32* %0, i32** %3
store %struct.ttf_header* %1, %struct.ttf_header** %4
%5 = load i32*, i32** %3
%6 = load %struct.ttf_header*, %struct.ttf_header** %4
%7 = call i32 @create_glyp_loca(i32* %5, %struct.ttf_header* %6)
%8 = load %struct.ttf_header*, %struct.ttf_header** %4
%9 = call i32 @create_post(%struct.ttf_header* %8)
%10 = load %struct.ttf_header*, %struct.ttf_header** %4
%11 = call i32 @create_name(%struct.ttf_header* %10)
ret void
}

LLVM IR (-O2):
%struct.ttf_header = type { i32 }
define void @create_missingtables(i32* %0, %struct.ttf_header* %1) {
%3 = tail call i32 @create_glyp_loca(i32* %0, %struct.ttf_header* %1)
%4 = tail call i32 @create_post(%struct.ttf_header* %1)
%5 = tail call i32 @create_name(%struct.ttf_header* %1)
ret void
}
/* Variables and functions */
unsigned short *sn_io_addr(unsigned long);
int /*<<< orphan*/ sn_mmiob();
void __sn_outw(unsigned short val, unsigned long port) {
  volatile unsigned short *addr;
  if ((addr = sn_io_addr(port))) {
    *addr = val;
    sn_mmiob();
  }
}


x86 assembly (clang, -O0):
<__sn_outw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <sn_io_addr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     115c <__sn_outw+0x3c>
mov    -0x2(%rbp),%cx
mov    -0x18(%rbp),%rax
mov    %cx,(%rax)
mov    $0x0,%al
call   1040 <sn_mmiob@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__sn_outw>:
push   %rbx
mov    %edi,%ebx
mov    %rsi,%rdi
call   1030 <sn_io_addr@plt>
test   %rax,%rax
je     113b <__sn_outw+0x1b>
mov    %bx,(%rax)
xor    %eax,%eax
pop    %rbx
jmp    1040 <sn_mmiob@plt>
pop    %rbx
ret

LLVM IR (-O0):
define void @__sn_outw(i16 zeroext %0, i64 %1) {
%3 = alloca i16
%4 = alloca i64
%5 = alloca i16*
store i16 %0, i16* %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = call i16* @sn_io_addr(i64 %6)
store i16* %7, i16** %5
%8 = icmp ne i16* %7, null
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i16, i16* %3
%11 = load i16*, i16** %5
store volatile i16 %10, i16* %11
%12 = call i32 (...) @sn_mmiob()
br label %13
13: ; preds = %9, %2
ret void
}

LLVM IR (-O2):
define void @__sn_outw(i16 zeroext %0, i64 %1) {
%3 = tail call i16* @sn_io_addr(i64 %1)
%4 = icmp eq i16* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
store volatile i16 %0, i16* %3
%6 = tail call i32 (...) @sn_mmiob()
br label %7
7: ; preds = %5, %2
ret void
}
/* Variables and functions */
int foo(int);
int obj4func2(int a) { return foo(a) + 43; }


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

x86 assembly (clang, -O2):
<obj4func2>:
push   %rax
call   1030 <foo@plt>
add    $0x2b,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @obj4func2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @foo(i32 %3)
%5 = add nsw i32 %4, 43
ret i32 %5
}

LLVM IR (-O2):
define i32 @obj4func2(i32 %0) {
%2 = tail call i32 @foo(i32 %0)
%3 = add nsw i32 %2, 43
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_tagstruct_get_cvolume() {
  printf("NOT IMPLEMENTED:"
         "pa_tagstruct_get_cvolume"
         "\n");
}


x86 assembly (clang, -O0):
<pa_tagstruct_get_cvolume>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [42 x i8] c"NOT IMPLEMENTED:pa_tagstruct_get_cvolume\0A\00"
define i32 @pa_tagstruct_get_cvolume() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [41 x i8] c"NOT IMPLEMENTED:pa_tagstruct_get_cvolume\00"
define i32 @pa_tagstruct_get_cvolume() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
int lge_get_download_mode(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @lge_get_download_mode() {
ret i32 0
}
int test_imm_4Buint16_reg(unsigned short val) {
  return ((val) & (0x4B << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_4Buint16_reg>:
test   $0x4b,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_4Buint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 75
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
error(s1, s2) char *s1, *s2;
{
  printf("dc: ");
  printf(s1, s2);
  printf("\n");
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<error>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xecf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"dc: \00"
define i32 @error(i8* nocapture %0, i8* %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %0, i8* %1)
%5 = tail call i32 @putchar(i32 10)
ret i32 undef
}
int find_endLine(char c) { return (c == '\0' || c == '\n') ? 1 : 0; }


x86 assembly (clang, -O0):
<find_endLine>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x2(%rbp)
je     1129 <find_endLine+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0xa,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_endLine>:
test   %dil,%dil
sete   %al
cmp    $0xa,%dil
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @find_endLine(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 10
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ true, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i64
%13 = select i1 %11, i32 1, i32 0
ret i32 %13
}

LLVM IR (-O2):
define i32 @find_endLine(i8 signext %0) {
%2 = icmp eq i8 %0, 0
%3 = icmp eq i8 %0, 10
%4 = or i1 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ fatal();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void memory(void) {
  fprintf(stderr, "cc: out of memory.\n");
  fatal();
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"cc: out of memory.\0A\00"
define void @memory() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @fatal()
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"cc: out of memory.\0A\00"
define void @memory() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @fatal()
ret void
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int syscon_initialize_number_of_standard_polynomials(int length) {
  int *b, fail;
  double *c;
  fail = _ada_use_c2phc(23, &length, b, c);
  return fail;
}


x86 assembly (clang, -O0):
<syscon_initialize_number_of_standard_polynomials>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x17,%edi
lea    -0x4(%rbp),%rsi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<syscon_initialize_number_of_standard_polynomials>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x17,%edi
call   1030 <_ada_use_c2phc@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @syscon_initialize_number_of_standard_polynomials(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
%5 = alloca double*
store i32 %0, i32* %2
%6 = load i32*, i32** %3
%7 = load double*, double** %5
%8 = call i32 @_ada_use_c2phc(i32 23, i32* %2, i32* %6, double* %7)
store i32 %8, i32* %4
%9 = load i32, i32* %4
ret i32 %9
}

LLVM IR (-O2):
define i32 @syscon_initialize_number_of_standard_polynomials(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @_ada_use_c2phc(i32 23, i32* %2, i32* undef, double* undef)
ret i32 %3
}
int main() {
  int b;
  int *a;
  a = &b;
  *a = 5;
  a = a + 1;
  a = a - 1;
  return *a;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x5,(%rax)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0xfffffffffffffffc,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 5
}
/* Variables and functions */
int /*<<< orphan*/ process_can(int);
void CAN2_TX_IRQHandler() { process_can(1); }


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

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

LLVM IR (-O0):
define void @CAN2_TX_IRQHandler() {
%1 = call i32 @process_can(i32 1)
ret void
}

LLVM IR (-O2):
define void @CAN2_TX_IRQHandler() {
%1 = tail call i32 @process_can(i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("pthread_mutex_getprioceiling not supported\n");
  return 4;
}


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

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

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

LLVM IR (-O2):
@str = [43 x i8] c"pthread_mutex_getprioceiling not supported\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
ret i32 4
}
/* Type definitions */
struct log {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ logger_write_time(struct log *, char *);
void logger_stop(struct log *log) { logger_write_time(log, "stop"); }


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

x86 assembly (clang, -O2):
<logger_stop>:
lea    0xee9(%rip),%rsi
jmp    1030 <logger_write_time@plt>

LLVM IR (-O0):
%struct.log = type { i32 }
@.str = [5 x i8] c"stop\00"
define void @logger_stop(%struct.log* %0) {
%2 = alloca %struct.log*
store %struct.log* %0, %struct.log** %2
%3 = load %struct.log*, %struct.log** %2
%4 = call i32 @logger_write_time(%struct.log* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.log = type { i32 }
@.str = [5 x i8] c"stop\00"
define void @logger_stop(%struct.log* %0) {
%2 = tail call i32 @logger_write_time(%struct.log* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void CloseOpenFiles() {
  int i;
  for (i = 3; i < 1024; i++)
    close(i);
}


x86 assembly (clang, -O0):
<CloseOpenFiles>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x3,-0x4(%rbp)
cmpl   $0x400,-0x4(%rbp)
jge    1142 <CloseOpenFiles+0x32>
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <CloseOpenFiles+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CloseOpenFiles>:
push   %rbx
mov    $0x3,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1030 <close@plt>
add    $0x1,%ebx
cmp    $0x400,%ebx
jne    1120 <CloseOpenFiles+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @CloseOpenFiles() {
%1 = alloca i32
store i32 3, i32* %1
br label %2
2: ; preds = %8, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 1024
br i1 %4, label %5, label %11
5: ; preds = %2
%6 = load i32, i32* %1
%7 = call i32 @close(i32 %6)
br label %8
8: ; preds = %5
%9 = load i32, i32* %1
%10 = add nsw i32 %9, 1
store i32 %10, i32* %1
br label %2
11: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @CloseOpenFiles() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 3, %0 ], [ %4, %1 ]
%3 = tail call i32 @close(i32 %2)
%4 = add nuw nsw i32 %2, 1
%5 = icmp eq i32 %4, 1024
br i1 %5, label %6, label %1
6: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ islower(int);
void t_islower_0xd3() {
  Assert_real((islower(211) == 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_islower.c",
              1060, ("islower should be 0 for 0xd3"));
}


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

x86 assembly (clang, -O2):
<t_islower_0xd3>:
push   %rax
mov    $0xd3,%edi
call   1030 <islower@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x424,%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_islower.c\00"
@.str.1 = [29 x i8] c"islower should be 0 for 0xd3\00"
define void @t_islower_0xd3() {
%1 = call i64 @islower(i32 211)
%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 1060, 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_islower.c\00"
@.str.1 = [29 x i8] c"islower should be 0 for 0xd3\00"
define void @t_islower_0xd3() {
%1 = tail call i64 @islower(i32 211)
%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 1060, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_key_t;

/* Variables and functions */
int errno;
int pthread_setspecific(int /*<<< orphan*/, void *);
int tosTLS_setValue(pthread_key_t key, void *val) {
  int res = 0;
  res = pthread_setspecific(key, val);
  if (res) {
    errno = res;
    res = -1;
  }
  return res;
}


x86 assembly (clang, -O0):
<tosTLS_setValue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <pthread_setspecific@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1152 <tosTLS_setValue+0x42>
mov    -0x14(%rbp),%ecx
mov    0x2e97(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tosTLS_setValue>:
push   %rax
call   1030 <pthread_setspecific@plt>
test   %eax,%eax
je     112a <tosTLS_setValue+0x1a>
mov    0x2ebf(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@errno = global i32 0
define i32 @tosTLS_setValue(i32 %0, i8* %1) {
%3 = tail call i32 @pthread_setspecific(i32 %0, i8* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %6, label %5
5: ; preds = %2
store i32 %3, i32* @errno
br label %6
6: ; preds = %5, %2
%7 = phi i32 [ -1, %5 ], [ 0, %2 ]
ret i32 %7
}
double max(double a, double b, double alfa) {
  double max = (a > b) ? a : b;
  return (max > alfa) ? max : alfa;
}


x86 assembly (clang, -O0):
<max>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1132 <max+0x32>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    113c <max+0x3c>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1165 <max+0x65>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    116f <max+0x6f>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<max>:
maxsd  %xmm1,%xmm0
maxsd  %xmm2,%xmm0
ret

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

LLVM IR (-O2):
define double @max(double %0, double %1, double %2) {
%4 = fcmp ogt double %0, %1
%5 = select i1 %4, double %0, double %1
%6 = fcmp ogt double %5, %2
%7 = select i1 %6, double %5, double %2
ret double %7
}
void cae(int a, int b, int c) {}


x86 assembly (clang, -O0):
<cae>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @cae(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
ret void
}

LLVM IR (-O2):
define void @cae(i32 %0, i32 %1, i32 %2) {
ret void
}
int do_010() { return 10; }


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

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

LLVM IR (-O0):
define i32 @do_010() {
ret i32 10
}

LLVM IR (-O2):
define i32 @do_010() {
ret i32 10
}
/* Type definitions */
typedef unsigned int uint8_t;

/* Variables and functions */
unsigned int mput3b(unsigned int value, uint8_t *data) {
  data[2] = value & 0xff;
  data[1] = (value >> 8) & 0xff;
  data[0] = (value >> 16) & 0xff;
  return data[0];
}


x86 assembly (clang, -O0):
<mput3b>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x4(%rbp),%ecx
shr    $0x8,%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x4(%rbp),%ecx
shr    $0x10,%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mput3b>:
mov    %edi,%eax
movzbl %al,%ecx
mov    %ecx,0x8(%rsi)
movzbl %ah,%ecx
mov    %ecx,0x4(%rsi)
shr    $0x10,%eax
movzbl %al,%eax
mov    %eax,(%rsi)
ret

LLVM IR (-O0):
define i32 @mput3b(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 = and i32 %5, 255
%7 = load i32*, i32** %4
%8 = getelementptr inbounds i32, i32* %7, i64 2
store i32 %6, i32* %8
%9 = load i32, i32* %3
%10 = lshr i32 %9, 8
%11 = and i32 %10, 255
%12 = load i32*, i32** %4
%13 = getelementptr inbounds i32, i32* %12, i64 1
store i32 %11, i32* %13
%14 = load i32, i32* %3
%15 = lshr i32 %14, 16
%16 = and i32 %15, 255
%17 = load i32*, i32** %4
%18 = getelementptr inbounds i32, i32* %17, i64 0
store i32 %16, i32* %18
%19 = load i32*, i32** %4
%20 = getelementptr inbounds i32, i32* %19, i64 0
%21 = load i32, i32* %20
ret i32 %21
}

LLVM IR (-O2):
define i32 @mput3b(i32 %0, i32* nocapture writeonly %1) {
%3 = and i32 %0, 255
%4 = getelementptr inbounds i32, i32* %1, i64 2
store i32 %3, i32* %4
%5 = lshr i32 %0, 8
%6 = and i32 %5, 255
%7 = getelementptr inbounds i32, i32* %1, i64 1
store i32 %6, i32* %7
%8 = lshr i32 %0, 16
%9 = and i32 %8, 255
store i32 %9, i32* %1
ret i32 %9
}
void foo277() {}


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

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

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

LLVM IR (-O2):
define void @foo277() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ mbus_remote_register_write(int, int, int);
void snail_cnt_start(void) {
  mbus_remote_register_write(0x6, 0x01, ((0 << 5) | (1 << 4) | (2 << 2) | (1)));
}


x86 assembly (clang, -O0):
<snail_cnt_start>:
push   %rbp
mov    %rsp,%rbp
mov    $0x6,%edi
mov    $0x1,%esi
mov    $0x19,%edx
call   1030 <mbus_remote_register_write@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<snail_cnt_start>:
mov    $0x6,%edi
mov    $0x1,%esi
mov    $0x19,%edx
jmp    1030 <mbus_remote_register_write@plt>

LLVM IR (-O0):
define void @snail_cnt_start() {
%1 = call i32 @mbus_remote_register_write(i32 6, i32 1, i32 25)
ret void
}

LLVM IR (-O2):
define void @snail_cnt_start() {
%1 = tail call i32 @mbus_remote_register_write(i32 6, i32 1, i32 25)
ret void
}
void strcat_ptr(char *s, char *t) {
  while (*s++ != '\0')
    ;
  s -= 1;
  while ((*s++ = *t++) != '\0')
    ;
}


x86 assembly (clang, -O0):
<strcat_ptr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
je     112c <strcat_ptr+0x2c>
jmp    110c <strcat_ptr+0xc>
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
je     116b <strcat_ptr+0x6b>
jmp    1138 <strcat_ptr+0x38>
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcat_ptr>:
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1100 <strcat_ptr>
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
movzbl (%rsi,%rax,1),%ecx
mov    %cl,-0x1(%rdi,%rax,1)
add    $0x1,%rax
test   %cl,%cl
jne    1110 <strcat_ptr+0x10>
ret

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

LLVM IR (-O2):
define void @strcat_ptr(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %5, %3 ]
%5 = getelementptr inbounds i8, i8* %4, i64 1
%6 = load i8, i8* %4
%7 = icmp eq i8 %6, 0
br i1 %7, label %8, label %3
8: ; preds = %3, %8
%9 = phi i8* [ %13, %8 ], [ %4, %3 ]
%10 = phi i8* [ %11, %8 ], [ %1, %3 ]
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %10
%13 = getelementptr inbounds i8, i8* %9, i64 1
store i8 %12, i8* %9
%14 = icmp eq i8 %12, 0
br i1 %14, label %15, label %8
15: ; preds = %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, char *, int);
void dvr_name(int dvr, char *dvr_name, int len, char *adapter_name) {
  snprintf(dvr_name, len, "%s/dvr%d", adapter_name, dvr);
}


x86 assembly (clang, -O0):
<dvr_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rcx
mov    -0x4(%rbp),%r8d
lea    0xec4(%rip),%rdx
call   1030 <snprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dvr_name>:
mov    %edi,%r8d
lea    0xee6(%rip),%rax
mov    %rsi,%rdi
mov    %edx,%esi
mov    %rax,%rdx
jmp    1030 <snprintf@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"%s/dvr%d\00"
define void @dvr_name(i32 %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
store i32 %0, i32* %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%9 = load i8*, i8** %6
%10 = load i32, i32* %7
%11 = load i8*, i8** %8
%12 = load i32, i32* %5
%13 = call i32 @snprintf(i8* %9, i32 %10, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %11, i32 %12)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"%s/dvr%d\00"
define void @dvr_name(i32 %0, i8* %1, i32 %2, i8* %3) {
%5 = tail call i32 @snprintf(i8* %1, i32 %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %3, i32 %0)
ret void
}
/* Variables and functions */
void *obs_output_get_ref(void *);
void *obs_output_addref_safe_(void *ref) { return obs_output_get_ref(ref); }


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

x86 assembly (clang, -O2):
<obs_output_addref_safe_>:
jmp    1030 <obs_output_get_ref@plt>

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

LLVM IR (-O2):
define i8* @obs_output_addref_safe_(i8* %0) {
%2 = tail call i8* @obs_output_get_ref(i8* %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ strcmp(char *, char const *);
int strm(const char *mode) {
  if (!strcmp("SERVER", mode))
    return 0;
  if (!strcmp("CLIENT", mode))
    return 1;
  return -1;
}


x86 assembly (clang, -O0):
<strm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xed9(%rip),%rdi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1141 <strm+0x31>
movl   $0x0,-0x4(%rbp)
jmp    116d <strm+0x5d>
mov    -0x10(%rbp),%rsi
lea    0xebb(%rip),%rdi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1166 <strm+0x56>
movl   $0x1,-0x4(%rbp)
jmp    116d <strm+0x5d>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strm>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     113f <strm+0x2f>
lea    0xed9(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
neg    %eax
sbb    %eax,%eax
or     $0x1,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"SERVER\00"
@.str.1 = [7 x i8] c"CLIENT\00"
define i32 @strm(i8* nocapture %0) {
%2 = tail call i32 @strcmp(i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* dereferenceable(1) %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @strcmp(i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* dereferenceable(1) %0)
%6 = icmp eq i32 %5, 0
%7 = select i1 %6, i32 1, i32 -1
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 0, %1 ], [ %7, %4 ]
ret i32 %9
}
int foo7() { return 1; }


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

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

LLVM IR (-O0):
define i32 @foo7() {
ret i32 1
}

LLVM IR (-O2):
define i32 @foo7() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void Usage() {
  printf("shptreedump [-maxdepth n] [-search xmin ymin xmax ymax]\n"
         "            [-v] shp_file\n");
  exit(1);
}


x86 assembly (clang, -O0):
<Usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<Usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [83 x i8] c"shptreedump [-maxdepth n] [-search xmin ymin xmax ymax]\0A [-v] shp_file\0A\00"
define void @Usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [82 x i8] c"shptreedump [-maxdepth n] [-search xmin ymin xmax ymax]\0A [-v] shp_file\00"
define void @Usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([82 x i8], [82 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
__attribute__((noclone, no, noipa)) char *get_max_3(char *p, char *q) {
  return p < q ? q + 1 : p + 1;
}


x86 assembly (clang, -O0):
<get_max_3>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    112b <get_max_3+0x2b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1137 <get_max_3+0x37>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_max_3>:
cmp    %rsi,%rdi
cmovb  %rsi,%rdi
lea    0x1(%rdi),%rax
ret

LLVM IR (-O0):
define i8* @get_max_3(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 = icmp ult i8* %5, %6
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i8*, i8** %4
%10 = getelementptr inbounds i8, i8* %9, i64 1
br label %14
11: ; preds = %2
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i64 1
br label %14
14: ; preds = %11, %8
%15 = phi i8* [ %10, %8 ], [ %13, %11 ]
ret i8* %15
}

LLVM IR (-O2):
define i8* @get_max_3(i8* readnone %0, i8* readnone %1) {
%3 = icmp ult i8* %0, %1
%4 = select i1 %3, i8* %1, i8* %0
%5 = getelementptr inbounds i8, i8* %4, i64 1
ret i8* %5
}
void kernel_fpu_end(void) {}


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

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

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

LLVM IR (-O2):
define void @kernel_fpu_end() {
ret void
}
void __foo(void) {}


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

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

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

LLVM IR (-O2):
define void @__foo() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int M420_f(char *s) {
  debug("M420_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<M420_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M420_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf06(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"M420_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M420_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [47 x i8] c"M420_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M420_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
main() { puts("hello world"); }


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

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

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

LLVM IR (-O2):
@.str = [12 x i8] c"hello world\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void print_err(char *str) { fprintf(stderr, str); }


x86 assembly (clang, -O0):
<print_err>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_err>:
mov    %rdi,%rsi
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
define void @print_err(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
define void @print_err(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* %0)
ret void
}
/* Variables and functions */
int f(int);
int main(int argc, char *argv[]) { return f(argc); }


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    -0x8(%rbp),%edi
call   1030 <f@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
jmp    1030 <f@plt>

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 i32, i32* %4
%7 = call i32 @f(i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @f(i32 %0)
ret i32 %3
}
void init_bcache(void) { return; }


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

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

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

LLVM IR (-O2):
define void @init_bcache() {
ret void
}
/* Variables and functions */
int UART_read();
long millis();
int EspDrv_timedRead() {
  int c;
  long _timeout = 10000;
  long _startMillis = millis();
  do {
    c = UART_read();
    if (c >= 0)
      return c;
  } while (millis() - _startMillis < _timeout);
  return -1;
}


x86 assembly (clang, -O0):
<EspDrv_timedRead>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movq   $0x2710,-0x10(%rbp)
mov    $0x0,%al
call   1040 <millis@plt>
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <UART_read@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     115a <EspDrv_timedRead+0x3a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117b <EspDrv_timedRead+0x5b>
jmp    115f <EspDrv_timedRead+0x3f>
mov    $0x0,%al
call   1040 <millis@plt>
sub    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jl     113b <EspDrv_timedRead+0x1b>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EspDrv_timedRead>:
push   %rbx
xor    %eax,%eax
call   1040 <millis@plt>
mov    %rax,%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <UART_read@plt>
test   %eax,%eax
jns    1152 <EspDrv_timedRead+0x32>
xor    %eax,%eax
call   1040 <millis@plt>
sub    %rbx,%rax
cmp    $0x2710,%rax
jl     1130 <EspDrv_timedRead+0x10>
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @EspDrv_timedRead() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64
%4 = alloca i64
store i64 10000, i64* %3
%5 = call i64 (...) @millis()
store i64 %5, i64* %4
br label %6
6: ; preds = %13, %0
%7 = call i32 (...) @UART_read()
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = icmp sge i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = load i32, i32* %2
store i32 %11, i32* %1
br label %20
12: ; preds = %6
br label %13
13: ; preds = %12
%14 = call i64 (...) @millis()
%15 = load i64, i64* %4
%16 = sub nsw i64 %14, %15
%17 = load i64, i64* %3
%18 = icmp slt i64 %16, %17
br i1 %18, label %6, label %19
19: ; preds = %13
store i32 -1, i32* %1
br label %20
20: ; preds = %19, %10
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
define i32 @EspDrv_timedRead() {
%1 = tail call i64 (...) @millis()
br label %2
2: ; preds = %5, %0
%3 = tail call i32 (...) @UART_read()
%4 = icmp sgt i32 %3, -1
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = tail call i64 (...) @millis()
%7 = sub nsw i64 %6, %1
%8 = icmp slt i64 %7, 10000
br i1 %8, label %2, label %9
9: ; preds = %5, %2
%10 = phi i32 [ %3, %2 ], [ -1, %5 ]
ret i32 %10
}
int ft_nbrlen(int nb) {
  int ret;
  ret = 0;
  while (nb) {
    nb /= 10;
    ++ret;
  }
  return (ret);
}


x86 assembly (clang, -O0):
<ft_nbrlen>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1134 <ft_nbrlen+0x34>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <ft_nbrlen+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_nbrlen>:
xor    %eax,%eax
test   %edi,%edi
je     1132 <ft_nbrlen+0x32>
cs nopw 0x0(%rax,%rax,1)
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
add    $0x1,%eax
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <ft_nbrlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @ft_nbrlen(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = sdiv i32 %5, 10
%7 = add nuw nsw i32 %4, 1
%8 = add i32 %5, 9
%9 = icmp ult i32 %8, 19
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
void *malloc(size_t);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
int /*<<< orphan*/ printf(char *);
void *xmalloc(size_t len) {
  void *vec = NULL;
  vec = malloc(len);
  if (vec == NULL) {
    printf("Out of Memory. Exiting.\n");
    fflush(NULL);
    exit(EXIT_FAILURE);
  }
  memset(vec, 0, len);
  return vec;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    119f <xmalloc+0x4f>
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <fflush@plt>
mov    0x2e48(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <malloc@plt>
test   %rax,%rax
je     117c <xmalloc+0x2c>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1040 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe7d(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1060 <fflush@plt>
mov    0x2e4a(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"Out of Memory. Exiting.\0A\00"
@EXIT_FAILURE = global i32 0
define i8* @xmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
store i8* null, i8** %3
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @fflush(i32* null)
%11 = load i32, i32* @EXIT_FAILURE
%12 = call i32 @exit(i32 %11)
unreachable
13: ; preds = %1
%14 = load i8*, i8** %3
%15 = load i64, i64* %2
%16 = call i32 @memset(i8* %14, i32 0, i64 %15)
%17 = load i8*, i8** %3
ret i8* %17
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@str = [24 x i8] c"Out of Memory. Exiting.\00"
define i8* @xmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @fflush(i32* null)
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %1
%10 = tail call i32 @memset(i8* %2, i32 0, i64 %0)
ret i8* %2
}