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

/* Variables and functions */
int fileno(int /*<<< orphan*/ *);
int okcash_fileno(FILE *f) { return fileno(f); }


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

x86 assembly (clang, -O2):
<okcash_fileno>:
jmp    1030 <fileno@plt>

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

LLVM IR (-O2):
define i32 @okcash_fileno(i32* nocapture %0) {
%2 = tail call i32 @fileno(i32* %0)
ret i32 %2
}
/* Variables and functions */
int unlink(char const *);
int pid_exit(const char *pidfile) { return unlink(pidfile); }


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

x86 assembly (clang, -O2):
<pid_exit>:
jmp    1030 <unlink@plt>

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

LLVM IR (-O2):
define i32 @pid_exit(i8* nocapture %0) {
%2 = tail call i32 @unlink(i8* %0)
ret i32 %2
}
void irc_change_nick() { return; }


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

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

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

LLVM IR (-O2):
define void @irc_change_nick() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bar(int, int);
int /*<<< orphan*/ foo(int);
void fn_15(void) {
  int i;
  for ((i) = (0); (i) < (10); (i++))
    foo(i);
  bar(i, i);
}


x86 assembly (clang, -O0):
<fn_15>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    114f <fn_15+0x2f>
mov    -0x4(%rbp),%edi
call   1040 <foo@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112f <fn_15+0xf>
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1030 <bar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn_15>:
push   %rax
xor    %edi,%edi
call   1040 <foo@plt>
mov    $0x1,%edi
call   1040 <foo@plt>
mov    $0x2,%edi
call   1040 <foo@plt>
mov    $0x3,%edi
call   1040 <foo@plt>
mov    $0x4,%edi
call   1040 <foo@plt>
mov    $0x5,%edi
call   1040 <foo@plt>
mov    $0x6,%edi
call   1040 <foo@plt>
mov    $0x7,%edi
call   1040 <foo@plt>
mov    $0x8,%edi
call   1040 <foo@plt>
mov    $0x9,%edi
call   1040 <foo@plt>
mov    $0xa,%edi
mov    $0xa,%esi
pop    %rax
jmp    1030 <bar@plt>

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

