xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ tfx_view_get_height(int /*<<< orphan*/);
int /*<<< orphan*/ tfx_view_get_width(int /*<<< orphan*/);
void tfx_view_get_dimensions(uint8_t id, uint16_t *w, uint16_t *h) {
  if (w) {
    *w = tfx_view_get_width(id);
  }
  if (h) {
    *h = tfx_view_get_height(id);
  }
}


x86 assembly (clang, -O0):
<tfx_view_get_dimensions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114e <tfx_view_get_dimensions+0x2e>
mov    -0x4(%rbp),%edi
call   1040 <tfx_view_get_width@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     1169 <tfx_view_get_dimensions+0x49>
mov    -0x4(%rbp),%edi
call   1030 <tfx_view_get_height@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tfx_view_get_dimensions>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %edi,%ebp
test   %rsi,%rsi
je     113a <tfx_view_get_dimensions+0x1a>
mov    %rsi,%rbx
mov    %ebp,%edi
call   1040 <tfx_view_get_width@plt>
mov    %eax,(%rbx)
test   %r14,%r14
je     1149 <tfx_view_get_dimensions+0x29>
mov    %ebp,%edi
call   1030 <tfx_view_get_height@plt>
mov    %eax,(%r14)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @tfx_view_get_dimensions(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
%7 = load i32*, i32** %5
%8 = icmp ne i32* %7, null
br i1 %8, label %9, label %13
9: ; preds = %3
%10 = load i32, i32* %4
%11 = call i32 @tfx_view_get_width(i32 %10)
%12 = load i32*, i32** %5
store i32 %11, i32* %12
br label %13
13: ; preds = %9, %3
%14 = load i32*, i32** %6
%15 = icmp ne i32* %14, null
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i32, i32* %4
%18 = call i32 @tfx_view_get_height(i32 %17)
%19 = load i32*, i32** %6
store i32 %18, i32* %19
br label %20
20: ; preds = %16, %13
ret void
}

LLVM IR (-O2):
define void @tfx_view_get_dimensions(i32 %0, i32* writeonly %1, i32* writeonly %2) {
%4 = icmp eq i32* %1, null
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @tfx_view_get_width(i32 %0)
store i32 %6, i32* %1
br label %7
7: ; preds = %5, %3
%8 = icmp eq i32* %2, null
br i1 %8, label %11, label %9
9: ; preds = %7
%10 = tail call i32 @tfx_view_get_height(i32 %0)
store i32 %10, i32* %2
br label %11
11: ; preds = %9, %7
ret void
}
/* Variables and functions */
char *bin_add(char *, char *);
char *flip_da_bits(char *);
char *pad_bin(char *, int);
scalar_t__ strlen(char *);
char *bin_sub(char *bin_one, char *bin_two) {
  bin_two = flip_da_bits(bin_two);
  bin_two = bin_add(pad_bin("1", (int)strlen(bin_two)), bin_two);
  return bin_add(bin_one, bin_two);
}


