xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ dump_trace();
int /*<<< orphan*/ printf(char *, int);
void signal_handler(int sig) {
  printf("signal %d\n", sig);
  dump_trace();
  abort();
}


x86 assembly (clang, -O0):
<signal_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xebb(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <dump_trace@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<signal_handler>:
push   %rax
mov    %edi,%esi
lea    0xec6(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <dump_trace@plt>
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
@.str = [11 x i8] c"signal %d\0A\00"
define void @signal_handler(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 (...) @dump_trace()
%4 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ show_help(int /*<<< orphan*/, int);
int /*<<< orphan*/ stderr;
void usage_exit(void) {
  show_help(stderr, 1);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<usage_exit>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%esi
call   1030 <show_help@plt>
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage_exit>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%esi
call   1030 <show_help@plt>
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
define void @usage_exit() {
%1 = load i32, i32* @stderr
%2 = call i32 @show_help(i32 %1, i32 1)
%3 = load i32, i32* @EXIT_FAILURE
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
define void @usage_exit() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @show_help(i32 %1, i32 1)
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Variables and functions */
unsigned long gfx_get_display_video_offset();
unsigned long redcloud_get_video_offset(void) {
  return (gfx_get_display_video_offset());
}


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

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

LLVM IR (-O0):
define i64 @redcloud_get_video_offset() {
%1 = call i64 (...) @gfx_get_display_video_offset()
ret i64 %1
}

LLVM IR (-O2):
define i64 @redcloud_get_video_offset() {
%1 = tail call i64 (...) @gfx_get_display_video_offset()
ret i64 %1
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ strcpy(char *, char const *);
int /*<<< orphan*/ *strstr(char const *, char const *);
char *lastStrStr(const char *s1, const char *s2) {
  int i;
  char *pos = (char *)malloc(sizeof(char));
  while (strstr(s1, s2) != NULL) {
    strcpy(pos, s1);
    s1++;
  }
  return pos;
}


x86 assembly (clang, -O0):
<lastStrStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <strstr@plt>
cmp    $0x0,%rax
je     1183 <lastStrStr+0x53>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    114e <lastStrStr+0x1e>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lastStrStr>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,%r15
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strstr@plt>
test   %rax,%rax
je     1171 <lastStrStr+0x41>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
add    $0x1,%rbx
jmp    1150 <lastStrStr+0x20>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @lastStrStr(i8* %0, i8* nocapture %1) {
%3 = tail call i64 @malloc(i32 1)
%4 = inttoptr i64 %3 to i8*
%5 = tail call i32* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%6 = icmp eq i32* %5, null
br i1 %6, label %13, label %7
7: ; preds = %2, %7
%8 = phi i8* [ %10, %7 ], [ %0, %2 ]
%9 = tail call i32 @strcpy(i8* %4, i8* %8)
%10 = getelementptr inbounds i8, i8* %8, i64 1
%11 = tail call i32* @strstr(i8* dereferenceable(1) %10, i8* dereferenceable(1) %1)
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %7
13: ; preds = %7, %2
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ free(unsigned char *);
int free_outmem(unsigned char **out) {
  if (*out == NULL) {
    return -1;
  }
  free(*out);
  return 0;
}


x86 assembly (clang, -O0):
<free_outmem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1136 <free_outmem+0x26>
movl   $0xffffffff,-0x4(%rbp)
jmp    1149 <free_outmem+0x39>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_outmem>:
push   %rax
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1122 <free_outmem+0x12>
call   1030 <free@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    $0xffffffff,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @free_outmem(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @free(i8* %2)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ 0, %4 ], [ -1, %1 ]
ret i32 %7
}
dexit(n) int n;
{
  tunlink();
  exit(n);
}


x86 assembly (clang, -O0):
<dexit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <tunlink@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<dexit>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <tunlink@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define i32 @dexit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @tunlink()
%4 = load i32, i32* %2
unreachable
}

LLVM IR (-O2):
define i32 @dexit(i32 %0) {
%2 = tail call i32 (...) @tunlink()
tail call void @exit(i32 %0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ get_kernel_heap();
int mem_heap_lock(int /*<<< orphan*/);
int kheap_lock() { return mem_heap_lock(get_kernel_heap()); }


x86 assembly (clang, -O0):
<kheap_lock>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <get_kernel_heap@plt>
mov    %eax,%edi
call   1040 <mem_heap_lock@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<kheap_lock>:
push   %rax
xor    %eax,%eax
call   1030 <get_kernel_heap@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <mem_heap_lock@plt>

LLVM IR (-O0):
define i32 @kheap_lock() {
%1 = call i32 (...) @get_kernel_heap()
%2 = call i32 @mem_heap_lock(i32 %1)
ret i32 %2
}

LLVM IR (-O2):
define i32 @kheap_lock() {
%1 = tail call i32 (...) @get_kernel_heap()
%2 = tail call i32 @mem_heap_lock(i32 %1)
ret i32 %2
}
/* Variables and functions */
char *rindex(char *, char);
int /*<<< orphan*/ setenv(char *, char *, int);
void setdaemonname(char *app) {
  char *appname = NULL;
  appname = rindex(app, '/');
  if (!appname)
    appname = app;
  else
    appname += 1;
  setenv("DAEMONNAME", appname, 1);
}


x86 assembly (clang, -O0):
<setdaemonname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1040 <rindex@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115e <setdaemonname+0x3e>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    116a <setdaemonname+0x4a>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe8b(%rip),%rdi
mov    $0x1,%edx
call   1030 <setenv@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setdaemonname>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1040 <rindex@plt>
lea    0x1(%rax),%rsi
test   %rax,%rax
cmove  %rbx,%rsi
lea    0xec0(%rip),%rdi
mov    $0x1,%edx
pop    %rbx
jmp    1030 <setenv@plt>

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

LLVM IR (-O2):
@.str = [11 x i8] c"DAEMONNAME\00"
define void @setdaemonname(i8* %0) {
%2 = tail call i8* @rindex(i8* %0, i8 signext 47)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
%6 = tail call i32 @setenv(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %5, i32 1)
ret void
}
/* Type definitions */
struct tm {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ hclock_set_time(struct tm const *);
int set_hardware_clock_cmos(const struct tm *new_broken_time) {
  hclock_set_time(new_broken_time);
  return 0;
}


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

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

LLVM IR (-O0):
%struct.tm = type { i32 }
define i32 @set_hardware_clock_cmos(%struct.tm* %0) {
%2 = alloca %struct.tm*
store %struct.tm* %0, %struct.tm** %2
%3 = load %struct.tm*, %struct.tm** %2
%4 = call i32 @hclock_set_time(%struct.tm* %3)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define i32 @set_hardware_clock_cmos(%struct.tm* %0) {
%2 = tail call i32 @hclock_set_time(%struct.tm* %0)
ret i32 0
}
void snvs_iomux_config() {}


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

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

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

LLVM IR (-O2):
define void @snvs_iomux_config() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void memory_error(void) {
  fprintf(stderr, "Out of memory.  Aborting...\n");
  exit(1);
}


x86 assembly (clang, -O0):
<memory_error>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<memory_error>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [29 x i8] c"Out of memory. Aborting...\0A\00"
define void @memory_error() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [29 x i8] c"Out of memory. Aborting...\0A\00"
define void @memory_error() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
int ft_isnum(int c) {
  if ((char)c >= '0' && (char)c <= '9')
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<ft_isnum>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movsbl %al,%eax
cmp    $0x30,%eax
jl     1131 <ft_isnum+0x31>
mov    -0x8(%rbp),%eax
movsbl %al,%eax
cmp    $0x39,%eax
jg     1131 <ft_isnum+0x31>
movl   $0x1,-0x4(%rbp)
jmp    1138 <ft_isnum+0x38>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_isnum>:
shl    $0x18,%edi
add    $0xd0ffffff,%edi
xor    %eax,%eax
cmp    $0xaffffff,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @ft_isnum(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = trunc i32 %4 to i8
%6 = sext i8 %5 to i32
%7 = icmp sge i32 %6, 48
br i1 %7, label %8, label %14
8: ; preds = %1
%9 = load i32, i32* %3
%10 = trunc i32 %9 to i8
%11 = sext i8 %10 to i32
%12 = icmp sle i32 %11, 57
br i1 %12, label %13, label %14
13: ; preds = %8
store i32 1, i32* %2
br label %15
14: ; preds = %8, %1
store i32 0, i32* %2
br label %15
15: ; preds = %14, %13
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
define i32 @ft_isnum(i32 %0) {
%2 = shl i32 %0, 24
%3 = add i32 %2, -788529153
%4 = icmp ult i32 %3, 184549375
%5 = zext i1 %4 to i32
ret i32 %5
}
void SigIntCaught() {}


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

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

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

LLVM IR (-O2):
define void @SigIntCaught() {
ret void
}
/* Type definitions */
typedef unsigned long uint16_t;

/* Variables and functions */
void set_bit_u16(int nr, uint16_t *addr) {
  addr[nr >> 4] |= (1UL << (nr & 15));
}


x86 assembly (clang, -O0):
<set_bit_u16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf,%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    $0x1,%edx
shl    %cl,%rdx
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sar    $0x4,%ecx
movslq %ecx,%rcx
or     (%rax,%rcx,8),%rdx
mov    %rdx,(%rax,%rcx,8)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_bit_u16>:
mov    %edi,%ecx
and    $0xf,%cl
mov    $0x1,%eax
shl    %cl,%rax
sar    $0x4,%edi
movslq %edi,%rcx
or     %rax,(%rsi,%rcx,8)
ret

LLVM IR (-O0):
define void @set_bit_u16(i32 %0, i64* %1) {
%3 = alloca i32
%4 = alloca i64*
store i32 %0, i32* %3
store i64* %1, i64** %4
%5 = load i32, i32* %3
%6 = and i32 %5, 15
%7 = zext i32 %6 to i64
%8 = shl i64 1, %7
%9 = load i64*, i64** %4
%10 = load i32, i32* %3
%11 = ashr i32 %10, 4
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i64, i64* %9, i64 %12
%14 = load i64, i64* %13
%15 = or i64 %14, %8
store i64 %15, i64* %13
ret void
}

LLVM IR (-O2):
define void @set_bit_u16(i32 %0, i64* nocapture %1) {
%3 = and i32 %0, 15
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 1, %4
%6 = ashr i32 %0, 4
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i64, i64* %1, i64 %7
%9 = load i64, i64* %8
%10 = or i64 %9, %5
store i64 %10, i64* %8
ret void
}
/* Type definitions */
struct buf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ buf_concat_len(struct buf *, char const *, int);
int strlen(char const *);
void buf_concat(struct buf *b, const char *s) {
  int l = strlen(s);
  buf_concat_len(b, s, l);
}


x86 assembly (clang, -O0):
<buf_concat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <buf_concat_len@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buf_concat>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <buf_concat_len@plt>

LLVM IR (-O0):
%struct.buf = type { i32 }
define void @buf_concat(%struct.buf* %0, i8* %1) {
%3 = alloca %struct.buf*
%4 = alloca i8*
%5 = alloca i32
store %struct.buf* %0, %struct.buf** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %5
%8 = load %struct.buf*, %struct.buf** %3
%9 = load i8*, i8** %4
%10 = load i32, i32* %5
%11 = call i32 @buf_concat_len(%struct.buf* %8, i8* %9, i32 %10)
ret void
}

LLVM IR (-O2):
%struct.buf = type { i32 }
define void @buf_concat(%struct.buf* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @buf_concat_len(%struct.buf* %0, i8* %1, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ parsingIntAttr(char *, int);
void sj_onInteger(char *name, int value) { parsingIntAttr(name, value); }


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

x86 assembly (clang, -O2):
<sj_onInteger>:
jmp    1030 <parsingIntAttr@plt>

LLVM IR (-O0):
define void @sj_onInteger(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 @parsingIntAttr(i8* %5, i32 %6)
ret void
}

LLVM IR (-O2):
define void @sj_onInteger(i8* %0, i32 %1) {
%3 = tail call i32 @parsingIntAttr(i8* %0, i32 %1)
ret void
}
extern char *esa_device_str(int id) {
  switch (id) {
  case 0x2:
    return "ESA_LEON2";
  case 0xF:
    return "ESA_MCTRL";
  case 0x10:
    return "ESA_PCIARB";
  default:
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<esa_device_str>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x2,%eax
je     113d <esa_device_str+0x3d>
jmp    111b <esa_device_str+0x1b>
mov    -0x10(%rbp),%eax
sub    $0xf,%eax
je     114d <esa_device_str+0x4d>
jmp    112c <esa_device_str+0x2c>
mov    -0x10(%rbp),%eax
sub    $0x10,%eax
je     115d <esa_device_str+0x5d>
jmp    116d <esa_device_str+0x6d>
lea    0xebc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117a <esa_device_str+0x7a>
lea    0xeb6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117a <esa_device_str+0x7a>
lea    0xeb0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117a <esa_device_str+0x7a>
jmp    1172 <esa_device_str+0x72>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<esa_device_str>:
cmp    $0x2,%edi
je     1117 <esa_device_str+0x17>
cmp    $0x10,%edi
je     111f <esa_device_str+0x1f>
cmp    $0xf,%edi
jne    1127 <esa_device_str+0x27>
lea    0xef4(%rip),%rax
ret
lea    0xee2(%rip),%rax
ret
lea    0xeee(%rip),%rax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [10 x i8] c"ESA_LEON2\00"
@.str.1 = [10 x i8] c"ESA_MCTRL\00"
@.str.2 = [11 x i8] c"ESA_PCIARB\00"
define i8* @esa_device_str(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %8 [
i32 2, label %5
i32 15, label %6
i32 16, label %7
]
5: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %2
br label %10
6: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %10
7: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %10
8: ; preds = %1
br label %9
9: ; preds = %8
store i8* null, i8** %2
br label %10
10: ; preds = %9, %7, %6, %5
%11 = load i8*, i8** %2
ret i8* %11
}

LLVM IR (-O2):
@.str = [10 x i8] c"ESA_LEON2\00"
@.str.1 = [10 x i8] c"ESA_MCTRL\00"
@.str.2 = [11 x i8] c"ESA_PCIARB\00"
define i8* @esa_device_str(i32 %0) {
switch i32 %0, label %4 [
i32 2, label %5
i32 15, label %2
i32 16, label %3
]
2: ; preds = %1
br label %5
3: ; preds = %1
br label %5
4: ; preds = %1
br label %5
5: ; preds = %1, %4, %3, %2
%6 = phi i8* [ null, %4 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %6
}
/* Type definitions */
struct timezone {
  int dummy;
};
struct timeval {
  int dummy;
};

/* Variables and functions */
int syscall(int, struct timeval const *, int /*<<< orphan*/);
int settimeofday(const struct timeval *tv, const struct timezone *tz) {
  return syscall(79, tv, 0);
}


x86 assembly (clang, -O0):
<settimeofday>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0x4f,%edi
xor    %edx,%edx
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<settimeofday>:
mov    %rdi,%rsi
mov    $0x4f,%edi
xor    %edx,%edx
jmp    1030 <syscall@plt>

LLVM IR (-O0):
%struct.timeval = type { i32 }
%struct.timezone = type { i32 }
define i32 @settimeofday(%struct.timeval* %0, %struct.timezone* %1) {
%3 = alloca %struct.timeval*
%4 = alloca %struct.timezone*
store %struct.timeval* %0, %struct.timeval** %3
store %struct.timezone* %1, %struct.timezone** %4
%5 = load %struct.timeval*, %struct.timeval** %3
%6 = call i32 @syscall(i32 79, %struct.timeval* %5, i32 0)
ret i32 %6
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
%struct.timezone = type { i32 }
define i32 @settimeofday(%struct.timeval* %0, %struct.timezone* nocapture readnone %1) {
%3 = tail call i32 @syscall(i32 79, %struct.timeval* %0, i32 0)
ret i32 %3
}
void gtk_window_maximize() {}


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

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

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

LLVM IR (-O2):
define void @gtk_window_maximize() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ hypre_error_handler(char *, int, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stdout;
int hypre_OutOfMemory(int size) {
  printf("Out of memory trying to allocate %d bytes\n", size);
  fflush(stdout);
  hypre_error_handler(
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/ensemblr/llvm-project-boilerplate/refs/heads/"
      "main/MultiSource/Benchmarks/ASC_Sequoia/AMGmk/hypre_memory.c",
      78, 2);
  return 0;
}


x86 assembly (clang, -O0):
<hypre_OutOfMemory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
lea    0xecc(%rip),%rdi
mov    $0x4e,%esi
mov    $0x2,%edx
call   1040 <hypre_error_handler@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hypre_OutOfMemory>:
push   %rax
mov    %edi,%esi
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
lea    0xed7(%rip),%rdi
mov    $0x4e,%esi
mov    $0x2,%edx
call   1040 <hypre_error_handler@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [43 x i8] c"Out of memory trying to allocate %d bytes\0A\00"
@stdout = global i32 0
@.str.1 = [196 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ensemblr/llvm-project-boilerplate/refs/heads/main/MultiSource/Benchmarks/ASC_Sequoia/AMGmk/hypre_memory.c\00"
define i32 @hypre_OutOfMemory(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @stdout
%6 = call i32 @fflush(i32 %5)
%7 = call i32 @hypre_error_handler(i8* getelementptr inbounds ([196 x i8], [196 x i8]* @.str.1, i64 0, i64 0), i32 78, i32 2)
ret i32 0
}

LLVM IR (-O2):
@.str = [43 x i8] c"Out of memory trying to allocate %d bytes\0A\00"
@stdout = global i32 0
@.str.1 = [196 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ensemblr/llvm-project-boilerplate/refs/heads/main/MultiSource/Benchmarks/ASC_Sequoia/AMGmk/hypre_memory.c\00"
define i32 @hypre_OutOfMemory(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = load i32, i32* @stdout
%4 = tail call i32 @fflush(i32 %3)
%5 = tail call i32 @hypre_error_handler(i8* getelementptr inbounds ([196 x i8], [196 x i8]* @.str.1, i64 0, i64 0), i32 78, i32 2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ pipe(int *);
int /*<<< orphan*/ printf(char *, int, int);
main(void) {
  int fds[2];
  pipe(fds);
  printf("fd1 = %d   fd2 = %d\n", fds[0], fds[1]);
}


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

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

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

LLVM IR (-O2):
@.str = [21 x i8] c"fd1 = %d fd2 = %d\0A\00"
define i32 @main() {
%1 = alloca [2 x i32]
%2 = bitcast [2 x i32]* %1 to i8*
%3 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%4 = call i32 @pipe(i32* %3)
%5 = load i32, i32* %3
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
%7 = load i32, i32* %6
%8 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %7)
ret i32 0
}
int x28_process_syn(struct mypacket *packet) { return 0; }


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

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

LLVM IR (-O0):
%struct.mypacket = type opaque
define i32 @x28_process_syn(%struct.mypacket* %0) {
%2 = alloca %struct.mypacket*
store %struct.mypacket* %0, %struct.mypacket** %2
ret i32 0
}

LLVM IR (-O2):
%struct.mypacket = type opaque
define i32 @x28_process_syn(%struct.mypacket* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
scalar_t__ streq(char const *, char *);
const char *stringfix(const char *type) {
  if (streq(type, "string")) {
    return ("wrapstring");
  } else {
    return (type);
  }
}


x86 assembly (clang, -O0):
<stringfix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xedd(%rip),%rsi
call   1030 <streq@plt>
cmp    $0x0,%rax
je     1146 <stringfix+0x36>
lea    0xec3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    114e <stringfix+0x3e>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stringfix>:
push   %rbx
mov    %rdi,%rbx
lea    0xee9(%rip),%rsi
call   1030 <streq@plt>
test   %rax,%rax
lea    0xed6(%rip),%rax
cmove  %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"string\00"
@.str.1 = [11 x i8] c"wrapstring\00"
define i8* @stringfix(i8* %0) {
%2 = tail call i64 @streq(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i8* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0)
ret i8* %4
}
/* Type definitions */
struct _body {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct _body *);
void body_free(struct _body *b) { free(b); }


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

x86 assembly (clang, -O2):
<body_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
%struct._body = type { i32 }
define void @body_free(%struct._body* nocapture %0) {
%2 = tail call i32 @free(%struct._body* %0)
ret void
}
/* Type definitions */
struct itimerval {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ getitimer(long, struct itimerval *);
__attribute__((no)) void mygetitimer(long arg1, struct itimerval *itval) {
  getitimer(arg1, itval);
}


x86 assembly (clang, -O0):
<mygetitimer>:
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 <getitimer@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mygetitimer>:
jmp    1030 <getitimer@plt>

LLVM IR (-O0):
%struct.itimerval = type { i32 }
define void @mygetitimer(i64 %0, %struct.itimerval* %1) {
%3 = alloca i64
%4 = alloca %struct.itimerval*
store i64 %0, i64* %3
store %struct.itimerval* %1, %struct.itimerval** %4
%5 = load i64, i64* %3
%6 = load %struct.itimerval*, %struct.itimerval** %4
%7 = call i32 @getitimer(i64 %5, %struct.itimerval* %6)
ret void
}

LLVM IR (-O2):
%struct.itimerval = type { i32 }
define void @mygetitimer(i64 %0, %struct.itimerval* nocapture %1) {
%3 = tail call i32 @getitimer(i64 %0, %struct.itimerval* %1)
ret void
}
/* Variables and functions */
int *ptr(int *);
void foo(int *x) {
  int *p = ptr(x);
  *p = 3;
}


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

x86 assembly (clang, -O2):
<foo>:
push   %rax
call   1030 <ptr@plt>
movl   $0x3,(%rax)
pop    %rax
ret

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

LLVM IR (-O2):
define void @foo(i32* %0) {
%2 = tail call i32* @ptr(i32* %0)
store i32 3, i32* %2
ret void
}
int get_global_size(int i) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @get_global_size(i32 %0) {
ret i32 1
}
maplow(i) register int i;
{
  if (isupper(i))
    i = tolower(i);
  return (i);
}


x86 assembly (clang, -O0):
<maplow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <isupper@plt>
cmp    $0x0,%eax
je     1147 <maplow+0x27>
mov    -0x4(%rbp),%edi
call   1030 <tolower@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<maplow>:
push   %rbx
mov    %edi,%ebx
call   1040 <isupper@plt>
test   %eax,%eax
je     1134 <maplow+0x14>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <tolower@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @maplow(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @isupper(i32 %3)
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = call i32 @tolower(i32 %7)
store i32 %8, i32* %2
br label %9
9: ; preds = %6, %1
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
define i32 @maplow(i32 %0) {
%2 = tail call i32 @isupper(i32 %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @tolower(i32 %0)
br label %6
6: ; preds = %4, %1
%7 = phi i32 [ %5, %4 ], [ %0, %1 ]
ret i32 %7
}
unsigned int ulen(const unsigned int number, const char base) {
  unsigned int length = 1;
  unsigned int div = number;
  while (div) {
    div /= base;
    if (!div)
      break;
    length++;
  }
  return length;
}


x86 assembly (clang, -O0):
<ulen>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     114f <ulen+0x4f>
movsbl -0x5(%rbp),%ecx
mov    -0x10(%rbp),%eax
xor    %edx,%edx
div    %ecx
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    1141 <ulen+0x41>
jmp    114f <ulen+0x4f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    111a <ulen+0x1a>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ulen>:
mov    $0x1,%ecx
test   %edi,%edi
je     1133 <ulen+0x33>
cmp    %edi,%esi
ja     1133 <ulen+0x33>
mov    $0x1,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %edi,%eax
xor    %edx,%edx
div    %esi
add    $0x1,%ecx
cmp    %esi,%edi
jb     1133 <ulen+0x33>
mov    %eax,%edi
cmp    %esi,%eax
jae    1120 <ulen+0x20>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @ulen(i32 %0, i8 signext %1) {
%3 = sext i8 %1 to i32
%4 = icmp eq i32 %0, 0
%5 = icmp ugt i32 %3, %0
%6 = or i1 %4, %5
br i1 %6, label %15, label %7
7: ; preds = %2, %7
%8 = phi i32 [ %10, %7 ], [ %0, %2 ]
%9 = phi i32 [ %11, %7 ], [ 1, %2 ]
%10 = udiv i32 %8, %3
%11 = add i32 %9, 1
%12 = icmp ult i32 %8, %3
%13 = icmp ult i32 %10, %3
%14 = or i1 %12, %13
br i1 %14, label %15, label %7
15: ; preds = %7, %2
%16 = phi i32 [ 1, %2 ], [ %11, %7 ]
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ st7036_cursor_position(int /*<<< orphan*/, int);
int /*<<< orphan*/ st7036_lcd_buffer(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
void lcd_text_line(int line, char *s) {
  char st[16];
  int r;
  strncpy(st, s, 16);
  r = line % 3;
  st7036_cursor_position(0, r);
  st7036_lcd_buffer(st);
}


x86 assembly (clang, -O0):
<lcd_text_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x10,%edx
call   1030 <strncpy@plt>
mov    -0x4(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,-0x24(%rbp)
mov    -0x24(%rbp),%esi
xor    %edi,%edi
call   1040 <st7036_cursor_position@plt>
lea    -0x20(%rbp),%rdi
call   1050 <st7036_lcd_buffer@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcd_text_line>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %edi,%ebx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x10,%edx
call   1030 <strncpy@plt>
movslq %ebx,%rsi
imul   $0x55555556,%rsi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%esi
xor    %edi,%edi
call   1040 <st7036_cursor_position@plt>
mov    %r14,%rdi
call   1050 <st7036_lcd_buffer@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @lcd_text_line(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [16 x i8]
%6 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
%7 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%8 = load i8*, i8** %4
%9 = call i32 @strncpy(i8* %7, i8* %8, i32 16)
%10 = load i32, i32* %3
%11 = srem i32 %10, 3
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = call i32 @st7036_cursor_position(i32 0, i32 %12)
%14 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%15 = call i32 @st7036_lcd_buffer(i8* %14)
ret void
}

LLVM IR (-O2):
define void @lcd_text_line(i32 %0, i8* %1) {
%3 = alloca [16 x i8]
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%5 = call i32 @strncpy(i8* %4, i8* %1, i32 16)
%6 = srem i32 %0, 3
%7 = call i32 @st7036_cursor_position(i32 0, i32 %6)
%8 = call i32 @st7036_lcd_buffer(i8* %4)
ret void
}
/* Variables and functions */
int flash_image(void *, unsigned int, char *);
int flash_android_kernel(void *data, unsigned sz) {
  return flash_image(data, sz, "boot");
}


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

x86 assembly (clang, -O2):
<flash_android_kernel>:
lea    0xee9(%rip),%rdx
jmp    1030 <flash_image@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"boot\00"
define i32 @flash_android_kernel(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 @flash_image(i8* %5, i32 %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 %7
}

LLVM IR (-O2):
@.str = [5 x i8] c"boot\00"
define i32 @flash_android_kernel(i8* %0, i32 %1) {
%3 = tail call i32 @flash_image(i8* %0, i32 %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isgraph(int);
void t_isgraph_0x59() {
  Assert_real((isgraph(89)),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isgraph.c",
              450, ("isgraph should be 1 for Y"));
}


x86 assembly (clang, -O0):
<t_isgraph_0x59>:
push   %rbp
mov    %rsp,%rbp
mov    $0x59,%edi
call   1040 <isgraph@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x1c2,%edx
lea    0xf65(%rip),%rcx
call   1030 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isgraph_0x59>:
push   %rax
mov    $0x59,%edi
call   1040 <isgraph@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0x1c2,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isgraph.c\00"
@.str.1 = [26 x i8] c"isgraph should be 1 for Y\00"
define void @t_isgraph_0x59() {
%1 = call i32 @isgraph(i32 89)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 450, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isgraph.c\00"
@.str.1 = [26 x i8] c"isgraph should be 1 for Y\00"
define void @t_isgraph_0x59() {
%1 = tail call i32 @isgraph(i32 89)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 450, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
const char **getcompilerversion() {
  static const char *compiler[] = {"GCC", "9.4.0"};
  return compiler;
}


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

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

LLVM IR (-O0):
@getcompilerversion.compiler = internal global [2 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0)]
@.str = [4 x i8] c"GCC\00"
@.str.1 = [6 x i8] c"9.4.0\00"
define i8** @getcompilerversion() {
ret i8** getelementptr inbounds ([2 x i8*], [2 x i8*]* @getcompilerversion.compiler, i64 0, i64 0)
}

LLVM IR (-O2):
@getcompilerversion.compiler = internal global [2 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0)]
@.str = [4 x i8] c"GCC\00"
@.str.1 = [6 x i8] c"9.4.0\00"
define i8** @getcompilerversion() {
ret i8** getelementptr inbounds ([2 x i8*], [2 x i8*]* @getcompilerversion.compiler, i64 0, i64 0)
}
/* Type definitions */
struct drand48_data {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ drand48_r(struct drand48_data *, double *);
long mb_rand_range_long(struct drand48_data *rand, long from, long to) {
  long width = to - from;
  double ret;
  drand48_r(rand, &ret);
  return ret * width + from;
}


x86 assembly (clang, -O0):
<mb_rand_range_long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
sub    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <drand48_r@plt>
movsd  -0x28(%rbp),%xmm0
cvtsi2sdq -0x20(%rbp),%xmm2
cvtsi2sdq -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mb_rand_range_long>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r14
sub    %rsi,%rbx
mov    %rsp,%rsi
call   1030 <drand48_r@plt>
cvtsi2sd %rbx,%xmm0
cvtsi2sd %r14,%xmm1
mulsd  (%rsp),%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.drand48_data = type { i32 }
define i64 @mb_rand_range_long(%struct.drand48_data* %0, i64 %1, i64 %2) {
%4 = alloca %struct.drand48_data*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca double
store %struct.drand48_data* %0, %struct.drand48_data** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%9 = load i64, i64* %6
%10 = load i64, i64* %5
%11 = sub nsw i64 %9, %10
store i64 %11, i64* %7
%12 = load %struct.drand48_data*, %struct.drand48_data** %4
%13 = call i32 @drand48_r(%struct.drand48_data* %12, double* %8)
%14 = load double, double* %8
%15 = load i64, i64* %7
%16 = sitofp i64 %15 to double
%17 = load i64, i64* %5
%18 = sitofp i64 %17 to double
%19 = call double @llvm.fmuladd.f64(double %14, double %16, double %18)
%20 = fptosi double %19 to i64
ret i64 %20
}

LLVM IR (-O2):
%struct.drand48_data = type { i32 }
define i64 @mb_rand_range_long(%struct.drand48_data* %0, i64 %1, i64 %2) {
%4 = alloca double
%5 = sub nsw i64 %2, %1
%6 = bitcast double* %4 to i8*
%7 = call i32 @drand48_r(%struct.drand48_data* %0, double* %4)
%8 = load double, double* %4
%9 = sitofp i64 %5 to double
%10 = sitofp i64 %1 to double
%11 = call double @llvm.fmuladd.f64(double %8, double %9, double %10)
%12 = fptosi double %11 to i64
ret i64 %12
}
/* Type definitions */
typedef scalar_t__ uint8_t;

/* Variables and functions */
scalar_t__ scale8_video(scalar_t__, scalar_t__);
uint8_t brighten8_video(uint8_t x) {
  uint8_t ix = 255 - x;
  return 255 - scale8_video(ix, ix);
}


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

x86 assembly (clang, -O2):
<brighten8_video>:
push   %rbx
mov    $0xff,%ebx
mov    $0xff,%esi
sub    %rdi,%rsi
mov    %rsi,%rdi
call   1030 <scale8_video@plt>
sub    %rax,%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @brighten8_video(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = sub nsw i64 255, %4
store i64 %5, i64* %3
%6 = load i64, i64* %3
%7 = load i64, i64* %3
%8 = call i64 @scale8_video(i64 %6, i64 %7)
%9 = sub nsw i64 255, %8
ret i64 %9
}

LLVM IR (-O2):
define i64 @brighten8_video(i64 %0) {
%2 = sub nsw i64 255, %0
%3 = tail call i64 @scale8_video(i64 %2, i64 %2)
%4 = sub nsw i64 255, %3
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ printUsage();
int /*<<< orphan*/ printf(char *, char *);
void optionError(char **argv, int index) {
  printf("Illegal option: %s\n\n", argv[index]);
  printUsage();
}


x86 assembly (clang, -O0):
<optionError>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <printUsage@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<optionError>:
push   %rax
movslq %esi,%rax
mov    (%rdi,%rax,8),%rsi
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <printUsage@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"Illegal option: %s\0A\0A\00"
define void @optionError(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 = sext i32 %6 to i64
%8 = getelementptr inbounds i8*, i8** %5, i64 %7
%9 = load i8*, i8** %8
%10 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = call i32 (...) @printUsage()
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"Illegal option: %s\0A\0A\00"
define void @optionError(i8** nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i8*, i8** %0, i64 %3
%5 = load i8*, i8** %4
%6 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = tail call i32 (...) @printUsage()
ret void
}