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

/* Variables and functions */
int /*<<< orphan*/ INT64_MAX;
int /*<<< orphan*/ INT64_MIN;
int64_t abs_i64(int64_t i) {
  if (i == INT64_MIN) {
    return INT64_MAX;
  } else {
    return i >= 0 ? i : -i;
  }
}


x86 assembly (clang, -O0):
<abs_i64>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2ecf(%rip),%rcx
cmp    (%rcx),%eax
jne    112a <abs_i64+0x2a>
mov    0x2ec8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    114d <abs_i64+0x4d>
cmpl   $0x0,-0x8(%rbp)
jl     113f <abs_i64+0x3f>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1147 <abs_i64+0x47>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<abs_i64>:
mov    0x2ed9(%rip),%rcx
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
cmp    %edi,(%rcx)
jne    111b <abs_i64+0x1b>
mov    0x2ecf(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@INT64_MIN = global i32 0
@INT64_MAX = global i32 0
define i32 @abs_i64(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = load i32, i32* @INT64_MIN
%6 = icmp eq i32 %4, %5
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = load i32, i32* @INT64_MAX
store i32 %8, i32* %2
br label %19
9: ; preds = %1
%10 = load i32, i32* %3
%11 = icmp sge i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = load i32, i32* %3
br label %17
14: ; preds = %9
%15 = load i32, i32* %3
%16 = sub nsw i32 0, %15
br label %17
17: ; preds = %14, %12
%18 = phi i32 [ %13, %12 ], [ %16, %14 ]
store i32 %18, i32* %2
br label %19
19: ; preds = %17, %7
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
@INT64_MIN = global i32 0
@INT64_MAX = global i32 0
define i32 @abs_i64(i32 %0) {
%2 = load i32, i32* @INT64_MIN
%3 = icmp eq i32 %2, %0
%4 = load i32, i32* @INT64_MAX
%5 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
%6 = select i1 %3, i32 %4, i32 %5
ret i32 %6
}
void keymap_parse_error(const int line, const char *msg) {
  internal_fatal(
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/christophgysin/moc/refs/heads/lyrics/keys.c",
      938, __FUNCTION__, "Parse error in the keymap file line %d: %s", line,
      msg);
}


x86 assembly (clang, -O0):
<keymap_parse_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%r8d
mov    -0x10(%rbp),%r9
lea    0xed2(%rip),%rdi
mov    $0x3aa,%esi
lea    0xf4c(%rip),%rdx
lea    0xf58(%rip),%rcx
mov    $0x0,%al
call   1030 <internal_fatal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<keymap_parse_error>:
mov    %rsi,%r9
mov    %edi,%r8d
lea    0xee3(%rip),%rdi
lea    0xf62(%rip),%rdx
lea    0xf6e(%rip),%rcx
mov    $0x3aa,%esi
xor    %eax,%eax
jmp    1030 <internal_fatal@plt>

LLVM IR (-O0):
@.str = [134 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/christophgysin/moc/refs/heads/lyrics/keys.c\00"
@__FUNCTION__.keymap_parse_error = [19 x i8] c"keymap_parse_error\00"
@.str.1 = [43 x i8] c"Parse error in the keymap file line %d: %s\00"
define void @keymap_parse_error(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = load i8*, i8** %4
%7 = call i32 (i8*, i32, i8*, i8*, i32, i8*, ...) bitcast (i32 (...)* @internal_fatal to i32 (i8*, i32, i8*, i8*, i32, i8*, ...)*)(i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str, i64 0, i64 0), i32 938, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @__FUNCTION__.keymap_parse_error, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %5, i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [134 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/christophgysin/moc/refs/heads/lyrics/keys.c\00"
@__FUNCTION__.keymap_parse_error = [19 x i8] c"keymap_parse_error\00"
@.str.1 = [43 x i8] c"Parse error in the keymap file line %d: %s\00"
define void @keymap_parse_error(i32 %0, i8* %1) {
%3 = tail call i32 (i8*, i32, i8*, i8*, i32, i8*, ...) bitcast (i32 (...)* @internal_fatal to i32 (i8*, i32, i8*, i8*, i32, i8*, ...)*)(i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str, i64 0, i64 0), i32 938, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @__FUNCTION__.keymap_parse_error, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %0, i8* %1)
ret void
}
/* Variables and functions */
scalar_t__ errno;
int strtol(char const *, char **, int);
int get_int(int *p, const char *s) {
  int value;
  errno = 0;
  value = strtol(s, (char **)NULL, 10);
  if (0 == errno) {
    *p = value;
    return 1;
  } else
    return 0;
}


x86 assembly (clang, -O0):
<get_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    0x2eb9(%rip),%rax
movq   $0x0,(%rax)
mov    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %eax,-0x1c(%rbp)
xor    %eax,%eax
mov    0x2e94(%rip),%rcx
cmp    (%rcx),%rax
jne    116a <get_int+0x5a>
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1171 <get_int+0x61>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_int>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
mov    0x2ec1(%rip),%r15
movq   $0x0,(%r15)
xor    %ebx,%ebx
mov    %rsi,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <strtol@plt>
cmpq   $0x0,(%r15)
jne    1145 <get_int+0x35>
mov    %eax,(%r14)
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@errno = global i64 0
define i32 @get_int(i32* nocapture writeonly %0, i8* nocapture %1) {
store i64 0, i64* @errno
%3 = tail call i32 @strtol(i8* nocapture %1, i8** null, i32 10)
%4 = load i64, i64* @errno
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %2
store i32 %3, i32* %0
br label %7
7: ; preds = %2, %6
%8 = phi i32 [ 1, %6 ], [ 0, %2 ]
ret i32 %8
}
/* Variables and functions */
size_t backtrace(void **, unsigned int);
int /*<<< orphan*/ printf(char *, void *);
void backtrace_print(void) {
  void *array[(4U) + 1];
  size_t size;
  size = backtrace(array, (4U) + 1);
  for (size_t i = 1; i < size; i++) {
    printf("%p\n", array[i]);
  }
}


x86 assembly (clang, -O0):
<backtrace_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
mov    $0x5,%esi
call   1030 <backtrace@plt>
mov    %rax,-0x38(%rbp)
movq   $0x1,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x38(%rbp),%rax
jae    1176 <backtrace_print+0x56>
mov    -0x40(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rsi
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    1142 <backtrace_print+0x22>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<backtrace_print>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %rsp,%rdi
mov    $0x5,%esi
call   1030 <backtrace@plt>
cmp    $0x2,%rax
jb     1165 <backtrace_print+0x45>
mov    %rax,%r15
mov    $0x1,%ebx
lea    0xeb5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%rsp,%rbx,8),%rsi
mov    %r14,%rdi
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1150 <backtrace_print+0x30>
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%p\0A\00"
define void @backtrace_print() {
%1 = alloca [5 x i8*]
%2 = bitcast [5 x i8*]* %1 to i8*
%3 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 0
%4 = call i64 @backtrace(i8** %3, i32 5)
%5 = icmp ugt i64 %4, 1
br i1 %5, label %7, label %6
6: ; preds = %7, %0
ret void
7: ; preds = %0, %7
%8 = phi i64 [ %12, %7 ], [ 1, %0 ]
%9 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 %8
%10 = load i8*, i8** %9
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = add nuw i64 %8, 1
%13 = icmp eq i64 %12, %4
br i1 %13, label %6, label %7
}
void NET_OpenIPX(void) {}


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

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

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

LLVM IR (-O2):
define void @NET_OpenIPX() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strncpy(char *, char *, int);
int get_plugin_info(int opcode, char *buf, int buflen) {
  switch (opcode) {
  case 0:
    strncpy(buf, "Feature vector input plugin for Julius", buflen);
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<get_plugin_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%eax
test   %eax,%eax
jne    1145 <get_plugin_info+0x35>
jmp    1132 <get_plugin_info+0x22>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xec0(%rip),%rsi
call   1030 <strncpy@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_plugin_info>:
test   %edi,%edi
je     1117 <get_plugin_info+0x7>
xor    %eax,%eax
ret
push   %rax
lea    0xee1(%rip),%rax
mov    %rsi,%rdi
mov    %rax,%rsi
call   1030 <strncpy@plt>
add    $0x8,%rsp
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [39 x i8] c"Feature vector input plugin for Julius\00"
define i32 @get_plugin_info(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
switch i32 %7, label %12 [
i32 0, label %8
]
8: ; preds = %3
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = call i32 @strncpy(i8* %9, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %3, %8
ret i32 0
}

LLVM IR (-O2):
@.str = [39 x i8] c"Feature vector input plugin for Julius\00"
define i32 @get_plugin_info(i32 %0, i8* %1, i32 %2) {
%4 = icmp eq i32 %0, 0
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @strncpy(i8* %1, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %7
7: ; preds = %3, %5
ret i32 0
}
int getktid() { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @getktid() {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, void *);
int dump(void *p) {
  printf("[[%p]]\n", p);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [8 x i8] c"[[%p]]\0A\00"
define i32 @dump(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 0
}
void Sys_SetStatus(const char *format, ...) { return; }


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

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

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

LLVM IR (-O2):
define void @Sys_SetStatus(i8* nocapture %0, ...) {
ret void
}
/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *btjpg_gcalloc(size_t sz) {
  void *ptr;
  ptr = malloc(sz);
  memset(ptr, 0, sz);
  return (ptr);
}


x86 assembly (clang, -O0):
<btjpg_gcalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<btjpg_gcalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1030 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @btjpg_gcalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = load i64, i64* %2
%8 = call i32 @memset(i8* %6, i32 0, i64 %7)
%9 = load i8*, i8** %3
ret i8* %9
}

LLVM IR (-O2):
define i8* @btjpg_gcalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = tail call i32 @memset(i8* %2, i32 0, i64 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ strcspn(char *, char *);
void uninivar_strcspn(void) {
  char *cs;
  char *ct;
  (void)strcspn(cs, ct);
}


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

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

LLVM IR (-O0):
define void @uninivar_strcspn() {
%1 = alloca i8*
%2 = alloca i8*
%3 = load i8*, i8** %1
%4 = load i8*, i8** %2
%5 = call i32 @strcspn(i8* %3, i8* %4)
ret void
}

LLVM IR (-O2):
define void @uninivar_strcspn() {
ret void
}
char *trim(char *src, int max_len) {
  int cur_len = 0;
  char *index = src;
  while (*index == ' ' && cur_len < max_len) {
    index++;
    cur_len++;
  }
  return index;
}


x86 assembly (clang, -O0):
<trim>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x19(%rbp)
jne    113b <trim+0x3b>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
setl   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    114b <trim+0x4b>
jmp    1165 <trim+0x65>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    111a <trim+0x1a>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<trim>:
mov    %rdi,%rax
cmpb   $0x20,(%rdi)
jne    1133 <trim+0x33>
test   %esi,%esi
jle    1133 <trim+0x33>
mov    $0x1,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmpb   $0x20,0x1(%rax)
lea    0x1(%rax),%rax
jne    1133 <trim+0x33>
lea    0x1(%rcx),%edx
cmp    %esi,%ecx
mov    %edx,%ecx
jl     1120 <trim+0x20>
ret

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

LLVM IR (-O2):
define i8* @trim(i8* %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 32
%5 = icmp sgt i32 %1, 0
%6 = and i1 %4, %5
br i1 %6, label %7, label %16
7: ; preds = %2, %7
%8 = phi i8* [ %10, %7 ], [ %0, %2 ]
%9 = phi i32 [ %11, %7 ], [ 0, %2 ]
%10 = getelementptr inbounds i8, i8* %8, i64 1
%11 = add nuw nsw i32 %9, 1
%12 = load i8, i8* %10
%13 = icmp eq i8 %12, 32
%14 = icmp slt i32 %11, %1
%15 = select i1 %13, i1 %14, i1 false
br i1 %15, label %7, label %16
16: ; preds = %7, %2
%17 = phi i8* [ %0, %2 ], [ %10, %7 ]
ret i8* %17
}
/* Variables and functions */
int /*<<< orphan*/ isdigit(char);
int IsNumeric(char *str) {
  while (*str) {
    if (!isdigit(*str))
      return 0;
    str++;
  }
  return 1;
}


x86 assembly (clang, -O0):
<IsNumeric>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     115b <IsNumeric+0x4b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    114a <IsNumeric+0x3a>
movl   $0x0,-0x4(%rbp)
jmp    1162 <IsNumeric+0x52>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    111c <IsNumeric+0xc>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsNumeric>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
mov    $0x1,%ebp
test   %al,%al
je     114b <IsNumeric+0x3b>
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     1149 <IsNumeric+0x39>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <IsNumeric+0x20>
jmp    114b <IsNumeric+0x3b>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @IsNumeric(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %7
4: ; preds = %7
%5 = load i8, i8* %12
%6 = icmp eq i8 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %1, %4
%8 = phi i8 [ %5, %4 ], [ %2, %1 ]
%9 = phi i8* [ %12, %4 ], [ %0, %1 ]
%10 = tail call i32 @isdigit(i8 signext %8)
%11 = icmp eq i32 %10, 0
%12 = getelementptr inbounds i8, i8* %9, i64 1
br i1 %11, label %13, label %4
13: ; preds = %7, %4, %1
%14 = phi i32 [ 1, %1 ], [ 1, %4 ], [ 0, %7 ]
ret i32 %14
}
/* Variables and functions */
scalar_t__ isSmithNumber(long long);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, long long *);
scalar_t__ sumOfDigits(long long);
int main() {
  long long int n;
  scanf("%lld", &n);
  if (isSmithNumber(n) == sumOfDigits(n))
    printf("1\n");
  else
    printf("0\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <isSmithNumber@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <sumOfDigits@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
jne    1196 <main+0x56>
lea    0xe79(%rip),%rdi
call   1040 <printf@plt>
jmp    11a2 <main+0x62>
lea    0xe6b(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb4(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x8(%rsp),%rdi
call   1050 <isSmithNumber@plt>
mov    %rax,%rbx
mov    0x8(%rsp),%rdi
call   1040 <sumOfDigits@plt>
cmp    %rax,%rbx
lea    0xe90(%rip),%rax
lea    0xe87(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%lld\00"
@str = [2 x i8] c"0\00"
@str.3 = [2 x i8] c"1\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %1)
%4 = load i64, i64* %1
%5 = call i64 @isSmithNumber(i64 %4)
%6 = load i64, i64* %1
%7 = call i64 @sumOfDigits(i64 %6)
%8 = icmp eq i64 %5, %7
%9 = select i1 %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0)
%10 = call i32 @puts(i8* dereferenceable(1) %9)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ putc(char);
void printc(char *buf, char c, int flags) {
  if (flags & 0x8000) {
    if (c != '\0')
      putc(c);
  } else
    *buf = c;
}


x86 assembly (clang, -O0):
<printc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
and    $0x8000,%eax
cmp    $0x0,%eax
je     1151 <printc+0x41>
movsbl -0x9(%rbp),%eax
cmp    $0x0,%eax
je     114c <printc+0x3c>
movsbl -0x9(%rbp),%edi
call   1030 <putc@plt>
jmp    115a <printc+0x4a>
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printc>:
test   $0x8000,%edx
jne    111d <printc+0xd>
mov    %sil,(%rdi)
jmp    112b <printc+0x1b>
test   %sil,%sil
je     112b <printc+0x1b>
movsbl %sil,%edi
jmp    1030 <putc@plt>
ret

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

LLVM IR (-O2):
define void @printc(i8* nocapture writeonly %0, i8 signext %1, i32 %2) {
%4 = and i32 %2, 32768
%5 = icmp eq i32 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %3
%7 = icmp eq i8 %1, 0
br i1 %7, label %11, label %8
8: ; preds = %6
%9 = tail call i32 @putc(i8 signext %1)
br label %11
10: ; preds = %3
store i8 %1, i8* %0
br label %11
11: ; preds = %6, %8, %10
ret void
}
int getX86CpuIDAndInfo(unsigned value, unsigned *rEAX, unsigned *rEBX,
                       unsigned *rECX, unsigned *rEDX) {
  __asm__("movq\t%%rbx, %%rsi\n\t"
          "cpuid\n\t"
          "xchgq\t%%rbx, %%rsi\n\t"
          : "=a"(*rEAX), "=S"(*rEBX), "=c"(*rECX), "=d"(*rEDX)
          : "a"(value));
  return 0;
}


x86 assembly (clang, -O0):
<getX86CpuIDAndInfo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x10(%rbp),%r9
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x4(%rbp),%eax
mov    %rbx,%rsi
cpuid
xchg   %rsi,%rbx
mov    %eax,%r10d
mov    -0x38(%rbp),%rax
mov    %esi,%r8d
mov    %ecx,%esi
mov    -0x30(%rbp),%rcx
mov    %r10d,(%r9)
mov    %r8d,(%rdi)
mov    %esi,(%rcx)
mov    %edx,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getX86CpuIDAndInfo>:
mov    %rcx,%r9
mov    %rdx,%r10
mov    %rsi,%r11
mov    %edi,%eax
mov    %rbx,%rsi
cpuid
xchg   %rsi,%rbx
mov    %eax,(%r11)
mov    %esi,(%r10)
mov    %ecx,(%r9)
mov    %edx,(%r8)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @getX86CpuIDAndInfo(i32 %0, i32* %1, i32* %2, i32* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
store i32 %0, i32* %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store i32* %4, i32** %10
%11 = load i32*, i32** %7
%12 = load i32*, i32** %8
%13 = load i32*, i32** %9
%14 = load i32*, i32** %10
%15 = load i32, i32* %6
%16 = call { i32, i32, i32, i32 } asm "movq\09%rbx, %rsi\0A\09cpuid\0A\09xchgq\09%rbx, %rsi\0A\09", "={ax},={si},={cx},={dx},{ax},~{dirflag},~{fpsr},~{flags}"(i32 %15)
%17 = extractvalue { i32, i32, i32, i32 } %16, 0
%18 = extractvalue { i32, i32, i32, i32 } %16, 1
%19 = extractvalue { i32, i32, i32, i32 } %16, 2
%20 = extractvalue { i32, i32, i32, i32 } %16, 3
store i32 %17, i32* %11
store i32 %18, i32* %12
store i32 %19, i32* %13
store i32 %20, i32* %14
ret i32 0
}

LLVM IR (-O2):
define i32 @getX86CpuIDAndInfo(i32 %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3, i32* nocapture writeonly %4) {
%6 = tail call { i32, i32, i32, i32 } asm "movq\09%rbx, %rsi\0A\09cpuid\0A\09xchgq\09%rbx, %rsi\0A\09", "={ax},={si},={cx},={dx},{ax},~{dirflag},~{fpsr},~{flags}"(i32 %0)
%7 = extractvalue { i32, i32, i32, i32 } %6, 0
%8 = extractvalue { i32, i32, i32, i32 } %6, 1
%9 = extractvalue { i32, i32, i32, i32 } %6, 2
%10 = extractvalue { i32, i32, i32, i32 } %6, 3
store i32 %7, i32* %1
store i32 %8, i32* %2
store i32 %9, i32* %3
store i32 %10, i32* %4
ret i32 0
}
int test_imm_02int64_highword_mem(long long *val) {
  return ((*val >> 32) & (0x02 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_02int64_highword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
sar    $0x20,%rdx
and    $0x2,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_02int64_highword_mem>:
testb  $0x2,0x4(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_02int64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 8589934592
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t *serialize_int(uint8_t *serialbuf, int val) {
  serialbuf[0] = val >> 24;
  serialbuf[1] = val >> 16;
  serialbuf[2] = val >> 8;
  serialbuf[3] = val;
  return serialbuf + 4;
}


x86 assembly (clang, -O0):
<serialize_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
sar    $0x18,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x10,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x8,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0x8(%rbp),%rax
add    $0x10,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<serialize_int>:
mov    %esi,%eax
sar    $0x18,%eax
mov    %eax,(%rdi)
mov    %esi,%eax
sar    $0x10,%eax
mov    %eax,0x4(%rdi)
mov    %esi,%eax
sar    $0x8,%eax
mov    %eax,0x8(%rdi)
mov    %esi,0xc(%rdi)
lea    0x10(%rdi),%rax
ret

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

LLVM IR (-O2):
define i32* @serialize_int(i32* writeonly %0, i32 %1) {
%3 = ashr i32 %1, 24
store i32 %3, i32* %0
%4 = ashr i32 %1, 16
%5 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %4, i32* %5
%6 = ashr i32 %1, 8
%7 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %6, i32* %7
%8 = getelementptr inbounds i32, i32* %0, i64 3
store i32 %1, i32* %8
%9 = getelementptr inbounds i32, i32* %0, i64 4
ret i32* %9
}
const char *mmapped_file_name() {
  static const char name[] = "/tmp/ltr_mmapXXXXXX";
  return name;
}


x86 assembly (clang, -O0):
<mmapped_file_name>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mmapped_file_name>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@mmapped_file_name.name = internal constant [20 x i8] c"/tmp/ltr_mmapXXXXXX\00"
define i8* @mmapped_file_name() {
ret i8* getelementptr inbounds ([20 x i8], [20 x i8]* @mmapped_file_name.name, i64 0, i64 0)
}

LLVM IR (-O2):
@mmapped_file_name.name = internal constant [20 x i8] c"/tmp/ltr_mmapXXXXXX\00"
define i8* @mmapped_file_name() {
ret i8* getelementptr inbounds ([20 x i8], [20 x i8]* @mmapped_file_name.name, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  printf("hello,GNU\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
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 = [11 x i8] c"hello,GNU\0A\00"
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 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [10 x i8] c"hello,GNU\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ dbgprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void version() {
  dbgprintf(0,
            "dccpping version %.1f\nCopyright (C) 2012 Samuel Jero "
            "<sj323707@ohio.edu>\n",
            1.1);
  dbgprintf(0, "This program comes with ABSOLUTELY NO WARRANTY.\n");
  dbgprintf(0, "This is free software, and you are welcome to\nredistribute it "
               "under certain conditions.\n");
  exit(0);
}


x86 assembly (clang, -O0):
<version>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xedb(%rip),%rsi
movsd  0xecb(%rip),%xmm0
mov    $0x1,%al
call   1030 <dbgprintf@plt>
xor    %edi,%edi
lea    0xf0d(%rip),%rsi
mov    $0x0,%al
call   1030 <dbgprintf@plt>
xor    %edi,%edi
lea    0xf2e(%rip),%rsi
mov    $0x0,%al
call   1030 <dbgprintf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<version>:
push   %rax
lea    0xee0(%rip),%rsi
movsd  0xed0(%rip),%xmm0
xor    %edi,%edi
mov    $0x1,%al
call   1030 <dbgprintf@plt>
lea    0xf12(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
call   1030 <dbgprintf@plt>
lea    0xf33(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
call   1030 <dbgprintf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [74 x i8] c"dccpping version %.1f\0ACopyright (C) 2012 Samuel Jero <sj323707@ohio.edu>\0A\00"
@.str.1 = [49 x i8] c"This program comes with ABSOLUTELY NO WARRANTY.\0A\00"
@.str.2 = [89 x i8] c"This is free software, and you are welcome to\0Aredistribute it under certain conditions.\0A\00"
define void @version() {
%1 = call i32 (i32, i8*, ...) @dbgprintf(i32 0, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str, i64 0, i64 0), double 1.100000e+00)
%2 = call i32 (i32, i8*, ...) @dbgprintf(i32 0, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 (i32, i8*, ...) @dbgprintf(i32 0, i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [74 x i8] c"dccpping version %.1f\0ACopyright (C) 2012 Samuel Jero <sj323707@ohio.edu>\0A\00"
@.str.1 = [49 x i8] c"This program comes with ABSOLUTELY NO WARRANTY.\0A\00"
@.str.2 = [89 x i8] c"This is free software, and you are welcome to\0Aredistribute it under certain conditions.\0A\00"
define void @version() {
%1 = tail call i32 (i32, i8*, ...) @dbgprintf(i32 0, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str, i64 0, i64 0), double 1.100000e+00)
%2 = tail call i32 (i32, i8*, ...) @dbgprintf(i32 0, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 (i32, i8*, ...) @dbgprintf(i32 0, i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ reverse(char *);
int main() {
  char word[] = "forwards";
  printf("word = %s\n", word);
  reverse(word);
  printf("word = %s\n", word);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0xd(%rbp)
mov    0xec8(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0xd(%rbp),%rsi
lea    0xebb(%rip),%rdi
call   1040 <printf@plt>
lea    -0xd(%rbp),%rdi
call   1030 <reverse@plt>
lea    -0xd(%rbp),%rsi
lea    0xea2(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movabs $0x7364726177726f66,%rax
72 64 73
mov    %rax,0x8(%rsp)
movb   $0x0,0x10(%rsp)
lea    0xec7(%rip),%r14
lea    0x8(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <reverse@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.word = [9 x i8] c"forwards\00"
@.str = [11 x i8] c"word = %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [9 x i8]
store i32 0, i32* %1
%3 = bitcast [9 x i8]* %2 to i8*
%4 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%5 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%7 = call i32 @reverse(i8* %6)
%8 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%9 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %8)
ret i32 0
}

LLVM IR (-O2):
@__const.main.word = [9 x i8] c"forwards\00"
@.str = [11 x i8] c"word = %s\0A\00"
define i32 @main() {
%1 = alloca [9 x i8]
%2 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%3 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @reverse(i8* %2)
%5 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
unsigned int net_address(unsigned int ip, unsigned int mask) {
  return (ip & mask);
}


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

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

LLVM IR (-O0):
define i32 @net_address(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 = and i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @net_address(i32 %0, i32 %1) {
%3 = and i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ binary();
int main(void) {
  binary();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @binary()
ret i32 0
}
/* Variables and functions */
double pmrand();
double randReal() {
  double d1 = pmrand();
  double d2 = pmrand();
  return d1 / d2;
}


x86 assembly (clang, -O0):
<randReal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <pmrand@plt>
movsd  %xmm0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <pmrand@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randReal>:
push   %rax
xor    %eax,%eax
call   1030 <pmrand@plt>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <pmrand@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @randReal() {
%1 = alloca double
%2 = alloca double
%3 = call double (...) @pmrand()
store double %3, double* %1
%4 = call double (...) @pmrand()
store double %4, double* %2
%5 = load double, double* %1
%6 = load double, double* %2
%7 = fdiv double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @randReal() {
%1 = tail call double (...) @pmrand()
%2 = tail call double (...) @pmrand()
%3 = fdiv double %1, %2
ret double %3
}
float celsius_to_fahrenheit(float degrees_celsius) {
  return (1.8 * degrees_celsius) + 32;
}


x86 assembly (clang, -O0):
<celsius_to_fahrenheit>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xee6(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xee2(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<celsius_to_fahrenheit>:
cvtss2sd %xmm0,%xmm0
mulsd  0xef4(%rip),%xmm0
addsd  0xef4(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @celsius_to_fahrenheit(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = call double @llvm.fmuladd.f64(double 1.800000e+00, double %4, double 3.200000e+01)
%6 = fptrunc double %5 to float
ret float %6
}

LLVM IR (-O2):
define float @celsius_to_fahrenheit(float %0) {
%2 = fpext float %0 to double
%3 = tail call double @llvm.fmuladd.f64(double %2, double 1.800000e+00, double 3.200000e+01)
%4 = fptrunc double %3 to float
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
int isqrt(int);
void t_sqrt_71() {
  Assert_real((isqrt(71) == 8),
              "/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",
              360, ("Integer square root of 71 should be 8"));
}


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

x86 assembly (clang, -O2):
<t_sqrt_71>:
push   %rax
mov    $0x47,%edi
call   1030 <isqrt@plt>
xor    %edi,%edi
cmp    $0x8,%eax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf60(%rip),%rcx
mov    $0x168,%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 71 should be 8\00"
define void @t_sqrt_71() {
%1 = call i32 @isqrt(i32 71)
%2 = icmp eq i32 %1, 8
%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 360, 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 71 should be 8\00"
define void @t_sqrt_71() {
%1 = tail call i32 @isqrt(i32 71)
%2 = icmp eq i32 %1, 8
%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 360, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int atoi(int /*<<< orphan*/ *);
int /*<<< orphan*/ *getenv(char *);
int getZVMLogLevel() {
  int iLocalZVMLogLevel = 0;
  if (getenv("ZVM_LogLevel") != NULL) {
    iLocalZVMLogLevel = atoi(getenv("ZVM_LogLevel"));
  } else
    iLocalZVMLogLevel = 0;
  return iLocalZVMLogLevel;
}


x86 assembly (clang, -O0):
<getZVMLogLevel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     1161 <getZVMLogLevel+0x41>
lea    0xeb4(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rdi
call   1040 <atoi@plt>
mov    %eax,-0x4(%rbp)
jmp    1168 <getZVMLogLevel+0x48>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getZVMLogLevel>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     113b <getZVMLogLevel+0x1b>
mov    %rax,%rdi
pop    %rax
jmp    1040 <atoi@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"ZVM_LogLevel\00"
define i32 @getZVMLogLevel() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = icmp ne i32* %2, null
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = call i32* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @atoi(i32* %5)
store i32 %6, i32* %1
br label %8
7: ; preds = %0
store i32 0, i32* %1
br label %8
8: ; preds = %7, %4
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
@.str = [13 x i8] c"ZVM_LogLevel\00"
define i32 @getZVMLogLevel() {
%1 = tail call i32* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32* %1, null
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @atoi(i32* %1)
br label %5
5: ; preds = %0, %3
%6 = phi i32 [ %4, %3 ], [ 0, %0 ]
ret i32 %6
}
/* Variables and functions */
char *chopPrefixAt(char *, char);
char *chopPrefix(char *s) { return chopPrefixAt(s, '.'); }


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

x86 assembly (clang, -O2):
<chopPrefix>:
mov    $0x2e,%esi
jmp    1030 <chopPrefixAt@plt>

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

LLVM IR (-O2):
define i8* @chopPrefix(i8* %0) {
%2 = tail call i8* @chopPrefixAt(i8* %0, i8 signext 46)
ret i8* %2
}
/* Variables and functions */
void swap(int arr[], size_t i, size_t j) {
  int tmp = arr[i];
  arr[i] = arr[j];
  arr[j] = tmp;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @swap(i32* nocapture %0, i64 %1, i64 %2) {
%4 = getelementptr inbounds i32, i32* %0, i64 %1
%5 = load i32, i32* %4
%6 = getelementptr inbounds i32, i32* %0, i64 %2
%7 = load i32, i32* %6
store i32 %7, i32* %4
store i32 %5, i32* %6
ret void
}