LLVM IR (-O2):
define void @fn_15() {
%1 = tail call i32 @foo(i32 0)
%2 = tail call i32 @foo(i32 1)
%3 = tail call i32 @foo(i32 2)
%4 = tail call i32 @foo(i32 3)
%5 = tail call i32 @foo(i32 4)
%6 = tail call i32 @foo(i32 5)
%7 = tail call i32 @foo(i32 6)
%8 = tail call i32 @foo(i32 7)
%9 = tail call i32 @foo(i32 8)
%10 = tail call i32 @foo(i32 9)
%11 = tail call i32 @bar(i32 10, i32 10)
ret void
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
int lfs1_scmp(uint32_t a, uint32_t b) { return (int)(unsigned)(a - b); }


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

x86 assembly (clang, -O2):
<lfs1_scmp>:
mov    %rdi,%rax
sub    %esi,%eax
ret

LLVM IR (-O0):
define i32 @lfs1_scmp(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = sub nsw i64 %5, %6
%8 = trunc i64 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @lfs1_scmp(i64 %0, i64 %1) {
%3 = sub nsw i64 %0, %1
%4 = trunc i64 %3 to i32
ret i32 %4
}
void handle_fiq(void) { return; }


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ SEEK_CUR;
int /*<<< orphan*/ lseek(int const, int /*<<< orphan*/, int /*<<< orphan*/);
off_t file_offset(const int fd) { return lseek(fd, 0, SEEK_CUR); }


x86 assembly (clang, -O0):
<file_offset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ec3(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1030 <lseek@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_offset>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
jmp    1030 <lseek@plt>

LLVM IR (-O0):
@SEEK_CUR = global i32 0
define i32 @file_offset(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SEEK_CUR
%5 = call i32 @lseek(i32 %3, i32 0, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
@SEEK_CUR = global i32 0
define i32 @file_offset(i32 %0) {
%2 = load i32, i32* @SEEK_CUR
%3 = tail call i32 @lseek(i32 %0, i32 0, i32 %2)
ret i32 %3
}
int test_imm_EEuint64_lowword_reg(unsigned long long val) {
  return ((val) & (0xEE << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_EEuint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 238
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
double asin(int);
int cos(double);
int sin(double);
double alt(double glat, double ha, double dec) {
  return (asin(sin(dec) * sin(glat) + cos(dec) * cos(glat) * cos(ha)));
}


x86 assembly (clang, -O0):
<alt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <sin@plt>
mov    %eax,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1050 <cos@plt>
mov    %eax,-0x24(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1050 <cos@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x1c(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <cos@plt>
mov    -0x20(%rbp),%edi
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
imul   %ecx,%eax
add    %eax,%edi
call   1040 <asin@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alt>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,(%rsp)
movaps %xmm2,%xmm0
call   1030 <sin@plt>
mov    %eax,%ebx
movsd  (%rsp),%xmm0
call   1030 <sin@plt>
imul   %eax,%ebx
movsd  0x8(%rsp),%xmm0
call   1050 <cos@plt>
mov    %eax,%ebp
movsd  (%rsp),%xmm0
call   1050 <cos@plt>
imul   %eax,%ebp
movsd  0x10(%rsp),%xmm0
call   1050 <cos@plt>
imul   %eax,%ebp
add    %ebx,%ebp
mov    %ebp,%edi
add    $0x18,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <asin@plt>

LLVM IR (-O0):
define double @alt(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %6
%8 = call i32 @sin(double %7)
%9 = load double, double* %4
%10 = call i32 @sin(double %9)
%11 = mul nsw i32 %8, %10
%12 = load double, double* %6
%13 = call i32 @cos(double %12)
%14 = load double, double* %4
%15 = call i32 @cos(double %14)
%16 = mul nsw i32 %13, %15
%17 = load double, double* %5
%18 = call i32 @cos(double %17)
%19 = mul nsw i32 %16, %18
%20 = add nsw i32 %11, %19
%21 = call double @asin(i32 %20)
ret double %21
}

LLVM IR (-O2):
define double @alt(double %0, double %1, double %2) {
%4 = tail call i32 @sin(double %2)
%5 = tail call i32 @sin(double %0)
%6 = mul nsw i32 %5, %4
%7 = tail call i32 @cos(double %2)
%8 = tail call i32 @cos(double %0)
%9 = mul nsw i32 %8, %7
%10 = tail call i32 @cos(double %1)
%11 = mul nsw i32 %9, %10
%12 = add nsw i32 %11, %6
%13 = tail call double @asin(i32 %12)
ret double %13
}
/* Type definitions */
typedef int /*<<< orphan*/ val;
typedef int /*<<< orphan*/ socklen_t;

/* Variables and functions */
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_ERROR;
int getsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, void *,
               int /*<<< orphan*/ *);
int ss_check_sock_error(int fd) {
  int val = 0;
  int len = sizeof(val);
  int res =
      getsockopt(fd, SOL_SOCKET, SO_ERROR, (void *)&val, (socklen_t *)&len);
  return val;
}


x86 assembly (clang, -O0):
<ss_check_sock_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x4,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eb5(%rip),%rax
mov    (%rax),%esi
mov    0x2e9c(%rip),%rax
mov    (%rax),%edx
lea    -0x8(%rbp),%rcx
lea    -0xc(%rbp),%r8
call   1030 <getsockopt@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ss_check_sock_error>:
push   %rax
movl   $0x0,(%rsp)
movl   $0x4,0x4(%rsp)
mov    0x2ec1(%rip),%rax
mov    (%rax),%esi
mov    0x2ea8(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rcx
lea    0x4(%rsp),%r8
call   1030 <getsockopt@plt>
mov    (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@SOL_SOCKET = global i32 0
@SO_ERROR = global i32 0
define i32 @ss_check_sock_error(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
store i32 4, i32* %4
%6 = load i32, i32* %2
%7 = load i32, i32* @SOL_SOCKET
%8 = load i32, i32* @SO_ERROR
%9 = bitcast i32* %3 to i8*
%10 = call i32 @getsockopt(i32 %6, i32 %7, i32 %8, i8* %9, i32* %4)
store i32 %10, i32* %5
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
@SOL_SOCKET = global i32 0
@SO_ERROR = global i32 0
define i32 @ss_check_sock_error(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = bitcast i32* %3 to i8*
store i32 4, i32* %3
%6 = load i32, i32* @SOL_SOCKET
%7 = load i32, i32* @SO_ERROR
%8 = call i32 @getsockopt(i32 %0, i32 %6, i32 %7, i8* %4, i32* %3)
%9 = load i32, i32* %2
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ c_panic(char *, char *);
void *memset(void *str, int c, size_t n) {
  c_panic("NOT_IMPLEMENTED", "Function not implemented");
  return (void *)0x0;
}


x86 assembly (clang, -O0):
<memset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xed6(%rip),%rdi
lea    0xedf(%rip),%rsi
call   1030 <c_panic@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [16 x i8] c"NOT_IMPLEMENTED\00"
@.str.1 = [25 x i8] c"Function not implemented\00"
define i8* @memset(i8* %0, i32 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i64
store i8* %0, i8** %4
store i32 %1, i32* %5
store i64 %2, i64* %6
%7 = call i32 @c_panic(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
ret i8* null
}

LLVM IR (-O2):
@.str = [16 x i8] c"NOT_IMPLEMENTED\00"
@.str.1 = [25 x i8] c"Function not implemented\00"
define noalias i8* @memset(i8* nocapture readnone %0, i32 %1, i64 %2) {
%4 = tail call i32 @c_panic(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
ret i8* null
}
/* Type definitions */
struct genlist {
  int dummy;
};
struct fc_sockaddr_list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ genlist_reverse(struct genlist *);
void fc_sockaddr_list_reverse(struct fc_sockaddr_list *tthis) {
  genlist_reverse((struct genlist *)tthis);
}


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

x86 assembly (clang, -O2):
<fc_sockaddr_list_reverse>:
jmp    1030 <genlist_reverse@plt>

LLVM IR (-O0):
%struct.fc_sockaddr_list = type { i32 }
%struct.genlist = type { i32 }
define void @fc_sockaddr_list_reverse(%struct.fc_sockaddr_list* %0) {
%2 = alloca %struct.fc_sockaddr_list*
store %struct.fc_sockaddr_list* %0, %struct.fc_sockaddr_list** %2
%3 = load %struct.fc_sockaddr_list*, %struct.fc_sockaddr_list** %2
%4 = bitcast %struct.fc_sockaddr_list* %3 to %struct.genlist*
%5 = call i32 @genlist_reverse(%struct.genlist* %4)
ret void
}

LLVM IR (-O2):
%struct.fc_sockaddr_list = type { i32 }
%struct.genlist = type { i32 }
define void @fc_sockaddr_list_reverse(%struct.fc_sockaddr_list* %0) {
%2 = bitcast %struct.fc_sockaddr_list* %0 to %struct.genlist*
%3 = tail call i32 @genlist_reverse(%struct.genlist* %2)
ret void
}
int printable(int ch) { return (ch > 0x20 && ch < 0x7f); }


x86 assembly (clang, -O0):
<printable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x20,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jle    1120 <printable+0x20>
cmpl   $0x7f,-0x4(%rbp)
setl   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<printable>:
add    $0xffffffdf,%edi
xor    %eax,%eax
cmp    $0x5e,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @printable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 32
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 127
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @printable(i32 %0) {
%2 = add i32 %0, -33
%3 = icmp ult i32 %2, 94
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
char *calloc(int, scalar_t__);
scalar_t__ strlen(char *);
char *_copy(char *c) {
  char *res = calloc(1, strlen(c) + 1);
  char *r = res;
  while (*c) {
    *(r++) = *(c++);
  }
  return res;
}


x86 assembly (clang, -O0):
<_copy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rsi
add    $0x1,%rsi
mov    $0x1,%edi
call   1040 <calloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1186 <_copy+0x66>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
jmp    1152 <_copy+0x32>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_copy>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
lea    0x1(%rax),%rsi
mov    $0x1,%edi
call   1040 <calloc@plt>
mov    (%rbx),%cl
test   %cl,%cl
je     1150 <_copy+0x30>
xor    %edx,%edx
nop
mov    %cl,(%rax,%rdx,1)
movzbl 0x1(%rbx,%rdx,1),%ecx
add    $0x1,%rdx
test   %cl,%cl
jne    1140 <_copy+0x20>
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @_copy(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @calloc(i32 1, i64 %3)
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %15, label %7
7: ; preds = %1, %7
%8 = phi i8 [ %13, %7 ], [ %5, %1 ]
%9 = phi i8* [ %12, %7 ], [ %4, %1 ]
%10 = phi i8* [ %11, %7 ], [ %0, %1 ]
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = getelementptr inbounds i8, i8* %9, i64 1
store i8 %8, i8* %9
%13 = load i8, i8* %11
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %7
15: ; preds = %7, %1
ret i8* %4
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
unsigned int bytestream_get_le24(const uint8_t **b) {
  (*b) += 3;
  return ((((const uint8_t *)(*b - 3))[2] << 16) |
          (((const uint8_t *)(*b - 3))[1] << 8) |
          ((const uint8_t *)(*b - 3))[0]);
}


x86 assembly (clang, -O0):
<bytestream_get_le24>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0xc,%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x4(%rax),%eax
shl    $0x10,%eax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rcx
mov    -0x8(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rcx
or     -0xc(%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bytestream_get_le24>:
mov    (%rdi),%rcx
lea    0xc(%rcx),%rax
mov    %rax,(%rdi)
mov    0x4(%rcx),%eax
mov    0x8(%rcx),%edx
shl    $0x10,%edx
shl    $0x8,%eax
or     %edx,%eax
or     (%rcx),%eax
ret

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

LLVM IR (-O2):
define i32 @bytestream_get_le24(i32** nocapture %0) {
%2 = load i32*, i32** %0
%3 = getelementptr inbounds i32, i32* %2, i64 3
store i32* %3, i32** %0
%4 = getelementptr inbounds i32, i32* %2, i64 2
%5 = load i32, i32* %4
%6 = shl i32 %5, 16
%7 = getelementptr inbounds i32, i32* %2, i64 1
%8 = load i32, i32* %7
%9 = shl i32 %8, 8
%10 = or i32 %9, %6
%11 = load i32, i32* %2
%12 = or i32 %10, %11
ret i32 %12
}
void badseq(j, k) register int j, k;
{
  printf("\t.byte\t0x%02.2x\t\t| invalid code sequence\n", j);
  printf("\t.byte\t0x%02.2x\n", k);
}


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

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

LLVM IR (-O0):
@.str = [42 x i8] c"\09.byte\090x%02.2x\09\09| invalid code sequence\0A\00"
@.str.1 = [17 x i8] c"\09.byte\090x%02.2x\0A\00"
define void @badseq(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %4
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"\09.byte\090x%02.2x\09\09| invalid code sequence\0A\00"
@.str.1 = [17 x i8] c"\09.byte\090x%02.2x\0A\00"
define void @badseq(i32 %0, i32 %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %0)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _xstrcat(char **, char *);
int /*<<< orphan*/ errno;
char *slurm_strerror(int /*<<< orphan*/);
void _xslurm_strerrorcat(char **buf) {
  char *err = slurm_strerror(errno);
  _xstrcat(&(*buf), err);
}


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

x86 assembly (clang, -O2):
<_xslurm_strerrorcat>:
push   %rbx
mov    %rdi,%rbx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
call   1040 <slurm_strerror@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
pop    %rbx
jmp    1030 <_xstrcat@plt>

LLVM IR (-O0):
@errno = global i32 0
define void @_xslurm_strerrorcat(i8** %0) {
%2 = alloca i8**
%3 = alloca i8*
store i8** %0, i8*** %2
%4 = load i32, i32* @errno
%5 = call i8* @slurm_strerror(i32 %4)
store i8* %5, i8** %3
%6 = load i8**, i8*** %2
%7 = load i8*, i8** %3
%8 = call i32 @_xstrcat(i8** %6, i8* %7)
ret void
}

LLVM IR (-O2):
@errno = global i32 0
define void @_xslurm_strerrorcat(i8** %0) {
%2 = load i32, i32* @errno
%3 = tail call i8* @slurm_strerror(i32 %2)
%4 = tail call i32 @_xstrcat(i8** %0, i8* %3)
ret void
}
void break_debugger() {}


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

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

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

LLVM IR (-O2):
define void @break_debugger() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ return_struct_vf4();
int /*<<< orphan*/ take_struct_vf4(int /*<<< orphan*/);
void test_struct_vf4() { take_struct_vf4(return_struct_vf4()); }


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

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

LLVM IR (-O0):
define void @test_struct_vf4() {
%1 = call i32 (...) @return_struct_vf4()
%2 = call i32 @take_struct_vf4(i32 %1)
ret void
}

LLVM IR (-O2):
define void @test_struct_vf4() {
%1 = tail call i32 (...) @return_struct_vf4()
%2 = tail call i32 @take_struct_vf4(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ clang_analyzer_eval(int);
int strlen(char *);
void bzero2_char_array_null() {
  char str[] = "abcd";
  clang_analyzer_eval(strlen(str) == 4);
  bzero(str, 2);
  clang_analyzer_eval(strlen(str) == 0);
}


x86 assembly (clang, -O0):
<bzero2_char_array_null>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xec2(%rip),%eax
mov    %eax,-0x5(%rbp)
mov    0xebd(%rip),%al
mov    %al,-0x1(%rbp)
lea    -0x5(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x4,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <clang_analyzer_eval@plt>
lea    -0x5(%rbp),%rdi
mov    $0x2,%esi
call   1040 <bzero@plt>
lea    -0x5(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <clang_analyzer_eval@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bzero2_char_array_null>:
push   %rbx
sub    $0x10,%rsp
movb   $0x0,0xc(%rsp)
movl   $0x64636261,0x8(%rsp)
64
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
xor    %edi,%edi
cmp    $0x4,%eax
sete   %dil
call   1050 <clang_analyzer_eval@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <bzero@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <clang_analyzer_eval@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.bzero2_char_array_null.str = [5 x i8] c"abcd\00"
define void @bzero2_char_array_null() {
%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 i32 @strlen(i8* %3)
%5 = icmp eq i32 %4, 4
%6 = zext i1 %5 to i32
%7 = call i32 @clang_analyzer_eval(i32 %6)
%8 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%9 = call i32 @bzero(i8* %8, i32 2)
%10 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%11 = call i32 @strlen(i8* %10)
%12 = icmp eq i32 %11, 0
%13 = zext i1 %12 to i32
%14 = call i32 @clang_analyzer_eval(i32 %13)
ret void
}

LLVM IR (-O2):
@__const.bzero2_char_array_null.str = [5 x i8] c"abcd\00"
define void @bzero2_char_array_null() {
%1 = alloca [5 x i8]
%2 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%3 = call i32 @strlen(i8* %2)
%4 = icmp eq i32 %3, 4
%5 = zext i1 %4 to i32
%6 = call i32 @clang_analyzer_eval(i32 %5)
%7 = call i32 @bzero(i8* %2, i32 2)
%8 = call i32 @strlen(i8* %2)
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
%11 = call i32 @clang_analyzer_eval(i32 %10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strncat(char *, char const *, int);
int system(char *);
int rmrf(const char *dir) {
  char cmd[150] = "rm -rf ";
  strncat(cmd, dir, 140);
  return (system(cmd));
}


x86 assembly (clang, -O0):
<rmrf>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0xa0(%rbp),%rdi
lea    0xeb3(%rip),%rsi
mov    $0x96,%edx
call   1050 <memcpy@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x8c,%edx
call   1040 <strncat@plt>
lea    -0xa0(%rbp),%rdi
call   1030 <system@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rmrf>:
push   %r14
push   %rbx
sub    $0x98,%rsp
mov    %rdi,%rbx
lea    0xebc(%rip),%rsi
mov    %rsp,%r14
mov    $0x96,%edx
mov    %r14,%rdi
call   1050 <memcpy@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x8c,%edx
call   1040 <strncat@plt>
mov    %r14,%rdi
call   1030 <system@plt>
add    $0x98,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.rmrf.cmd = [150 x i8] c"rm -rf \00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
define i32 @rmrf(i8* %0) {
%2 = alloca i8*
%3 = alloca [150 x i8]
store i8* %0, i8** %2
%4 = bitcast [150 x i8]* %3 to i8*
%5 = getelementptr inbounds [150 x i8], [150 x i8]* %3, i64 0, i64 0
%6 = load i8*, i8** %2
%7 = call i32 @strncat(i8* %5, i8* %6, i32 140)
%8 = getelementptr inbounds [150 x i8], [150 x i8]* %3, i64 0, i64 0
%9 = call i32 @system(i8* %8)
ret i32 %9
}

LLVM IR (-O2):
@__const.rmrf.cmd = [150 x i8] c"rm -rf \00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
define i32 @rmrf(i8* %0) {
%2 = alloca [150 x i8]
%3 = getelementptr inbounds [150 x i8], [150 x i8]* %2, i64 0, i64 0
%4 = call i32 @strncat(i8* %3, i8* %0, i32 140)
%5 = call i32 @system(i8* %3)
ret i32 %5
}
/* Variables and functions */
scalar_t__ ASRT_Char(char, char);
int /*<<< orphan*/ ASRT_Mark(char *, int, char *);
int test_CharOk() {
  do {
    ASRT_Mark("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/cohadar/c-learning/refs/heads/master/"
              "src/asrt_tests.c",
              189,
              "'X'"
              " == "
              "'X'");
    if (ASRT_Char('X', 'X')) {
      return 1;
    };
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<test_CharOk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0xbd,%esi
lea    0xf55(%rip),%rdx
call   1040 <ASRT_Mark@plt>
mov    $0x58,%esi
mov    %esi,%edi
call   1030 <ASRT_Char@plt>
cmp    $0x0,%rax
je     1162 <test_CharOk+0x42>
movl   $0x1,-0x4(%rbp)
jmp    116e <test_CharOk+0x4e>
jmp    1167 <test_CharOk+0x47>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_CharOk>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xf61(%rip),%rdx
mov    $0xbd,%esi
call   1040 <ASRT_Mark@plt>
mov    $0x58,%edi
mov    $0x58,%esi
call   1030 <ASRT_Char@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [144 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/cohadar/c-learning/refs/heads/master/src/asrt_tests.c\00"
@.str.1 = [11 x i8] c"'X' == 'X'\00"
define i32 @test_CharOk() {
%1 = alloca i32
br label %2
2: ; preds = %0
%3 = call i32 @ASRT_Mark(i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str, i64 0, i64 0), i32 189, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%4 = call i64 @ASRT_Char(i8 signext 88, i8 signext 88)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %2
store i32 1, i32* %1
br label %9
7: ; preds = %2
br label %8
8: ; preds = %7
store i32 0, i32* %1
br label %9
9: ; preds = %8, %6
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
@.str = [144 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/cohadar/c-learning/refs/heads/master/src/asrt_tests.c\00"
@.str.1 = [11 x i8] c"'X' == 'X'\00"
define i32 @test_CharOk() {
%1 = tail call i32 @ASRT_Mark(i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str, i64 0, i64 0), i32 189, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i64 @ASRT_Char(i8 signext 88, i8 signext 88)
%3 = icmp ne i64 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ isdigit(int /*<<< orphan*/);
int is_number(const char *string) {
  while (*string)
    if (!isdigit(*string++))
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<is_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     115a <is_number+0x4a>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    1155 <is_number+0x45>
movl   $0x0,-0x4(%rbp)
jmp    1161 <is_number+0x51>
jmp    111c <is_number+0xc>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_number>:
movsbl (%rdi),%eax
test   %eax,%eax
je     1116 <is_number+0x16>
add    $0x1,%rdi
add    $0xffffffd0,%eax
cmp    $0xa,%eax
jb     1100 <is_number>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @is_number(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
br label %4
4: ; preds = %16, %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 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %3
%11 = load i8, i8* %9
%12 = sext i8 %11 to i32
%13 = call i32 @isdigit(i32 %12)
%14 = icmp ne i32 %13, 0
br i1 %14, label %16, label %15
15: ; preds = %8
store i32 0, i32* %2
br label %18
16: ; preds = %8
br label %4
17: ; preds = %4
store i32 1, i32* %2
br label %18
18: ; preds = %17, %15
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @is_number(i8* nocapture %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %7, %6 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %3, i64 1
%8 = sext i8 %4 to i32
%9 = add nsw i32 %8, -48
%10 = icmp ult i32 %9, 10
br i1 %10, label %2, label %11
11: ; preds = %2, %6
%12 = phi i32 [ 0, %6 ], [ 1, %2 ]
ret i32 %12
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void write_32_le(uint32_t value, unsigned char bytes[4]) {
  for (int i = 0; i < 4; i++, value >>= 8)
    bytes[i] = value & 0xff;
}


x86 assembly (clang, -O0):
<write_32_le>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    1148 <write_32_le+0x48>
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0x4(%rbp)
jmp    1112 <write_32_le+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_32_le>:
mov    %edi,(%rsi)
ret

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

LLVM IR (-O2):
define void @write_32_le(i32 %0, i8* nocapture writeonly %1) {
%3 = trunc i32 %0 to i8
store i8 %3, i8* %1
%4 = lshr i32 %0, 8
%5 = trunc i32 %4 to i8
%6 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %5, i8* %6
%7 = lshr i32 %0, 16
%8 = trunc i32 %7 to i8
%9 = getelementptr inbounds i8, i8* %1, i64 2
store i8 %8, i8* %9
%10 = lshr i32 %0, 24
%11 = trunc i32 %10 to i8
%12 = getelementptr inbounds i8, i8* %1, i64 3
store i8 %11, i8* %12
ret void
}
/* Type definitions */
struct uwsgi_buffer {
  int dummy;
};

/* Variables and functions */
scalar_t__ uwsgi_buffer_append(struct uwsgi_buffer *, char *, int);
int uwsgi_webdav_multistatus_prop_close(struct uwsgi_buffer *ub) {
  if (uwsgi_buffer_append(ub, "</D:prop>\n", 10))
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<uwsgi_webdav_multistatus_prop_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
mov    $0xa,%edx
call   1030 <uwsgi_buffer_append@plt>
cmp    $0x0,%rax
je     1147 <uwsgi_webdav_multistatus_prop_close+0x37>
movl   $0xffffffff,-0x4(%rbp)
jmp    114e <uwsgi_webdav_multistatus_prop_close+0x3e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uwsgi_webdav_multistatus_prop_close>:
push   %rax
lea    0xee8(%rip),%rsi
mov    $0xa,%edx
call   1030 <uwsgi_buffer_append@plt>
neg    %rax
sbb    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.uwsgi_buffer = type { i32 }
@.str = [11 x i8] c"</D:prop>\0A\00"
define i32 @uwsgi_webdav_multistatus_prop_close(%struct.uwsgi_buffer* %0) {
%2 = alloca i32
%3 = alloca %struct.uwsgi_buffer*
store %struct.uwsgi_buffer* %0, %struct.uwsgi_buffer** %3
%4 = load %struct.uwsgi_buffer*, %struct.uwsgi_buffer** %3
%5 = call i64 @uwsgi_buffer_append(%struct.uwsgi_buffer* %4, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 10)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 -1, i32* %2
br label %9
8: ; preds = %1
store i32 0, i32* %2
br label %9
9: ; preds = %8, %7
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
%struct.uwsgi_buffer = type { i32 }
@.str = [11 x i8] c"</D:prop>\0A\00"
define i32 @uwsgi_webdav_multistatus_prop_close(%struct.uwsgi_buffer* %0) {
%2 = tail call i64 @uwsgi_buffer_append(%struct.uwsgi_buffer* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 10)
%3 = icmp ne i64 %2, 0
%4 = sext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ bar();
int /*<<< orphan*/ foo();
int /*<<< orphan*/ one();
int main() {
  one();
  foo();
  one();
  one();
  bar();
  one();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <one@plt>
mov    $0x0,%al
call   1040 <foo@plt>
mov    $0x0,%al
call   1050 <one@plt>
mov    $0x0,%al
call   1050 <one@plt>
mov    $0x0,%al
call   1030 <bar@plt>
mov    $0x0,%al
call   1050 <one@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @one()
%2 = call i32 (...) @foo()
%3 = call i32 (...) @one()
%4 = call i32 (...) @one()
%5 = call i32 (...) @bar()
%6 = call i32 (...) @one()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @one()
%2 = tail call i32 (...) @foo()
%3 = tail call i32 (...) @one()
%4 = tail call i32 (...) @one()
%5 = tail call i32 (...) @bar()
%6 = tail call i32 (...) @one()
ret i32 0
}
int count_ones(int n) {
  int ones = 0;
  while (n != 0) {
    if ((n & 1) == 1)
      ones++;
    n = n >> 1;
  }
  return ones;
}


x86 assembly (clang, -O0):
<count_ones>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     113e <count_ones+0x3e>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x1,%eax
jne    1130 <count_ones+0x30>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110e <count_ones+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_ones>:
xor    %eax,%eax
test   %edi,%edi
je     1120 <count_ones+0x20>
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
mov    %edi,%edx
and    $0x1,%edx
add    %edx,%eax
sar    %ecx
cmp    $0x1,%edi
mov    %ecx,%edi
ja     1110 <count_ones+0x10>
ret

LLVM IR (-O0):
define i32 @count_ones(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %14, %1
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %17
7: ; preds = %4
%8 = load i32, i32* %2
%9 = and i32 %8, 1
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %14
14: ; preds = %11, %7
%15 = load i32, i32* %2
%16 = ashr i32 %15, 1
store i32 %16, i32* %2
br label %4
17: ; preds = %4
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
define i32 @count_ones(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %8, %3 ], [ %0, %1 ]
%6 = and i32 %5, 1
%7 = add nuw nsw i32 %4, %6
%8 = ashr i32 %5, 1
%9 = icmp ult i32 %5, 2
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned long, unsigned char);
void setreg8(unsigned long int addr, unsigned char value) {
  *((volatile unsigned char *)addr) = value;
  printf("Wrote byte at 0x%08lx = 0x%02x.\n", addr, value);
}


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

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

LLVM IR (-O0):
@.str = [33 x i8] c"Wrote byte at 0x%08lx = 0x%02x.\0A\00"
define void @setreg8(i64 %0, i8 zeroext %1) {
%3 = alloca i64
%4 = alloca i8
store i64 %0, i64* %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = load i64, i64* %3
%7 = inttoptr i64 %6 to i8*
store volatile i8 %5, i8* %7
%8 = load i64, i64* %3
%9 = load i8, i8* %4
%10 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i64 %8, i8 zeroext %9)
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"Wrote byte at 0x%08lx = 0x%02x.\0A\00"
define void @setreg8(i64 %0, i8 zeroext %1) {
%3 = inttoptr i64 %0 to i8*
store volatile i8 %1, i8* %3
%4 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i64 %0, i8 zeroext %1)
ret void
}
void test(struct foo *X) {}


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

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

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

LLVM IR (-O2):
%struct.foo = type opaque
define void @test(%struct.foo* nocapture %0) {
ret void
}
void put32(unsigned char *p, unsigned int val) {
  p[0] = val;
  p[1] = val >> 8;
  p[2] = val >> 16;
  p[3] = val >> 24;
}


x86 assembly (clang, -O0):
<put32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
shr    $0x8,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0xc(%rbp),%eax
shr    $0x10,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0xc(%rbp),%eax
shr    $0x18,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x3(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<put32>:
mov    %esi,(%rdi)
ret

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

LLVM IR (-O2):
define void @put32(i8* nocapture writeonly %0, i32 %1) {
%3 = trunc i32 %1 to i8
store i8 %3, i8* %0
%4 = lshr i32 %1, 8
%5 = trunc i32 %4 to i8
%6 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %5, i8* %6
%7 = lshr i32 %1, 16
%8 = trunc i32 %7 to i8
%9 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %8, i8* %9
%10 = lshr i32 %1, 24
%11 = trunc i32 %10 to i8
%12 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %11, i8* %12
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ mbstate_t;

/* Variables and functions */
size_t mbrtowc(int /*<<< orphan*/ *, char const *, size_t,
               int /*<<< orphan*/ *);
size_t mbrlen(const char *str, size_t count, mbstate_t *state) {
  return mbrtowc(NULL, str, count, state);
}


x86 assembly (clang, -O0):
<mbrlen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%edi
call   1030 <mbrtowc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mbrlen>:
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rdi,%rsi
xor    %edi,%edi
jmp    1030 <mbrtowc@plt>

LLVM IR (-O0):
define i64 @mbrlen(i8* %0, i64 %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32*
store i8* %0, i8** %4
store i64 %1, i64* %5
store i32* %2, i32** %6
%7 = load i8*, i8** %4
%8 = load i64, i64* %5
%9 = load i32*, i32** %6
%10 = call i64 @mbrtowc(i32* null, i8* %7, i64 %8, i32* %9)
ret i64 %10
}

LLVM IR (-O2):
define i64 @mbrlen(i8* %0, i64 %1, i32* %2) {
%4 = tail call i64 @mbrtowc(i32* null, i8* %0, i64 %1, i32* %2)
ret i64 %4
}
/* Variables and functions */
__attribute__((weak)) void rgblight_decrease_speed(void) {}


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

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

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

LLVM IR (-O2):
define weak void @rgblight_decrease_speed() {
ret void
}