x86 assembly (clang, -O0):
<bin_sub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <flip_da_bits@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%esi
lea    0xe91(%rip),%rdi
call   1060 <pad_bin@plt>
mov    %rax,%rdi
mov    -0x10(%rbp),%rsi
call   1040 <bin_add@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <bin_add@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bin_sub>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    %rsi,%rdi
call   1050 <flip_da_bits@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <strlen@plt>
lea    0xe9f(%rip),%rdi
mov    %eax,%esi
call   1060 <pad_bin@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
call   1040 <bin_add@plt>
mov    %r14,%rdi
mov    %rax,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <bin_add@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"1\00"
define i8* @bin_sub(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = call i8* @flip_da_bits(i8* %5)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = call i64 @strlen(i8* %7)
%9 = trunc i64 %8 to i32
%10 = call i8* @pad_bin(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i8*, i8** %4
%12 = call i8* @bin_add(i8* %10, i8* %11)
store i8* %12, i8** %4
%13 = load i8*, i8** %3
%14 = load i8*, i8** %4
%15 = call i8* @bin_add(i8* %13, i8* %14)
ret i8* %15
}

LLVM IR (-O2):
@.str = [2 x i8] c"1\00"
define i8* @bin_sub(i8* %0, i8* %1) {
%3 = tail call i8* @flip_da_bits(i8* %1)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %3)
%5 = trunc i64 %4 to i32
%6 = tail call i8* @pad_bin(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i8* @bin_add(i8* %6, i8* %3)
%8 = tail call i8* @bin_add(i8* %0, i8* %7)
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int example(int v) {
  printf("%d\n", v);
  return v;
}


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

x86 assembly (clang, -O2):
<example>:
push   %rbx
mov    %edi,%ebx
lea    0xee6(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @example(i32 returned %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i32 %0
}
/* Variables and functions */
int rom_present(char *);
int s3_virge_375_available() { return rom_present("86c375_1.bin"); }


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"86c375_1.bin\00"
define i32 @s3_virge_375_available() {
%1 = call i32 @rom_present(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [13 x i8] c"86c375_1.bin\00"
define i32 @s3_virge_375_available() {
%1 = tail call i32 @rom_present(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
void fn(A) int A;
{}


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

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

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

LLVM IR (-O2):
define void @fn(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ usage_error();
void validate_argument_count(int argc) {
  if (argc < 2)
    usage_error();
}


x86 assembly (clang, -O0):
<validate_argument_count>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x2,-0x4(%rbp)
jge    112c <validate_argument_count+0x1c>
mov    $0x0,%al
call   1030 <usage_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validate_argument_count>:
cmp    $0x1,%edi
jg     111c <validate_argument_count+0xc>
xor    %eax,%eax
jmp    1030 <usage_error@plt>
ret

LLVM IR (-O0):
define void @validate_argument_count(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 2
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (...) @usage_error()
br label %7
7: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @validate_argument_count(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @usage_error()
br label %5
5: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(short *, void *, int);
short ntohs(short);
short wd_get_net_package_cmd(void *pg) {
  short tmp_short = 0;
  memcpy(&tmp_short, pg, sizeof(short));
  return ntohs(tmp_short);
}


x86 assembly (clang, -O0):
<wd_get_net_package_cmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movw   $0x0,-0xa(%rbp)
mov    -0x8(%rbp),%rsi
lea    -0xa(%rbp),%rdi
mov    $0x2,%edx
call   1030 <memcpy@plt>
movswl -0xa(%rbp),%edi
call   1040 <ntohs@plt>
cwtl
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wd_get_net_package_cmd>:
push   %rax
mov    %rdi,%rsi
movw   $0x0,0x6(%rsp)
lea    0x6(%rsp),%rdi
mov    $0x2,%edx
call   1030 <memcpy@plt>
movswl 0x6(%rsp),%edi
call   1040 <ntohs@plt>
pop    %rcx
ret

LLVM IR (-O0):
define signext i16 @wd_get_net_package_cmd(i8* %0) {
%2 = alloca i8*
%3 = alloca i16
store i8* %0, i8** %2
store i16 0, i16* %3
%4 = load i8*, i8** %2
%5 = call i32 @memcpy(i16* %3, i8* %4, i32 2)
%6 = load i16, i16* %3
%7 = call signext i16 @ntohs(i16 signext %6)
ret i16 %7
}

LLVM IR (-O2):
define signext i16 @wd_get_net_package_cmd(i8* %0) {
%2 = alloca i16
%3 = bitcast i16* %2 to i8*
store i16 0, i16* %2
%4 = call i32 @memcpy(i16* %2, i8* %0, i32 2)
%5 = load i16, i16* %2
%6 = call signext i16 @ntohs(i16 signext %5)
ret i16 %6
}
void X509_get_issuer_name(void) {}


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

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

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

LLVM IR (-O2):
define void @X509_get_issuer_name() {
ret void
}
void INT_Excep_PERIB_INTB169(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_PERIB_INTB169() {
ret void
}
int fior(int a, int b) {
  int tmp;
  a = __builtin_bswap32(a);
  b = __builtin_bswap32(b);
  tmp = a | b;
  return __builtin_bswap32(tmp);
}


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

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

LLVM IR (-O0):
define i32 @fior(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = call i32 @llvm.bswap.i32(i32 %6)
store i32 %7, i32* %3
%8 = load i32, i32* %4
%9 = call i32 @llvm.bswap.i32(i32 %8)
store i32 %9, i32* %4
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = or i32 %10, %11
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = call i32 @llvm.bswap.i32(i32 %13)
ret i32 %14
}

LLVM IR (-O2):
define i32 @fior(i32 %0, i32 %1) {
%3 = or i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ fatal(char *);
unsigned int le_read16(unsigned char const *);
unsigned decode_waypoint_id(const unsigned char *buffer) {
  unsigned id = le_read16(buffer + 2);
  if (id >= 1000) {
    fatal("NAVILINK"
          ": Invalid waypoint ID\n");
  }
  return id;
}


x86 assembly (clang, -O0):
<decode_waypoint_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x2,%rdi
call   1030 <le_read16@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jb     1155 <decode_waypoint_id+0x35>
lea    0xeb0(%rip),%rdi
call   1040 <fatal@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_waypoint_id>:
push   %rbx
add    $0x2,%rdi
call   1030 <le_read16@plt>
mov    %eax,%ebx
cmp    $0x3e8,%eax
jb     113f <decode_waypoint_id+0x1f>
lea    0xec6(%rip),%rdi
call   1040 <fatal@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"NAVILINK: Invalid waypoint ID\0A\00"
define i32 @decode_waypoint_id(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 2
%6 = call i32 @le_read16(i8* %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp uge i32 %7, 1000
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @fatal(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %1
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
@.str = [31 x i8] c"NAVILINK: Invalid waypoint ID\0A\00"
define i32 @decode_waypoint_id(i8* %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 2
%3 = tail call i32 @le_read16(i8* %2)
%4 = icmp ugt i32 %3, 999
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @fatal(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
int serialport_write(int, char const *);
void write_line(int fd, const char *text) {
  int ret = serialport_write(fd, text);
  if (ret == -1) {
    printf("Error writing %s\n", text);
  }
}


x86 assembly (clang, -O0):
<write_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <serialport_write@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1158 <write_line+0x38>
mov    -0x10(%rbp),%rsi
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_line>:
push   %rbx
mov    %rsi,%rbx
call   1040 <serialport_write@plt>
cmp    $0xffffffff,%eax
je     1130 <write_line+0x10>
pop    %rbx
ret
lea    0xec9(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [18 x i8] c"Error writing %s\0A\00"
define void @write_line(i32 %0, i8* %1) {
%3 = tail call i32 @serialport_write(i32 %0, i8* %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %7
7: ; preds = %5, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, int, int, int);
main(void) {
  int toes = 10;
  int dtoes = toes * 2;
  int toes2 = toes * toes;
  printf("toes=%d\n2±¶toes=%d\ntoesµÄÆ½·½=%d\n", toes, dtoes, toes2);
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [42 x i8] c"toes=%d\0A2\C2\B1\C2\B6toes=%d\0Atoes\C2\B5\C3\84\C3\86\C2\BD\C2\B7\C2\BD=%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
%5 = load i32, i32* %2
%6 = mul nsw i32 %5, 2
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = load i32, i32* %2
%9 = mul nsw i32 %7, %8
store i32 %9, i32* %4
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %11, i32 %12)
%14 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [42 x i8] c"toes=%d\0A2\C2\B1\C2\B6toes=%d\0Atoes\C2\B5\C3\84\C3\86\C2\BD\C2\B7\C2\BD=%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 10, i32 20, i32 100)
%2 = tail call i32 (...) @getchar()
ret i32 0
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
uint16_t crc16_ccitt_init(void) { return 0xFFFF; }


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

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

LLVM IR (-O0):
define i32 @crc16_ccitt_init() {
ret i32 65535
}

LLVM IR (-O2):
define i32 @crc16_ccitt_init() {
ret i32 65535
}
volatile unsigned long long RDTSC() {
  register unsigned long long TSC asm("eax");
  asm volatile(".byte 0xf, 0x31" : : : "eax", "edx");
  return TSC;
}


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

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

LLVM IR (-O0):
define i64 @RDTSC() {
%1 = alloca i64
%2 = load i64, i64* %1
ret i64 %2
}

LLVM IR (-O2):
define i64 @RDTSC() {
tail call void asm sideeffect ".byte 0xf, 0x31", "~{eax},~{edx},~{dirflag},~{fpsr},~{flags}"()
ret i64 undef
}
/* Variables and functions */
int /*<<< orphan*/ *strstr(char const *, char const *);
int gsm_compare(const char *str_at, const char *str_cmp) {
  return NULL == strstr(str_at, str_cmp) ? 0 : 1;
}


x86 assembly (clang, -O0):
<gsm_compare>:
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 <strstr@plt>
mov    %rax,%rsi
xor    %eax,%eax
mov    %eax,%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    %rsi,%rdx
cmove  %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @gsm_compare(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32* @strstr(i8* %5, i8* %6)
%8 = icmp eq i32* null, %7
%9 = zext i1 %8 to i64
%10 = select i1 %8, i32 0, i32 1
ret i32 %10
}

LLVM IR (-O2):
define i32 @gsm_compare(i8* %0, i8* nocapture %1) {
%3 = tail call i32* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%4 = icmp ne i32* %3, null
%5 = zext i1 %4 to i32
ret i32 %5
}
int test_imm_6Fuint32_reg(unsigned int val) {
  return ((val) & (0x6F << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_6Fuint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x6f,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_6Fuint32_reg(i32 %0) {
%2 = and i32 %0, 111
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void system_mb() {}


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

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

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

LLVM IR (-O2):
define void @system_mb() {
ret void
}
int gaspi_comp_ranks(const void *a, const void *b) {
  return (*(int *)a - *(int *)b);
}


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

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

LLVM IR (-O0):
define i32 @gaspi_comp_ranks(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 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @gaspi_comp_ranks(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Variables and functions */
scalar_t__ crc16_0x3D65_normal(unsigned char *, unsigned int, int, int);
short calc_crc(unsigned char *message, int msgsize) {
  return (short)crc16_0x3D65_normal(message, (unsigned int)msgsize, 0x0000,
                                    0xFFFF);
}


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

x86 assembly (clang, -O2):
<calc_crc>:
push   %rax
xor    %edx,%edx
mov    $0xffff,%ecx
call   1030 <crc16_0x3D65_normal@plt>
pop    %rcx
ret

LLVM IR (-O0):
define signext i16 @calc_crc(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i64 @crc16_0x3D65_normal(i8* %5, i32 %6, i32 0, i32 65535)
%8 = trunc i64 %7 to i16
ret i16 %8
}

LLVM IR (-O2):
define signext i16 @calc_crc(i8* %0, i32 %1) {
%3 = tail call i64 @crc16_0x3D65_normal(i8* %0, i32 %1, i32 0, i32 65535)
%4 = trunc i64 %3 to i16
ret i16 %4
}
int kapi_CharCount(char c, char *pString) {
  int count = 0;
  while (*pString) {
    if (*pString == c)
      count++;
    pString++;
  }
  return count;
}


x86 assembly (clang, -O0):
<kapi_CharCount>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     114f <kapi_CharCount+0x4f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x1(%rbp),%ecx
cmp    %ecx,%eax
jne    113e <kapi_CharCount+0x3e>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1115 <kapi_CharCount+0x15>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<kapi_CharCount>:
mov    (%rsi),%cl
test   %cl,%cl
je     1126 <kapi_CharCount+0x26>
add    $0x1,%rsi
xor    %eax,%eax
nopl   0x0(%rax)
xor    %edx,%edx
cmp    %dil,%cl
sete   %dl
add    %edx,%eax
movzbl (%rsi),%ecx
add    $0x1,%rsi
test   %cl,%cl
jne    1110 <kapi_CharCount+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @kapi_CharCount(i8 signext %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %13, %5 ], [ %3, %2 ]
%7 = phi i32 [ %11, %5 ], [ 0, %2 ]
%8 = phi i8* [ %12, %5 ], [ %1, %2 ]
%9 = icmp eq i8 %6, %0
%10 = zext i1 %9 to i32
%11 = add nuw nsw i32 %7, %10
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
%16 = phi i32 [ 0, %2 ], [ %11, %5 ]
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
int isqrt(int);
void t_sqrt_99() {
  Assert_real((isqrt(99) == 9),
              "/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/stdlib/isqrt.c",
              500, ("Integer square root of 99 should be 9"));
}


x86 assembly (clang, -O0):
<t_sqrt_99>:
push   %rbp
mov    %rsp,%rbp
mov    $0x63,%edi
call   1030 <isqrt@plt>
cmp    $0x9,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xec0(%rip),%rsi
mov    $0x1f4,%edx
lea    0xf56(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_sqrt_99>:
push   %rax
mov    $0x63,%edi
call   1030 <isqrt@plt>
xor    %edi,%edi
cmp    $0x9,%eax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf60(%rip),%rcx
mov    $0x1f4,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [162 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/stdlib/isqrt.c\00"
@.str.1 = [38 x i8] c"Integer square root of 99 should be 9\00"
define void @t_sqrt_99() {
%1 = call i32 @isqrt(i32 99)
%2 = icmp eq i32 %1, 9
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 500, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [162 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/stdlib/isqrt.c\00"
@.str.1 = [38 x i8] c"Integer square root of 99 should be 9\00"
define void @t_sqrt_99() {
%1 = tail call i32 @isqrt(i32 99)
%2 = icmp eq i32 %1, 9
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 500, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
struct stack {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct stack *);
int /*<<< orphan*/ stack_destroy(struct stack *, void (*)(struct link *));
void stack_delete(struct stack *__restrict stack,
                  void (*data_delete)(struct link *)) {
  stack_destroy(stack, data_delete);
  free(stack);
}


x86 assembly (clang, -O0):
<stack_delete>:
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   1040 <stack_destroy@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.stack = type { i32 }
%struct.link = type opaque
%struct.link.0 = type opaque
define void @stack_delete(%struct.stack* noalias %0, void (%struct.link*)* %1) {
%3 = alloca %struct.stack*
%4 = alloca void (%struct.link*)*
store %struct.stack* %0, %struct.stack** %3
store void (%struct.link*)* %1, void (%struct.link*)** %4
%5 = load %struct.stack*, %struct.stack** %3
%6 = load void (%struct.link*)*, void (%struct.link*)** %4
%7 = bitcast void (%struct.link*)* %6 to void (%struct.link.0*)*
%8 = call i32 @stack_destroy(%struct.stack* %5, void (%struct.link.0*)* %7)
%9 = load %struct.stack*, %struct.stack** %3
%10 = call i32 @free(%struct.stack* %9)
ret void
}

LLVM IR (-O2):
%struct.stack = type { i32 }
%struct.link = type opaque
%struct.link.0 = type opaque
define void @stack_delete(%struct.stack* noalias %0, void (%struct.link*)* %1) {
%3 = bitcast void (%struct.link*)* %1 to void (%struct.link.0*)*
%4 = tail call i32 @stack_destroy(%struct.stack* %0, void (%struct.link.0*)* %3)
%5 = tail call i32 @free(%struct.stack* %0)
ret void
}
void gkpd_write_value(int value) {}


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

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

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

LLVM IR (-O2):
define void @gkpd_write_value(i32 %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ quick_sort3(int /*<<< orphan*/ *, int /*<<< orphan*/,
                               int /*<<< orphan*/);
void sort3(int32_t *a, int32_t n) { quick_sort3(a, 0, n); }


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

x86 assembly (clang, -O2):
<sort3>:
mov    %esi,%edx
xor    %esi,%esi
jmp    1030 <quick_sort3@plt>

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

LLVM IR (-O2):
define void @sort3(i32* %0, i32 %1) {
%3 = tail call i32 @quick_sort3(i32* %0, i32 0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, int);
void log_msg(char *tag, int num) { printf("%s: %d\n", tag, num); }


x86 assembly (clang, -O0):
<log_msg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_msg>:
mov    %esi,%edx
mov    %rdi,%rsi
lea    0xee4(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [8 x i8] c"%s: %d\0A\00"
define void @log_msg(i8* %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
ret void
}
void *test_anti_range_119(int n) {
  extern void *alloc_anti_range_119(int) __attribute__((alloc_size(1)));
  if ((-0x7fffffff - 1) + 2 <= n && n <= 0)
    n = (-0x7fffffff - 1) + 2 - 1;
  return alloc_anti_range_119(n);
}


x86 assembly (clang, -O0):
<test_anti_range_119>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x80000002,%eax
cmp    -0x4(%rbp),%eax
jg     113a <test_anti_range_119+0x2a>
cmpl   $0x0,-0x4(%rbp)
jg     113a <test_anti_range_119+0x2a>
movl   $0x80000001,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <alloc_anti_range_119@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_anti_range_119>:
lea    0x7ffffffe(%rdi),%eax
cmp    $0x7fffffff,%eax
mov    $0x80000001,%eax
cmovb  %eax,%edi
jmp    1030 <alloc_anti_range_119@plt>

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

LLVM IR (-O2):
define i8* @test_anti_range_119(i32 %0) {
%2 = add i32 %0, 2147483646
%3 = icmp ult i32 %2, 2147483647
%4 = select i1 %3, i32 -2147483647, i32 %0
%5 = tail call i8* @alloc_anti_range_119(i32 %4)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ CALL(int);
main() {
  int max = 2147483647;
  CALL(max);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x7fffffff,%edi
call   1030 <CALL@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @CALL(i32 2147483647)
ret i32 0
}
/* Type definitions */
typedef scalar_t__ volatile uint32_t;

/* Variables and functions */
uint32_t UARTClockSourceGet(uint32_t ui32Base) {
  ;
  return ((*((volatile uint32_t *)(ui32Base + 0x00000FC8))));
}


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

x86 assembly (clang, -O2):
<UARTClockSourceGet>:
mov    %rdi,-0x8(%rsp)
mov    -0x8(%rsp),%rax
mov    0xfc8(%rax),%rax
ret

LLVM IR (-O0):
define i64 @UARTClockSourceGet(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
%3 = load volatile i64, i64* %2
%4 = add nsw i64 %3, 4040
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
ret i64 %6
}

LLVM IR (-O2):
define i64 @UARTClockSourceGet(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
%3 = load volatile i64, i64* %2
%4 = add nsw i64 %3, 4040
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
ret i64 %6
}
/* Type definitions */
struct pollfd {
  int fd;
};

/* Variables and functions */
int /*<<< orphan*/ SHUT_RDWR;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ shutdown(int, int /*<<< orphan*/);
void drop(struct pollfd *client) {
  shutdown(client->fd, SHUT_RDWR);
  close(client->fd);
  client->fd = -1;
}


x86 assembly (clang, -O0):
<drop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    0x2eb7(%rip),%rax
mov    (%rax),%esi
call   1030 <shutdown@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1040 <close@plt>
mov    -0x8(%rbp),%rax
movl   $0xffffffff,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drop>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%edi
mov    0x2ec3(%rip),%rax
mov    (%rax),%esi
call   1030 <shutdown@plt>
mov    (%rbx),%edi
call   1040 <close@plt>
movl   $0xffffffff,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
%struct.pollfd = type { i32 }
@SHUT_RDWR = global i32 0
define void @drop(%struct.pollfd* %0) {
%2 = alloca %struct.pollfd*
store %struct.pollfd* %0, %struct.pollfd** %2
%3 = load %struct.pollfd*, %struct.pollfd** %2
%4 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %3, i32 0, i32 0
%5 = load i32, i32* %4
%6 = load i32, i32* @SHUT_RDWR
%7 = call i32 @shutdown(i32 %5, i32 %6)
%8 = load %struct.pollfd*, %struct.pollfd** %2
%9 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %8, i32 0, i32 0
%10 = load i32, i32* %9
%11 = call i32 @close(i32 %10)
%12 = load %struct.pollfd*, %struct.pollfd** %2
%13 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %12, i32 0, i32 0
store i32 -1, i32* %13
ret void
}

LLVM IR (-O2):
%struct.pollfd = type { i32 }
@SHUT_RDWR = global i32 0
define void @drop(%struct.pollfd* nocapture %0) {
%2 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = load i32, i32* @SHUT_RDWR
%5 = tail call i32 @shutdown(i32 %3, i32 %4)
%6 = load i32, i32* %2
%7 = tail call i32 @close(i32 %6)
store i32 -1, i32* %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int errno;
void nl_close(int sd) {
  int saved_errno = errno;
  if (sd >= 0)
    close(sd);
  errno = (saved_errno);
}


x86 assembly (clang, -O0):
<nl_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ebe(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     1139 <nl_close+0x29>
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
mov    -0x8(%rbp),%ecx
mov    0x2e9d(%rip),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nl_close>:
push   %rbp
push   %rbx
push   %rax
mov    0x2ec6(%rip),%rbx
mov    (%rbx),%ebp
test   %edi,%edi
js     1125 <nl_close+0x15>
call   1030 <close@plt>
mov    %ebp,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@errno = global i32 0
define void @nl_close(i32 %0) {
%2 = load i32, i32* @errno
%3 = icmp sgt i32 %0, -1
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @close(i32 %0)
br label %6
6: ; preds = %4, %1
store i32 %2, i32* @errno
ret void
}
/* Variables and functions */
int strcmp(char *, char *);
int compare_str(void *a, void *b) {
  return strcmp(*((char **)a), *((char **)b));
}


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

x86 assembly (clang, -O2):
<compare_str>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @compare_str(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 = bitcast i8* %5 to i8**
%7 = load i8*, i8** %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i8**
%10 = load i8*, i8** %9
%11 = call i32 @strcmp(i8* %7, i8* %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @compare_str(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %4, i8* dereferenceable(1) %6)
ret i32 %7
}
long long read_rdtsc(void) {
  long long result;
  asm volatile("rdtsc" : "=A"(result));
  return (result);
}


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

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

LLVM IR (-O0):
define i64 @read_rdtsc() {
%1 = alloca i64
%2 = call i64 asm sideeffect "rdtsc", "=A,~{dirflag},~{fpsr},~{flags}"()
store i64 %2, i64* %1
%3 = load i64, i64* %1
ret i64 %3
}

LLVM IR (-O2):
define i64 @read_rdtsc() {
%1 = tail call i64 asm sideeffect "rdtsc", "=A,~{dirflag},~{fpsr},~{flags}"()
ret i64 %1
}
/* Variables and functions */
int rand();
int random_number_between(int min, int max) {
  if (min > max) {
    int tmp = min;
    min = max;
    max = tmp;
  }
  return rand() % (max - min + 1) + min;
}


x86 assembly (clang, -O0):
<random_number_between>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    113c <random_number_between+0x2c>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_number_between>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
cmp    %esi,%edi
mov    %esi,%ebp
cmovg  %edi,%ebp
cmovg  %esi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
sub    %ebx,%ebp
add    $0x1,%ebp
cltd
idiv   %ebp
add    %edx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @random_number_between(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
%5 = select i1 %3, i32 %1, i32 %0
%6 = tail call i32 (...) @rand()
%7 = sub i32 1, %5
%8 = add i32 %7, %4
%9 = srem i32 %6, %8
%10 = add nsw i32 %9, %5
ret i32 %10
}
/* Variables and functions */
bool is_prime(int n) {
  int divisor;
  if (n <= 1)
    return false;
  for (divisor = 2; divisor * divisor <= n; divisor++)
    if (n % divisor == 0)
      return false;
  return true;
}


x86 assembly (clang, -O0):
<is_prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jg     111d <is_prime+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    116a <is_prime+0x6a>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1163 <is_prime+0x63>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1150 <is_prime+0x50>
movl   $0x0,-0x4(%rbp)
jmp    116a <is_prime+0x6a>
jmp    1155 <is_prime+0x55>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1124 <is_prime+0x24>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_prime>:
xor    %ecx,%ecx
cmp    $0x2,%edi
jge    110a <is_prime+0xa>
mov    %ecx,%eax
ret
cmp    $0x4,%edi
jae    1115 <is_prime+0x15>
mov    $0x1,%eax
ret
mov    $0x2,%esi
nopw   0x0(%rax,%rax,1)
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
je     1107 <is_prime+0x7>
add    $0x1,%esi
mov    %esi,%eax
imul   %esi,%eax
cmp    %edi,%eax
jle    1120 <is_prime+0x20>
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @is_prime(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = icmp ult i32 %0, 4
br i1 %4, label %13, label %8
5: ; preds = %8
%6 = mul nsw i32 %12, %12
%7 = icmp sgt i32 %6, %0
br i1 %7, label %13, label %8
8: ; preds = %3, %5
%9 = phi i32 [ %12, %5 ], [ 2, %3 ]
%10 = srem i32 %0, %9
%11 = icmp eq i32 %10, 0
%12 = add nuw nsw i32 %9, 1
br i1 %11, label %13, label %5
13: ; preds = %8, %5, %3, %1
%14 = phi i32 [ 0, %1 ], [ 1, %3 ], [ 0, %8 ], [ 1, %5 ]
ret i32 %14
}
void reset_event(void) {}


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

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

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

LLVM IR (-O2):
define void @reset_event() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void socketcan_close(int fd) { close(fd); }


x86 assembly (clang, -O0):
<socketcan_close>:
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):
<socketcan_close>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define void @socketcan_close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
/* Variables and functions */
unsigned int GET32(int);
int /*<<< orphan*/ PUT32(int, unsigned int);
void sda_input(void) {
  unsigned int ra;
  ra = GET32(0x20200000);
  ra &= ~(7 << (2 * 3));
  PUT32(0x20200000, ra);
}


x86 assembly (clang, -O0):
<sda_input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x20200000,%edi
call   1040 <GET32@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xfffffe3f,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x20200000,%edi
call   1030 <PUT32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sda_input>:
push   %rax
mov    $0x20200000,%edi
call   1040 <GET32@plt>
and    $0xfffffe3f,%eax
mov    $0x20200000,%edi
mov    %eax,%esi
pop    %rax
jmp    1030 <PUT32@plt>

LLVM IR (-O0):
define void @sda_input() {
%1 = alloca i32
%2 = call i32 @GET32(i32 538968064)
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = and i32 %3, -449
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = call i32 @PUT32(i32 538968064, i32 %5)
ret void
}

LLVM IR (-O2):
define void @sda_input() {
%1 = tail call i32 @GET32(i32 538968064)
%2 = and i32 %1, -449
%3 = tail call i32 @PUT32(i32 538968064, i32 %2)
ret void
}
int wrapper_strlen(const char *str) {
  const char *p;
  for (p = str; *p; p++)
    ;
  return p - str;
}


x86 assembly (clang, -O0):
<wrapper_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1133 <wrapper_strlen+0x33>
jmp    1122 <wrapper_strlen+0x22>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <wrapper_strlen+0x10>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wrapper_strlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <wrapper_strlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @wrapper_strlen(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %3 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
%11 = trunc i64 %10 to i32
ret i32 %11
}