xunge/DecIR huggingface dataset:
/* Variables and functions */
char *Xmalloc(int);
int /*<<< orphan*/ strncpy(char *, char const *, int);
char *copystring(const char *src, int len) {
  char *dst = Xmalloc(len + 1);
  if (dst) {
    strncpy(dst, src, len);
    dst[len] = '\0';
  }
  return dst;
}


x86 assembly (clang, -O0):
<copystring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
call   1040 <Xmalloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1165 <copystring+0x45>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copystring>:
push   %r15
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%r15
lea    0x1(%r14),%edi
call   1040 <Xmalloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1151 <copystring+0x31>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14d,%edx
call   1030 <strncpy@plt>
movslq %r14d,%rax
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @copystring(i8* %0, i32 %1) {
%3 = add nsw i32 %1, 1
%4 = tail call i8* @Xmalloc(i32 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = tail call i32 @strncpy(i8* %4, i8* %0, i32 %1)
%8 = sext i32 %1 to i64
%9 = getelementptr inbounds i8, i8* %4, i64 %8
store i8 0, i8* %9
br label %10
10: ; preds = %6, %2
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ set_io_bit(int, int);
void TOSH_MAKE_UART_TXD0_OUTPUT() { set_io_bit(0x72, 1); }


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

x86 assembly (clang, -O2):
<TOSH_MAKE_UART_TXD0_OUTPUT>:
mov    $0x72,%edi
mov    $0x1,%esi
jmp    1030 <set_io_bit@plt>

LLVM IR (-O0):
define void @TOSH_MAKE_UART_TXD0_OUTPUT() {
%1 = call i32 @set_io_bit(i32 114, i32 1)
ret void
}

LLVM IR (-O2):
define void @TOSH_MAKE_UART_TXD0_OUTPUT() {
%1 = tail call i32 @set_io_bit(i32 114, i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f1(char **);
int /*<<< orphan*/ printf(char *, char *);
void g(void) {
  char *x;
  char **y;
  f1(&x);
  printf("%s\n", x);
  f1(y);
  printf("%s\n", *y);
}


x86 assembly (clang, -O0):
<g>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
call   1040 <f1@plt>
mov    -0x8(%rbp),%rsi
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <f1@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g>:
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rdi
call   1040 <f1@plt>
mov    0x8(%rsp),%rsi
lea    0xec5(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
call   1040 <f1@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @g() {
%1 = alloca i8*
%2 = bitcast i8** %1 to i8*
%3 = call i32 @f1(i8** %1)
%4 = load i8*, i8** %1
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @f1(i8** undef)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* undef)
ret void
}
/* Type definitions */
typedef int uint64_t;
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
uint64_t VbExGetTimer(void) {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  return (uint64_t)tv.tv_sec * 1000000 + (uint64_t)tv.tv_usec;
}


x86 assembly (clang, -O0):
<VbExGetTimer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    -0x8(%rbp),%rax
imul   $0xf4240,%eax,%eax
mov    -0x10(%rbp),%rcx
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<VbExGetTimer>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
imul   $0xf4240,0x10(%rsp),%eax
add    0x8(%rsp),%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define i32 @VbExGetTimer() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%4 = load i64, i64* %3
%5 = trunc i64 %4 to i32
%6 = mul nsw i32 %5, 1000000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%8 = load i64, i64* %7
%9 = trunc i64 %8 to i32
%10 = add nsw i32 %6, %9
ret i32 %10
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define i32 @VbExGetTimer() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = mul nsw i32 %6, 1000000
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%9 = load i64, i64* %8
%10 = trunc i64 %9 to i32
%11 = add nsw i32 %7, %10
ret i32 %11
}
void drive(int forwardPower, int turnPower, int strafePower) {}


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

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

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

LLVM IR (-O2):
define void @drive(i32 %0, i32 %1, i32 %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Move(int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *);
void Erase_Prompt() {
  Move(0, 14);
  printf("           ");
  Move(0, 14);
}


x86 assembly (clang, -O0):
<Erase_Prompt>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
mov    $0xe,%esi
call   1030 <Move@plt>
lea    0xec9(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
mov    $0xe,%esi
call   1030 <Move@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Erase_Prompt>:
push   %rax
xor    %edi,%edi
mov    $0xe,%esi
call   1030 <Move@plt>
lea    0xecc(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
mov    $0xe,%esi
pop    %rax
jmp    1030 <Move@plt>

LLVM IR (-O0):
@.str = [12 x i8] c" \00"
define void @Erase_Prompt() {
%1 = call i32 @Move(i32 0, i32 14)
%2 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @Move(i32 0, i32 14)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c" \00"
define void @Erase_Prompt() {
%1 = tail call i32 @Move(i32 0, i32 14)
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @Move(i32 0, i32 14)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
int unlink(char *);
int libamg_process_clear_flag(char *flagname) {
  char filename[256];
  sprintf(filename, "%s%s", "/var/run/flags/", flagname);
  return unlink(filename);
}


x86 assembly (clang, -O0):
<libamg_process_clear_flag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rcx
lea    0xebf(%rip),%rsi
lea    0xebd(%rip),%rdx
call   1040 <sprintf@plt>
lea    -0x110(%rbp),%rdi
call   1030 <unlink@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<libamg_process_clear_flag>:
push   %rbx
sub    $0x100,%rsp
mov    %rdi,%rcx
lea    0xece(%rip),%rsi
lea    0xecc(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <unlink@plt>
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%s%s\00"
@.str.1 = [16 x i8] c"/var/run/flags/\00"
define i32 @libamg_process_clear_flag(i8* %0) {
%2 = alloca i8*
%3 = alloca [256 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %2
%6 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%8 = call i32 @unlink(i8* %7)
ret i32 %8
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s%s\00"
@.str.1 = [16 x i8] c"/var/run/flags/\00"
define i32 @libamg_process_clear_flag(i8* %0) {
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%5 = call i32 @unlink(i8* %3)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ func(int, int);
int main() {
  int x = 7;
  func(!x, !7);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x7,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
xor    %esi,%esi
call   1030 <func@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
xor    %esi,%esi
call   1030 <func@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 7, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
%5 = xor i1 %4, true
%6 = zext i1 %5 to i32
%7 = call i32 @func(i32 %6, i32 0)
%8 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @func(i32 0, i32 0)
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ memcpy(char *, char const *, int);
scalar_t__ strlen(char const *);
char *inistrdup(const char *s) {
  int l;
  char *dup;
  l = (int)strlen(s) + 1;
  dup = malloc(l);
  if (dup == NULL) {
    return NULL;
  }
  memcpy(dup, s, l);
  return dup;
}


x86 assembly (clang, -O0):
<inistrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    116f <inistrdup+0x3f>
movq   $0x0,-0x8(%rbp)
jmp    1187 <inistrdup+0x57>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <memcpy@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inistrdup>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %rax,%rbx
add    $0x1,%ebx
mov    %ebx,%edi
call   1050 <malloc@plt>
mov    %rax,%r15
test   %rax,%rax
je     115f <inistrdup+0x2f>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1040 <memcpy@plt>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @inistrdup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = trunc i64 %2 to i32
%4 = add nsw i32 %3, 1
%5 = tail call i8* @malloc(i32 %4)
%6 = icmp eq i8* %5, null
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = tail call i32 @memcpy(i8* %5, i8* %0, i32 %4)
br label %9
9: ; preds = %1, %7
ret i8* %5
}
void RTLinuxSysFsReadStrFile(void) {}


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

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

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

LLVM IR (-O2):
define void @RTLinuxSysFsReadStrFile() {
ret void
}
/* Variables and functions */
char const MACHINE_ENDIAN_F();
int /*<<< orphan*/ dtype_normalize(char *, char const *);
int dtype_needswap(const char *dtype) {
  char ndtype[8];
  dtype_normalize(ndtype, dtype);
  return dtype[0] != MACHINE_ENDIAN_F();
}


x86 assembly (clang, -O0):
<dtype_needswap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <dtype_normalize@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1040 <MACHINE_ENDIAN_F@plt>
mov    %al,%cl
mov    -0x14(%rbp),%eax
movsbl %cl,%ecx
cmp    %ecx,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dtype_needswap>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0x8(%rsp),%rdi
mov    %rbx,%rsi
call   1030 <dtype_normalize@plt>
mov    (%rbx),%bl
xor    %eax,%eax
call   1040 <MACHINE_ENDIAN_F@plt>
xor    %ecx,%ecx
cmp    %al,%bl
setne  %cl
mov    %ecx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @dtype_needswap(i8* %0) {
%2 = alloca i8*
%3 = alloca [8 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %2
%6 = call i32 @dtype_normalize(i8* %4, i8* %5)
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 0
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = call signext i8 (...) @MACHINE_ENDIAN_F()
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %10, %12
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @dtype_needswap(i8* %0) {
%2 = alloca [8 x i8]
%3 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%4 = call i32 @dtype_normalize(i8* %3, i8* %0)
%5 = load i8, i8* %0
%6 = call signext i8 (...) @MACHINE_ENDIAN_F()
%7 = icmp ne i8 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t vga_char(char c, uint8_t color) {
  return (uint16_t)c | (uint16_t)color << 8;
}


x86 assembly (clang, -O0):
<vga_char>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movsbl -0x1(%rbp),%eax
mov    -0x10(%rbp),%rcx
shl    $0x8,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<vga_char>:
mov    %rsi,%rax
shl    $0x8,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @vga_char(i8 signext %0, i64 %1) {
%3 = alloca i8
%4 = alloca i64
store i8 %0, i8* %3
store i64 %1, i64* %4
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = load i64, i64* %4
%8 = trunc i64 %7 to i32
%9 = shl i32 %8, 8
%10 = or i32 %6, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @vga_char(i8 signext %0, i64 %1) {
%3 = sext i8 %0 to i32
%4 = trunc i64 %1 to i32
%5 = shl i32 %4, 8
%6 = or i32 %5, %3
ret i32 %6
}
int send_packet(int sockd, void *packet) {}


x86 assembly (clang, -O0):
<send_packet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @send_packet(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @send_packet(i32 %0, i8* nocapture readnone %1) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ ol(char *);
ule() {
  ol("CMP  BX,AX");
  ol("MOV  AX,1");
  ol("JBE  $+5");
  ol("MOV  AX,0");
}


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

x86 assembly (clang, -O2):
<ule>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <ol@plt>
lea    0xee7(%rip),%rdi
call   1030 <ol@plt>
lea    0xee5(%rip),%rdi
call   1030 <ol@plt>
lea    0xee2(%rip),%rdi
pop    %rax
jmp    1030 <ol@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"CMP BX,AX\00"
@.str.1 = [10 x i8] c"MOV AX,1\00"
@.str.2 = [9 x i8] c"JBE $+5\00"
@.str.3 = [10 x i8] c"MOV AX,0\00"
define i32 @ule() {
%1 = alloca i32
%2 = call i32 @ol(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @ol(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @ol(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @ol(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%6 = load i32, i32* %1
ret i32 %6
}

LLVM IR (-O2):
@.str = [11 x i8] c"CMP BX,AX\00"
@.str.1 = [10 x i8] c"MOV AX,1\00"
@.str.2 = [9 x i8] c"JBE $+5\00"
@.str.3 = [10 x i8] c"MOV AX,0\00"
define i32 @ule() {
%1 = tail call i32 @ol(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @ol(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @ol(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @ol(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ bytesToInt(char *);
float intToFloat(int /*<<< orphan*/);
float bytesToFloat(char *buf) { return intToFloat(bytesToInt(buf)); }


x86 assembly (clang, -O0):
<bytesToFloat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <bytesToInt@plt>
mov    %eax,%edi
call   1040 <intToFloat@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bytesToFloat>:
push   %rax
call   1030 <bytesToInt@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <intToFloat@plt>

LLVM IR (-O0):
define float @bytesToFloat(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @bytesToInt(i8* %3)
%5 = call float @intToFloat(i32 %4)
ret float %5
}

LLVM IR (-O2):
define float @bytesToFloat(i8* %0) {
%2 = tail call i32 @bytesToInt(i8* %0)
%3 = tail call float @intToFloat(i32 %2)
ret float %3
}
/* Variables and functions */
int unlinkat_recursive(int, char const *);
int unlink_recursive(const char *path) {
  return unlinkat_recursive(-100, path);
}


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

x86 assembly (clang, -O2):
<unlink_recursive>:
mov    %rdi,%rsi
mov    $0xffffff9c,%edi
jmp    1030 <unlinkat_recursive@plt>

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

LLVM IR (-O2):
define i32 @unlink_recursive(i8* %0) {
%2 = tail call i32 @unlinkat_recursive(i32 -100, i8* %0)
ret i32 %2
}
void foo690() {}


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

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

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

LLVM IR (-O2):
define void @foo690() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ mcharout(char);
int /*<<< orphan*/ testrxc(int);
void xmchout(char c) {
  testrxc(200);
  mcharout(c);
}


x86 assembly (clang, -O0):
<xmchout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0xc8,%edi
call   1040 <testrxc@plt>
movsbl -0x1(%rbp),%edi
call   1030 <mcharout@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmchout>:
push   %rbx
mov    %edi,%ebx
mov    $0xc8,%edi
call   1040 <testrxc@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <mcharout@plt>

LLVM IR (-O0):
define void @xmchout(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @testrxc(i32 200)
%4 = load i8, i8* %2
%5 = call i32 @mcharout(i8 signext %4)
ret void
}

LLVM IR (-O2):
define void @xmchout(i8 signext %0) {
%2 = tail call i32 @testrxc(i32 200)
%3 = tail call i32 @mcharout(i8 signext %0)
ret void
}
/* Variables and functions */
int rom_present(char *);
int gd5429_available(void) {
  return rom_present(L"roms/video/cirruslogic/5429.vbi");
}


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

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

LLVM IR (-O0):
@.str = [32 x i32] [i32 114, i32 111, i32 109, i32 115, i32 47, i32 118, i32 105, i32 100, i32 101, i32 111, i32 47, i32 99, i32 105, i32 114, i32 114, i32 117, i32 115, i32 108, i32 111, i32 103, i32 105, i32 99, i32 47, i32 53, i32 52, i32 50, i32 57, i32 46, i32 118, i32 98, i32 105, i32 0]
define i32 @gd5429_available() {
%1 = call i32 @rom_present(i8* bitcast ([32 x i32]* @.str to i8*))
ret i32 %1
}

LLVM IR (-O2):
@.str = [32 x i32] [i32 114, i32 111, i32 109, i32 115, i32 47, i32 118, i32 105, i32 100, i32 101, i32 111, i32 47, i32 99, i32 105, i32 114, i32 114, i32 117, i32 115, i32 108, i32 111, i32 103, i32 105, i32 99, i32 47, i32 53, i32 52, i32 50, i32 57, i32 46, i32 118, i32 98, i32 105, i32 0]
define i32 @gd5429_available() {
%1 = tail call i32 @rom_present(i8* bitcast ([32 x i32]* @.str to i8*))
ret i32 %1
}
/* Variables and functions */
scalar_t__ floor(double);
int round(double x) { return (int)floor(x + 0.5); }


x86 assembly (clang, -O0):
<round>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xedb(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
call   1030 <floor@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<round>:
addsd  0xee8(%rip),%xmm0
jmp    1030 <floor@plt>

LLVM IR (-O0):
define i32 @round(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fadd double %3, 5.000000e-01
%5 = call i64 @floor(double %4)
%6 = trunc i64 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @round(double %0) {
%2 = fadd double %0, 5.000000e-01
%3 = tail call i64 @floor(double %2)
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int /*<<< orphan*/);
int /*<<< orphan*/ _SSIBaseValid(int);
void SSIDataGet(uint32_t ui32Base, uint32_t *pui32Data) {
  ASSERT(_SSIBaseValid(ui32Base));
  while (!((*((volatile uint32_t *)(ui32Base + 0x0000000C))) & 0x00000004)) {
  }
  *pui32Data = (*((volatile uint32_t *)(ui32Base + 0x00000008)));
}


x86 assembly (clang, -O0):
<SSIDataGet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <_SSIBaseValid@plt>
mov    %eax,%edi
call   1040 <ASSERT@plt>
mov    -0x4(%rbp),%eax
add    $0xc,%eax
cltq
mov    (%rax),%eax
and    $0x4,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1160 <SSIDataGet+0x40>
jmp    1165 <SSIDataGet+0x45>
jmp    113e <SSIDataGet+0x1e>
mov    -0x4(%rbp),%eax
add    $0x8,%eax
cltq
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SSIDataGet>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
call   1030 <_SSIBaseValid@plt>
mov    %eax,%edi
call   1040 <ASSERT@plt>
movslq %ebp,%rax
nopw   0x0(%rax,%rax,1)
testl  $0x4,0xc(%rax)
je     1140 <SSIDataGet+0x20>
mov    0x8(%rax),%eax
mov    %eax,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @SSIDataGet(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 @_SSIBaseValid(i32 %5)
%7 = call i32 @ASSERT(i32 %6)
br label %8
8: ; preds = %17, %2
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 12
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i32*
%13 = load volatile i32, i32* %12
%14 = and i32 %13, 4
%15 = icmp ne i32 %14, 0
%16 = xor i1 %15, true
br i1 %16, label %17, label %18
17: ; preds = %8
br label %8
18: ; preds = %8
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 8
%21 = sext i32 %20 to i64
%22 = inttoptr i64 %21 to i32*
%23 = load volatile i32, i32* %22
%24 = load i32*, i32** %4
store i32 %23, i32* %24
ret void
}

LLVM IR (-O2):
define void @SSIDataGet(i32 %0, i32* nocapture writeonly %1) {
%3 = tail call i32 @_SSIBaseValid(i32 %0)
%4 = tail call i32 @ASSERT(i32 %3)
%5 = add nsw i32 %0, 12
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
br label %8
8: ; preds = %8, %2
%9 = load volatile i32, i32* %7
%10 = and i32 %9, 4
%11 = icmp eq i32 %10, 0
br i1 %11, label %8, label %12
12: ; preds = %8
%13 = add nsw i32 %0, 8
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i32*
%16 = load volatile i32, i32* %15
store i32 %16, i32* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ glutPostRedisplay();
void animateLeftLeg(void) { glutPostRedisplay(); }


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

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

LLVM IR (-O0):
define void @animateLeftLeg() {
%1 = call i32 (...) @glutPostRedisplay()
ret void
}

LLVM IR (-O2):
define void @animateLeftLeg() {
%1 = tail call i32 (...) @glutPostRedisplay()
ret void
}
int of_gpio_get_count(struct device *dev, const char *con_id) { return 0; }


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

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

LLVM IR (-O0):
%struct.device = type opaque
define i32 @of_gpio_get_count(%struct.device* %0, i8* %1) {
%3 = alloca %struct.device*
%4 = alloca i8*
store %struct.device* %0, %struct.device** %3
store i8* %1, i8** %4
ret i32 0
}

LLVM IR (-O2):
%struct.device = type opaque
define i32 @of_gpio_get_count(%struct.device* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ cc32xx_binary_file_store(char *, char const *, size_t);
void ext_status_store(const char *buffer, size_t buffer_size) {
  cc32xx_binary_file_store("kaa_status.bin", buffer, buffer_size);
}


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

x86 assembly (clang, -O2):
<ext_status_store>:
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xee3(%rip),%rdi
jmp    1030 <cc32xx_binary_file_store@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"kaa_status.bin\00"
define void @ext_status_store(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i32 @cc32xx_binary_file_store(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %5, i64 %6)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"kaa_status.bin\00"
define void @ext_status_store(i8* %0, i64 %1) {
%3 = tail call i32 @cc32xx_binary_file_store(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %0, i64 %1)
ret void
}
/* Variables and functions */
int __ESBMC_isinf(double);
int isinf(double d) { return __ESBMC_isinf(d); }


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

x86 assembly (clang, -O2):
<isinf>:
jmp    1030 <__ESBMC_isinf@plt>

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

LLVM IR (-O2):
define i32 @isinf(double %0) {
%2 = tail call i32 @__ESBMC_isinf(double %0)
ret i32 %2
}
int getfile(char c) {
  if (c >= 'a' && c <= 'h') {
    return c - 'a';
  } else if (c >= 'A' && c <= 'H') {
    return c - 'A';
  } else {
    return -1;
  }
}


x86 assembly (clang, -O0):
<getfile>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     1133 <getfile+0x33>
movsbl -0x5(%rbp),%eax
cmp    $0x68,%eax
jg     1133 <getfile+0x33>
movsbl -0x5(%rbp),%eax
sub    $0x61,%eax
mov    %eax,-0x4(%rbp)
jmp    1163 <getfile+0x63>
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     115c <getfile+0x5c>
movsbl -0x5(%rbp),%eax
cmp    $0x48,%eax
jg     115c <getfile+0x5c>
movsbl -0x5(%rbp),%eax
sub    $0x41,%eax
mov    %eax,-0x4(%rbp)
jmp    1163 <getfile+0x63>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getfile>:
mov    %edi,%eax
lea    -0x61(%rax),%ecx
cmp    $0x7,%cl
ja     110e <getfile+0xe>
add    $0xffffff9f,%eax
ret
lea    -0x41(%rax),%ecx
add    $0xffffffbf,%eax
cmp    $0x8,%cl
mov    $0xffffffff,%ecx
cmovb  %eax,%ecx
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @getfile(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 97
br i1 %6, label %7, label %15
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 104
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = sub nsw i32 %13, 97
store i32 %14, i32* %2
br label %28
15: ; preds = %7, %1
%16 = load i8, i8* %3
%17 = sext i8 %16 to i32
%18 = icmp sge i32 %17, 65
br i1 %18, label %19, label %27
19: ; preds = %15
%20 = load i8, i8* %3
%21 = sext i8 %20 to i32
%22 = icmp sle i32 %21, 72
br i1 %22, label %23, label %27
23: ; preds = %19
%24 = load i8, i8* %3
%25 = sext i8 %24 to i32
%26 = sub nsw i32 %25, 65
store i32 %26, i32* %2
br label %28
27: ; preds = %19, %15
store i32 -1, i32* %2
br label %28
28: ; preds = %27, %23, %11
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
define i32 @getfile(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add i8 %0, -97
%4 = icmp ult i8 %3, 8
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = add nsw i32 %2, -97
br label %12
7: ; preds = %1
%8 = add i8 %0, -65
%9 = icmp ult i8 %8, 8
%10 = add nsw i32 %2, -65
%11 = select i1 %9, i32 %10, i32 -1
br label %12
12: ; preds = %7, %5
%13 = phi i32 [ %6, %5 ], [ %11, %7 ]
ret i32 %13
}
void genddiv() {}


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

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

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

LLVM IR (-O2):
define void @genddiv() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sub(int, int, int, int);
int /*<<< orphan*/ sum(int);
int main() {
  int n;
  int y;
  int z;
  int p;
  sum(n);
  sub(n, z, y, p);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    -0x4(%rbp),%edi
call   1030 <sum@plt>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1040 <sub@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = load i32, i32* %1
%6 = call i32 @sum(i32 %5)
%7 = load i32, i32* %1
%8 = load i32, i32* %3
%9 = load i32, i32* %2
%10 = load i32, i32* %4
%11 = call i32 @sub(i32 %7, i32 %8, i32 %9, i32 %10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @sum(i32 undef)
%2 = tail call i32 @sub(i32 undef, i32 undef, i32 undef, i32 undef)
ret i32 0
}
void endianSwapFloat(float d, char *out) {
  unsigned char *da = (unsigned char *)&d;
  out[0] = da[3];
  out[1] = da[2];
  out[2] = da[1];
  out[3] = da[0];
}


x86 assembly (clang, -O0):
<endianSwapFloat>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    0x3(%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
mov    0x2(%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x18(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x3(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<endianSwapFloat>:
movd   %xmm0,%eax
bswap  %eax
mov    %eax,(%rdi)
ret

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

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

/* Variables and functions */
const wchar_t *_WLocale_false(struct _Locale_numeric *lnum, wchar_t *buf,
                              size_t bufSize) {
  return L"false";
}


x86 assembly (clang, -O0):
<_WLocale_false>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xee9(%rip),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct._Locale_numeric = type { i32 }
@.str = [6 x i32] [i32 102, i32 97, i32 108, i32 115, i32 101, i32 0]
define i8* @_WLocale_false(%struct._Locale_numeric* %0, i8* %1, i64 %2) {
%4 = alloca %struct._Locale_numeric*
%5 = alloca i8*
%6 = alloca i64
store %struct._Locale_numeric* %0, %struct._Locale_numeric** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
ret i8* bitcast ([6 x i32]* @.str to i8*)
}

LLVM IR (-O2):
%struct._Locale_numeric = type { i32 }
@.str = [6 x i32] [i32 102, i32 97, i32 108, i32 115, i32 101, i32 0]
define i8* @_WLocale_false(%struct._Locale_numeric* nocapture readnone %0, i8* nocapture readnone %1, i64 %2) {
ret i8* bitcast ([6 x i32]* @.str to i8*)
}
int cycle_length(unsigned int n) {
  int length = 0;
increment:
  length++;
  if (n == 1) {
    return length;
  }
  if (n % 2 != 0) {
    n = 3 * n + 1;
    length++;
    n = n >> 1;
  } else
    n = n >> 1;
  goto increment;
}


x86 assembly (clang, -O0):
<cycle_length>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1126 <cycle_length+0x26>
mov    -0x8(%rbp),%eax
pop    %rbp
ret
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1156 <cycle_length+0x56>
imul   $0x3,-0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    115f <cycle_length+0x5f>
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110e <cycle_length+0xe>

x86 assembly (clang, -O2):
<cycle_length>:
mov    $0x1,%eax
cmp    $0x1,%edi
je     113d <cycle_length+0x3d>
xor    %ecx,%ecx
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x2,%ecx
test   $0x1,%dil
lea    0x1(%rdi,%rdi,2),%edx
cmove  %edi,%edx
cmove  %eax,%ecx
shr    %edx
lea    0x1(%rcx),%eax
mov    %edx,%edi
cmp    $0x1,%edx
jne    1120 <cycle_length+0x20>
ret

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

LLVM IR (-O2):
define i32 @cycle_length(i32 %0) {
%2 = icmp eq i32 %0, 1
br i1 %2, label %3, label %5
3: ; preds = %5, %1
%4 = phi i32 [ 1, %1 ], [ %17, %5 ]
ret i32 %4
5: ; preds = %1, %5
%6 = phi i32 [ %17, %5 ], [ 1, %1 ]
%7 = phi i32 [ %15, %5 ], [ 0, %1 ]
%8 = phi i32 [ %16, %5 ], [ %0, %1 ]
%9 = and i32 %8, 1
%10 = icmp eq i32 %9, 0
%11 = mul i32 %8, 3
%12 = add i32 %11, 1
%13 = add nsw i32 %7, 2
%14 = select i1 %10, i32 %8, i32 %12
%15 = select i1 %10, i32 %6, i32 %13
%16 = lshr i32 %14, 1
%17 = add nsw i32 %15, 1
%18 = icmp eq i32 %16, 1
br i1 %18, label %3, label %5
}
void gtk_separator_tool_item_get_draw() {}


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

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

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

LLVM IR (-O2):
define void @gtk_separator_tool_item_get_draw() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isspace(int);
void t_isspace_0x02() {
  Assert_real((isspace(2) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isspace.c",
              15, ("isspace should be 0 for 0x02"));
}


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

x86 assembly (clang, -O2):
<t_isspace_0x02>:
push   %rax
mov    $0x2,%edi
call   1030 <isspace@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0xf,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isspace.c\00"
@.str.1 = [29 x i8] c"isspace should be 0 for 0x02\00"
define void @t_isspace_0x02() {
%1 = call i64 @isspace(i32 2)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 15, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isspace.c\00"
@.str.1 = [29 x i8] c"isspace should be 0 for 0x02\00"
define void @t_isspace_0x02() {
%1 = tail call i64 @isspace(i32 2)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 15, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
unsigned char sp_cb_string_is_ground(void *data) { return (!(0)); }


x86 assembly (clang, -O0):
<sp_cb_string_is_ground>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define zeroext i8 @sp_cb_string_is_ground(i8* nocapture readnone %0) {
ret i8 1
}
int set_B_flag(void) { return (1); }


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

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

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

LLVM IR (-O2):
define i32 @set_B_flag() {
ret i32 1
}
/* Type definitions */
struct tm {
  int tm_year;
  int tm_mon;
  int tm_mday;
  int tm_hour;
  int tm_min;
  int tm_sec;
};

/* Variables and functions */
int nodate(struct tm *tm) {
  return (tm->tm_year & tm->tm_mon & tm->tm_mday & tm->tm_hour & tm->tm_min &
          tm->tm_sec) < 0;
}


x86 assembly (clang, -O0):
<nodate>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%rcx
and    0x4(%rcx),%eax
mov    -0x8(%rbp),%rcx
and    0x8(%rcx),%eax
mov    -0x8(%rbp),%rcx
and    0xc(%rcx),%eax
mov    -0x8(%rbp),%rcx
and    0x10(%rcx),%eax
mov    -0x8(%rbp),%rcx
and    0x14(%rcx),%eax
cmp    $0x0,%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nodate>:
movdqu (%rdi),%xmm0
pshufd $0xee,%xmm0,%xmm1
pand   %xmm0,%xmm1
pshufd $0x55,%xmm1,%xmm0
pand   %xmm1,%xmm0
movd   %xmm0,%eax
and    0x10(%rdi),%eax
and    0x14(%rdi),%eax
shr    $0x1f,%eax
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
define i32 @nodate(%struct.tm* %0) {
%2 = alloca %struct.tm*
store %struct.tm* %0, %struct.tm** %2
%3 = load %struct.tm*, %struct.tm** %2
%4 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 0
%5 = load i32, i32* %4
%6 = load %struct.tm*, %struct.tm** %2
%7 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 1
%8 = load i32, i32* %7
%9 = and i32 %5, %8
%10 = load %struct.tm*, %struct.tm** %2
%11 = getelementptr inbounds %struct.tm, %struct.tm* %10, i32 0, i32 2
%12 = load i32, i32* %11
%13 = and i32 %9, %12
%14 = load %struct.tm*, %struct.tm** %2
%15 = getelementptr inbounds %struct.tm, %struct.tm* %14, i32 0, i32 3
%16 = load i32, i32* %15
%17 = and i32 %13, %16
%18 = load %struct.tm*, %struct.tm** %2
%19 = getelementptr inbounds %struct.tm, %struct.tm* %18, i32 0, i32 4
%20 = load i32, i32* %19
%21 = and i32 %17, %20
%22 = load %struct.tm*, %struct.tm** %2
%23 = getelementptr inbounds %struct.tm, %struct.tm* %22, i32 0, i32 5
%24 = load i32, i32* %23
%25 = and i32 %21, %24
%26 = icmp slt i32 %25, 0
%27 = zext i1 %26 to i32
ret i32 %27
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
define i32 @nodate(%struct.tm* nocapture %0) {
%2 = bitcast %struct.tm* %0 to <4 x i32>*
%3 = load <4 x i32>, <4 x i32>* %2
%4 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 4
%5 = load i32, i32* %4
%6 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 5
%7 = load i32, i32* %6
%8 = call i32 @llvm.vector.reduce.and.v4i32(<4 x i32> %3)
%9 = and i32 %8, %5
%10 = and i32 %9, %7
%11 = lshr i32 %10, 31
ret i32 %11
}
/* Variables and functions */
scalar_t__ fcitx_utils_islower(char);
char fcitx_utils_toupper(char c) {
  return fcitx_utils_islower(c) ? c - 'a' + 'A' : c;
}


x86 assembly (clang, -O0):
<fcitx_utils_toupper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <fcitx_utils_islower@plt>
cmp    $0x0,%rax
je     1143 <fcitx_utils_toupper+0x33>
movsbl -0x1(%rbp),%eax
sub    $0x61,%eax
add    $0x41,%eax
mov    %eax,-0x8(%rbp)
jmp    114a <fcitx_utils_toupper+0x3a>
movsbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fcitx_utils_toupper>:
push   %rbx
mov    %edi,%ebx
call   1030 <fcitx_utils_islower@plt>
lea    -0x20(%rbx),%ecx
test   %rax,%rax
movzbl %cl,%eax
cmove  %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @fcitx_utils_toupper(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i64 @fcitx_utils_islower(i8 signext %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = sub nsw i32 %8, 97
%10 = add nsw i32 %9, 65
br label %14
11: ; preds = %1
%12 = load i8, i8* %2
%13 = sext i8 %12 to i32
br label %14
14: ; preds = %11, %6
%15 = phi i32 [ %10, %6 ], [ %13, %11 ]
%16 = trunc i32 %15 to i8
ret i8 %16
}

LLVM IR (-O2):
define signext i8 @fcitx_utils_toupper(i8 signext %0) {
%2 = tail call i64 @fcitx_utils_islower(i8 signext %0)
%3 = icmp eq i64 %2, 0
%4 = add i8 %0, -32
%5 = select i1 %3, i8 %0, i8 %4
ret i8 %5
}