xunge/DecIR huggingface dataset:
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ icon_window;
};
typedef TYPE_1__ XWMHints;

/* Variables and functions */
unsigned long get_XWMHints_icon_window(void *_p) {
  return (unsigned long)((XWMHints *)_p)->icon_window;
}


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

x86 assembly (clang, -O2):
<get_XWMHints_icon_window>:
mov    (%rdi),%rax
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i64 @get_XWMHints_icon_window(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
ret i64 %6
}

LLVM IR (-O2):
define i64 @get_XWMHints_icon_window(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
ret i64 %3
}
int fct_with_arguments(int arg1, int arg2, int arg3, int arg4) {}


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

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

LLVM IR (-O0):
define i32 @fct_with_arguments(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%10 = load i32, i32* %5
ret i32 %10
}

LLVM IR (-O2):
define i32 @fct_with_arguments(i32 %0, i32 %1, i32 %2, i32 %3) {
ret i32 undef
}
unsigned ZSTD_versionNumber(void) { return (0 * 100 * 100 + 4 * 100 + 7); }


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

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

LLVM IR (-O0):
define i32 @ZSTD_versionNumber() {
ret i32 407
}

LLVM IR (-O2):
define i32 @ZSTD_versionNumber() {
ret i32 407
}
/* Variables and functions */
int fatorial(int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  printf("Executando Fatorial...\n");
  printf("Fatorial: %d\n", fatorial(64000));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xfa00,%edi
call   1040 <fatorial@plt>
mov    %eax,%esi
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed6(%rip),%rdi
call   1030 <puts@plt>
mov    $0xfa00,%edi
call   1050 <fatorial@plt>
lea    0xeb2(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Executando Fatorial...\0A\00"
@.str.1 = [14 x i8] c"Fatorial: %d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @fatorial(i32 64000)
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [14 x i8] c"Fatorial: %d\0A\00"
@str = [23 x i8] c"Executando Fatorial...\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @fatorial(i32 64000)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %2)
ret i32 0
}
unsigned int BadHash(void *i1) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @BadHash(i8* nocapture readnone %0) {
ret i32 0
}
int link_search(struct STU *head, int num) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.STU = type opaque
define i32 @link_search(%struct.STU* nocapture readnone %0, i32 %1) {
ret i32 0
}
int array2() {
  int a[10][10];
  a[0][0] = 0;
  return a[2][3];
}


x86 assembly (clang, -O0):
<array2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x190(%rbp)
mov    -0x134(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @array2() {
%1 = alloca [10 x [10 x i32]]
%2 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 0
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
store i32 0, i32* %3
%4 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 2
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 3
%6 = load i32, i32* %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @array2() {
ret i32 undef
}
int foo(int x) { return x + 5; }


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

x86 assembly (clang, -O2):
<foo>:
lea    0x5(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = add nsw i32 %0, 5
ret i32 %2
}
void spi_tx(unsigned short adrs, unsigned short data) {
  unsigned short tx_stream;
  while ((*(unsigned int *)0x018c0008 & 0x00020000) == 0)
    ;
  tx_stream = (adrs & 0x0f) << 9;
  tx_stream = tx_stream | (data & 0x01ff);
  *(unsigned short *)0x018c0004 = tx_stream;
}


x86 assembly (clang, -O0):
<spi_tx>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    $0x18c0008,%eax
mov    (%rax),%eax
and    $0x20000,%eax
cmp    $0x0,%eax
jne    112c <spi_tx+0x2c>
jmp    1112 <spi_tx+0x12>
movzwl -0x2(%rbp),%eax
and    $0xf,%eax
shl    $0x9,%eax
mov    %ax,-0x6(%rbp)
movzwl -0x6(%rbp),%eax
movzwl -0x4(%rbp),%ecx
and    $0x1ff,%ecx
or     %ecx,%eax
mov    %ax,-0x6(%rbp)
mov    -0x6(%rbp),%cx
mov    $0x18c0004,%eax
mov    %cx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<spi_tx>:
testb  $0x2,0x18c000a
02
jne    1112 <spi_tx+0x12>
nopw   0x0(%rax,%rax,1)
jmp    1110 <spi_tx+0x10>
and    $0xf,%edi
shl    $0x9,%edi
and    $0x1ff,%esi
or     %edi,%esi
mov    %si,0x18c0004
01
ret

LLVM IR (-O0):
define void @spi_tx(i16 zeroext %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i16
%5 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
br label %6
6: ; preds = %10, %2
%7 = load i32, i32* inttoptr (i64 25952264 to i32*)
%8 = and i32 %7, 131072
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %6
br label %6
11: ; preds = %6
%12 = load i16, i16* %3
%13 = zext i16 %12 to i32
%14 = and i32 %13, 15
%15 = shl i32 %14, 9
%16 = trunc i32 %15 to i16
store i16 %16, i16* %5
%17 = load i16, i16* %5
%18 = zext i16 %17 to i32
%19 = load i16, i16* %4
%20 = zext i16 %19 to i32
%21 = and i32 %20, 511
%22 = or i32 %18, %21
%23 = trunc i32 %22 to i16
store i16 %23, i16* %5
%24 = load i16, i16* %5
store i16 %24, i16* inttoptr (i64 25952260 to i16*)
ret void
}

LLVM IR (-O2):
define void @spi_tx(i16 zeroext %0, i16 zeroext %1) {
%3 = load i32, i32* inttoptr (i64 25952264 to i32*)
%4 = and i32 %3, 131072
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %2, %6
br label %6
7: ; preds = %2
%8 = shl i16 %0, 9
%9 = and i16 %8, 7680
%10 = and i16 %1, 511
%11 = or i16 %9, %10
store i16 %11, i16* inttoptr (i64 25952260 to i16*)
ret void
}
/* Variables and functions */
int strcmp(char *, char *);
int compare_names(const void *a, const void *b) {
  char **list_a = (char **)a;
  char **list_b = (char **)b;
  return strcmp(*list_a, *list_b);
}


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

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

LLVM IR (-O0):
define i32 @compare_names(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8**
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i8**
store i8** %8, i8*** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i8**
store i8** %10, i8*** %6
%11 = load i8**, i8*** %5
%12 = load i8*, i8** %11
%13 = load i8**, i8*** %6
%14 = load i8*, i8** %13
%15 = call i32 @strcmp(i8* %12, i8* %14)
ret i32 %15
}

LLVM IR (-O2):
define i32 @compare_names(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = bitcast i8* %1 to i8**
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %5, i8* dereferenceable(1) %6)
ret i32 %7
}
int do_924() { return 924; }


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

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

LLVM IR (-O0):
define i32 @do_924() {
ret i32 924
}

LLVM IR (-O2):
define i32 @do_924() {
ret i32 924
}
/* Variables and functions */
bool wlc_xwayland_init(void) { return false; }


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

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

LLVM IR (-O0):
define i32 @wlc_xwayland_init() {
ret i32 0
}

LLVM IR (-O2):
define i32 @wlc_xwayland_init() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ print_ft_name(int);
int /*<<< orphan*/ printf(char *);
void print_h2_pair(int i, int j) {
  printf("(");
  print_ft_name(i);
  printf(", ");
  print_ft_name(j);
  printf(")");
}


x86 assembly (clang, -O0):
<print_h2_pair>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <print_ft_name@plt>
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
call   1040 <print_ft_name@plt>
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_h2_pair>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x28,%edi
call   1030 <putchar@plt>
mov    %ebp,%edi
call   1050 <print_ft_name@plt>
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
mov    %ebx,%edi
call   1050 <print_ft_name@plt>
mov    $0x29,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str.1 = [3 x i8] c", \00"
define void @print_h2_pair(i32 %0, i32 %1) {
%3 = tail call i32 @putchar(i32 40)
%4 = tail call i32 @print_ft_name(i32 %0)
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @print_ft_name(i32 %1)
%7 = tail call i32 @putchar(i32 41)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ mainMenu();
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  fprintf(
      stderr,
      "%s: Warning: The C version of UNIX Operator is not ready to be used.\n",
      argv[0]);
  mainMenu();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ea3(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xeb3(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x0,%al
call   1040 <mainMenu@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
call   1040 <mainMenu@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [70 x i8] c"%s: Warning: The C version of UNIX Operator is not ready to be used.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* @stderr
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 0
%9 = load i8*, i8** %8
%10 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = call i32 (...) @mainMenu()
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [70 x i8] c"%s: Warning: The C version of UNIX Operator is not ready to be used.\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %1
%5 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = tail call i32 (...) @mainMenu()
ret i32 0
}
const char *__attribute__((short_call)) __attribute__((no)) strong_s1(void) {
  return "strong_s1";
}


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

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

LLVM IR (-O0):
@.str = [10 x i8] c"strong_s1\00"
define i8* @strong_s1() {
ret i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [10 x i8] c"strong_s1\00"
define i8* @strong_s1() {
ret i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0)
}
double max(double lhs, double rhs) {
  if (lhs > rhs) {
    return lhs;
  } else {
    return rhs;
  }
}


x86 assembly (clang, -O0):
<max>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    112d <max+0x2d>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1137 <max+0x37>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<max>:
maxsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @max(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %4
%7 = load double, double* %5
%8 = fcmp ogt double %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load double, double* %4
store double %10, double* %3
br label %13
11: ; preds = %2
%12 = load double, double* %5
store double %12, double* %3
br label %13
13: ; preds = %11, %9
%14 = load double, double* %3
ret double %14
}

LLVM IR (-O2):
define double @max(double %0, double %1) {
%3 = fcmp ogt double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ _quicksort(int *, int /*<<< orphan*/, int);
void quicksort(int arr[], int n) { _quicksort(arr, 0, n); }


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

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

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

LLVM IR (-O2):
define void @quicksort(i32* %0, i32 %1) {
%3 = tail call i32 @_quicksort(i32* %0, i32 0, i32 %1)
ret void
}
/* Variables and functions */
unsigned int strlen(char const *);
unsigned int wbt_strlen(const char *s) { return strlen(s); }


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

x86 assembly (clang, -O2):
<wbt_strlen>:
jmp    1030 <strlen@plt>

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

LLVM IR (-O2):
define i32 @wbt_strlen(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int sum(int);
int main() {
  int num, result;
  printf("Enter the number: ");
  scanf("%d", &num);
  result = sum(num);
  printf("Sum of digits in %d is %d\n", num, result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1040 <sum@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1040 <sum@plt>
mov    0x4(%rsp),%esi
lea    0xeb2(%rip),%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Enter the number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [27 x i8] c"Sum of digits in %d is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = call i32 @sum(i32 %6)
store i32 %7, i32* %3
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %8, i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Enter the number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [27 x i8] c"Sum of digits in %d is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @sum(i32 %5)
%7 = load i32, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %6)
ret i32 0
}
void EdgeCutter_ValidateParams(struct EdgeCutter_Params *params) {}


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

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

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

LLVM IR (-O2):
%struct.EdgeCutter_Params = type opaque
define void @EdgeCutter_ValidateParams(%struct.EdgeCutter_Params* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bar(int);
void foo(int b) {
  bar(b);
  bar(b);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <bar@plt>
mov    -0x4(%rbp),%edi
call   1030 <bar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbx
mov    %edi,%ebx
call   1030 <bar@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <bar@plt>

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

LLVM IR (-O2):
define void @foo(i32 %0) {
%2 = tail call i32 @bar(i32 %0)
%3 = tail call i32 @bar(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ move(int, int /*<<< orphan*/);
void move_to_flags() { move(6, 0); }


x86 assembly (clang, -O0):
<move_to_flags>:
push   %rbp
mov    %rsp,%rbp
mov    $0x6,%edi
xor    %esi,%esi
call   1030 <move@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<move_to_flags>:
mov    $0x6,%edi
xor    %esi,%esi
jmp    1030 <move@plt>

LLVM IR (-O0):
define void @move_to_flags() {
%1 = call i32 @move(i32 6, i32 0)
ret void
}

LLVM IR (-O2):
define void @move_to_flags() {
%1 = tail call i32 @move(i32 6, i32 0)
ret void
}
/* Type definitions */
typedef int uint16_t;
typedef int int32_t;

/* Variables and functions */
uint16_t rotateL_fun_uint16_t(uint16_t x, int32_t i) {
  if ((i %= 16) == 0)
    return x;
  return (x << i) | (x >> (16 - i));
}


x86 assembly (clang, -O0):
<rotateL_fun_uint16_t>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
cmp    $0x0,%edx
jne    112c <rotateL_fun_uint16_t+0x2c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1148 <rotateL_fun_uint16_t+0x48>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    %cl,%eax
mov    -0x8(%rbp),%edx
mov    $0x10,%ecx
sub    -0xc(%rbp),%ecx
sar    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotateL_fun_uint16_t>:
lea    0xf(%rsi),%eax
test   %esi,%esi
cmovns %esi,%eax
and    $0xfffffff0,%eax
sub    %eax,%esi
mov    %edi,%edx
mov    %esi,%ecx
shl    %cl,%edx
mov    $0x10,%cl
sub    %sil,%cl
mov    %edi,%eax
sar    %cl,%eax
or     %edx,%eax
test   %esi,%esi
cmove  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @rotateL_fun_uint16_t(i32 %0, i32 %1) {
%3 = srem i32 %1, 16
%4 = icmp eq i32 %3, 0
%5 = shl i32 %0, %3
%6 = sub nsw i32 16, %3
%7 = ashr i32 %0, %6
%8 = or i32 %7, %5
%9 = select i1 %4, i32 %0, i32 %8
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[], char *envp[]) {
  printf("This is exec1;argc = %d\n", argc);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%esi
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [25 x i8] c"This is exec1;argc = %d\0A\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%8 = load i32, i32* %5
%9 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"This is exec1;argc = %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ EIO;
int /*<<< orphan*/ errno;
int _open(const char *buf, int flags, int mode) {
  errno = EIO;
  return (-1);
}


x86 assembly (clang, -O0):
<_open>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    0x2ecb(%rip),%rax
mov    (%rax),%ecx
mov    0x2eba(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_open>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@EIO = global i32 0
@errno = global i32 0
define i32 @_open(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* @EIO
store i32 %7, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@EIO = global i32 0
@errno = global i32 0
define i32 @_open(i8* nocapture readnone %0, i32 %1, i32 %2) {
%4 = load i32, i32* @EIO
store i32 %4, i32* @errno
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ LedsP__Leds__led0On();
void PancApp__Leds__led0On(void) { LedsP__Leds__led0On(); }


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

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

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

LLVM IR (-O2):
define void @PancApp__Leds__led0On() {
%1 = tail call i32 (...) @LedsP__Leds__led0On()
ret void
}
/* Type definitions */
struct sockaddr_storage {
  int dummy;
};

/* Variables and functions */
scalar_t__ sockaddr_storage_cmp(struct sockaddr_storage const *,
                                struct sockaddr_storage const *);
int sockaddr_storage_equal(const struct sockaddr_storage *a,
                           const struct sockaddr_storage *b) {
  return sockaddr_storage_cmp(a, b) == 0;
}


x86 assembly (clang, -O0):
<sockaddr_storage_equal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <sockaddr_storage_cmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.sockaddr_storage = type { i32 }
define i32 @sockaddr_storage_equal(%struct.sockaddr_storage* %0, %struct.sockaddr_storage* %1) {
%3 = alloca %struct.sockaddr_storage*
%4 = alloca %struct.sockaddr_storage*
store %struct.sockaddr_storage* %0, %struct.sockaddr_storage** %3
store %struct.sockaddr_storage* %1, %struct.sockaddr_storage** %4
%5 = load %struct.sockaddr_storage*, %struct.sockaddr_storage** %3
%6 = load %struct.sockaddr_storage*, %struct.sockaddr_storage** %4
%7 = call i64 @sockaddr_storage_cmp(%struct.sockaddr_storage* %5, %struct.sockaddr_storage* %6)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
%struct.sockaddr_storage = type { i32 }
define i32 @sockaddr_storage_equal(%struct.sockaddr_storage* %0, %struct.sockaddr_storage* %1) {
%3 = tail call i64 @sockaddr_storage_cmp(%struct.sockaddr_storage* %0, %struct.sockaddr_storage* %1)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
double dist_from_pole_squared(double x, double y) { return x * x + y * y; }


x86 assembly (clang, -O0):
<dist_from_pole_squared>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dist_from_pole_squared>:
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @dist_from_pole_squared(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %3
%7 = load double, double* %4
%8 = load double, double* %4
%9 = fmul double %7, %8
%10 = call double @llvm.fmuladd.f64(double %5, double %6, double %9)
ret double %10
}

LLVM IR (-O2):
define double @dist_from_pole_squared(double %0, double %1) {
%3 = fmul double %1, %1
%4 = tail call double @llvm.fmuladd.f64(double %0, double %0, double %3)
ret double %4
}
/* Variables and functions */
size_t lookup_auto_expand_capacity(void *context, size_t capacity) {
  return (3 * ((capacity) >> 1));
}


x86 assembly (clang, -O0):
<lookup_auto_expand_capacity>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x1,%rax
imul   $0x3,%rax,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lookup_auto_expand_capacity>:
shr    %rsi
lea    (%rsi,%rsi,2),%rax
ret

LLVM IR (-O0):
define i64 @lookup_auto_expand_capacity(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = lshr i64 %5, 1
%7 = mul i64 3, %6
ret i64 %7
}

LLVM IR (-O2):
define i64 @lookup_auto_expand_capacity(i8* nocapture readnone %0, i64 %1) {
%3 = lshr i64 %1, 1
%4 = mul i64 %3, 3
ret i64 %4
}
int Max(int A, int B) { return A > B ? A : B; }


x86 assembly (clang, -O0):
<Max>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1121 <Max+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <Max+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Max>:
mov    %esi,%eax
cmp    %esi,%edi
cmovg  %edi,%eax
ret

LLVM IR (-O0):
define i32 @Max(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp sgt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %3
br label %12
10: ; preds = %2
%11 = load i32, i32* %4
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @Max(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
char *strcat(char *dest, const char *src) {
  while (*dest++)
    ;
  for (dest--; *src; *dest++ = *src++)
    ;
  *dest = 0;
  return dest;
}


x86 assembly (clang, -O0):
<strcat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmpb   $0x0,(%rax)
je     1129 <strcat+0x29>
jmp    110c <strcat+0xc>
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     116e <strcat+0x6e>
jmp    1147 <strcat+0x47>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    1135 <strcat+0x35>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcat>:
mov    %rdi,%rax
add    $0x1,%rdi
cmpb   $0x0,(%rax)
jne    1100 <strcat>
mov    (%rsi),%cl
test   %cl,%cl
je     1136 <strcat+0x36>
mov    $0xffffffffffffffff,%rax
nopl   0x0(%rax)
mov    %cl,(%rdi,%rax,1)
movzbl 0x2(%rsi,%rax,1),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1120 <strcat+0x20>
add    %rax,%rdi
mov    %rdi,%rax
movb   $0x0,(%rax)
ret

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

LLVM IR (-O2):
define i8* @strcat(i8* %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %5, %3 ]
%5 = getelementptr inbounds i8, i8* %4, i64 1
%6 = load i8, i8* %4
%7 = icmp eq i8 %6, 0
br i1 %7, label %8, label %3
8: ; preds = %3
%9 = load i8, i8* %1
%10 = icmp eq i8 %9, 0
br i1 %10, label %19, label %11
11: ; preds = %8, %11
%12 = phi i8 [ %17, %11 ], [ %9, %8 ]
%13 = phi i8* [ %15, %11 ], [ %1, %8 ]
%14 = phi i8* [ %16, %11 ], [ %4, %8 ]
%15 = getelementptr inbounds i8, i8* %13, i64 1
%16 = getelementptr inbounds i8, i8* %14, i64 1
store i8 %12, i8* %14
%17 = load i8, i8* %15
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %11
19: ; preds = %11, %8
%20 = phi i8* [ %4, %8 ], [ %16, %11 ]
store i8 0, i8* %20
ret i8* %20
}
long f4(long a) { return a & ~0x000000ffL; }


x86 assembly (clang, -O0):
<f4>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0xffffffffffffff00,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f4>:
mov    %rdi,%rax
and    $0xffffffffffffff00,%rax
ret

LLVM IR (-O0):
define i64 @f4(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, -256
ret i64 %4
}

LLVM IR (-O2):
define i64 @f4(i64 %0) {
%2 = and i64 %0, -256
ret i64 %2
}
/* Variables and functions */
int nondet(int /*<<< orphan*/, int);
int main() {
  int i = nondet(0, 5);
  int j = 0;
  if (i > 1) {
    j = 1;
  } else {
    j = -1;
  }
  return j;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
mov    $0x5,%esi
call   1030 <nondet@plt>
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    114b <main+0x3b>
movl   $0x1,-0xc(%rbp)
jmp    1152 <main+0x42>
movl   $0xffffffff,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
mov    $0x5,%esi
call   1030 <nondet@plt>
xor    %ecx,%ecx
cmp    $0x2,%eax
setge  %cl
lea    (%rcx,%rcx,1),%eax
add    $0xffffffff,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @nondet(i32 0, i32 5)
%2 = icmp sgt i32 %1, 1
%3 = select i1 %2, i32 1, i32 -1
ret i32 %3
}
/* Variables and functions */
int random();
int about(int value) {
  value += random() % (value / 8);
  return value;
}


x86 assembly (clang, -O0):
<about>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <random@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
cltd
idiv   %ecx
add    -0x4(%rbp),%edx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<about>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <random@plt>
lea    0x7(%rbx),%ecx
test   %ebx,%ebx
cmovns %ebx,%ecx
sar    $0x3,%ecx
cltd
idiv   %ecx
add    %edx,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @about(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @random()
%4 = load i32, i32* %2
%5 = sdiv i32 %4, 8
%6 = srem i32 %3, %5
%7 = load i32, i32* %2
%8 = add nsw i32 %7, %6
store i32 %8, i32* %2
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @about(i32 %0) {
%2 = tail call i32 (...) @random()
%3 = sdiv i32 %0, 8
%4 = srem i32 %2, %3
%5 = add nsw i32 %4, %0
ret i32 %5
}
/* Variables and functions */
int EINVAL;
__attribute__((visibility("default"))) int
sd_resolve_attach_event(void *resolve, void *event, int priority) {
  return -EINVAL;
}


x86 assembly (clang, -O0):
<sd_resolve_attach_event>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xor    %eax,%eax
mov    0x2ec8(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sd_resolve_attach_event>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @sd_resolve_attach_event(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* @EINVAL
%8 = sub nsw i32 0, %7
ret i32 %8
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @sd_resolve_attach_event(i8* nocapture readnone %0, i8* nocapture readnone %1, i32 %2) {
%4 = load i32, i32* @EINVAL
%5 = sub nsw i32 0, %4
ret i32 %5
}
/* Type definitions */
struct stat {
  unsigned int st_mode;
};

/* Variables and functions */
scalar_t__ S_IFDIR;
scalar_t__ stat(char *, struct stat *);
int isfile(char *name) {
  struct stat stat_buff;
  if (stat(name, &stat_buff) != 0)
    return 0;
  if ((stat_buff.st_mode & (unsigned)S_IFDIR) == 0)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<isfile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
je     113f <isfile+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    116a <isfile+0x5a>
mov    -0x18(%rbp),%eax
mov    0x2e8f(%rip),%rcx
mov    (%rcx),%rcx
and    %ecx,%eax
cmp    $0x0,%eax
jne    1163 <isfile+0x53>
movl   $0x1,-0x4(%rbp)
jmp    116a <isfile+0x5a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isfile>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     1125 <isfile+0x15>
pop    %rcx
ret
mov    (%rsp),%ecx
mov    0x2ea9(%rip),%rdx
xor    %eax,%eax
test   %ecx,(%rdx)
sete   %al
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.stat = type { i32 }
@S_IFDIR = global i64 0
define i32 @isfile(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %14
6: ; preds = %1
%7 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = load i64, i64* @S_IFDIR
%10 = trunc i64 %9 to i32
%11 = and i32 %8, %10
%12 = icmp eq i32 %11, 0
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %6, %1
%15 = phi i32 [ 0, %1 ], [ %13, %6 ]
ret i32 %15
}
/* Variables and functions */
int bar(short, unsigned int, int, int);
int foo(short a, unsigned int b, char *unused_str) {
  int c = bar(a, b, -2 * a, -2 * b);
  return c;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x2(%rbp),%ax
mov    -0x8(%rbp),%esi
movswl -0x2(%rbp),%ecx
imul   $0xfffffffe,%ecx,%edx
imul   $0xfffffffe,-0x8(%rbp),%ecx
movswl %ax,%edi
call   1030 <bar@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
lea    (%rdi,%rdi,1),%edx
neg    %edx
lea    (%rsi,%rsi,1),%ecx
neg    %ecx
jmp    1030 <bar@plt>

LLVM IR (-O0):
define i32 @foo(i16 signext %0, i32 %1, i8* %2) {
%4 = alloca i16
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
store i16 %0, i16* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%8 = load i16, i16* %4
%9 = load i32, i32* %5
%10 = load i16, i16* %4
%11 = sext i16 %10 to i32
%12 = mul nsw i32 -2, %11
%13 = load i32, i32* %5
%14 = mul i32 -2, %13
%15 = call i32 @bar(i16 signext %8, i32 %9, i32 %12, i32 %14)
store i32 %15, i32* %7
%16 = load i32, i32* %7
ret i32 %16
}

LLVM IR (-O2):
define i32 @foo(i16 signext %0, i32 %1, i8* nocapture readnone %2) {
%4 = sext i16 %0 to i32
%5 = mul nsw i32 %4, -2
%6 = mul i32 %1, -2
%7 = tail call i32 @bar(i16 signext %0, i32 %1, i32 %5, i32 %6)
ret i32 %7
}
/* Type definitions */
struct kvm_xsave {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%d", (int)sizeof(struct kvm_xsave));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 4)
ret i32 0
}
/* Type definitions */
struct coprthr_device {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ _printcl(char *, int, char *, char *);
void *release_gl_objects(struct coprthr_device *dev, void *argp) {
  do {
    if ("<4>"
        "cmdcall_x86_64:acquire_gl_objects: unsupported"[1] <= '0')
      _printcl("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/browndeer/coprthr/refs/heads/"
               "parallellocalypse/src/libcoprthr/arch/x86_64/devcmds_x86_64.c",
               509, "clmesg",
               "<4>"
               "cmdcall_x86_64:acquire_gl_objects: unsupported");
  } while (0);
  return (0);
}


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

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

LLVM IR (-O0):
%struct.coprthr_device = type { i32 }
define i8* @release_gl_objects(%struct.coprthr_device* %0, i8* %1) {
%3 = alloca %struct.coprthr_device*
%4 = alloca i8*
store %struct.coprthr_device* %0, %struct.coprthr_device** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %2
br label %6
6: ; preds = %5
ret i8* null
}

LLVM IR (-O2):
%struct.coprthr_device = type { i32 }
define noalias i8* @release_gl_objects(%struct.coprthr_device* nocapture readnone %0, i8* nocapture readnone %1) {
ret i8* null
}
int jsk_sendmsg(int s, const struct msghdr *msghdr, int flags) { return 0; }


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

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

LLVM IR (-O0):
%struct.msghdr = type opaque
define i32 @jsk_sendmsg(i32 %0, %struct.msghdr* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.msghdr*
%6 = alloca i32
store i32 %0, i32* %4
store %struct.msghdr* %1, %struct.msghdr** %5
store i32 %2, i32* %6
ret i32 0
}

LLVM IR (-O2):
%struct.msghdr = type opaque
define i32 @jsk_sendmsg(i32 %0, %struct.msghdr* nocapture readnone %1, i32 %2) {
ret i32 0
}
int g_rm_temp_dir(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @g_rm_temp_dir() {
ret i32 0
}

LLVM IR (-O2):
define i32 @g_rm_temp_dir() {
ret i32 0
}
/* Variables and functions */
int errno;
int fdatasync(int);
int fsync(int);
int fsync_file(int fd, int datasync) {
  int ret;
  if (datasync)
    ret = fdatasync(fd);
  else
    ret = fsync(fd);
  if (ret < 0)
    return -errno;
  return 0;
}


x86 assembly (clang, -O0):
<fsync_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1148 <fsync_file+0x28>
mov    -0x8(%rbp),%edi
call   1030 <fdatasync@plt>
mov    %eax,-0x10(%rbp)
jmp    1153 <fsync_file+0x33>
mov    -0x8(%rbp),%edi
call   1040 <fsync@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jge    1170 <fsync_file+0x50>
xor    %eax,%eax
mov    0x2e7a(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1177 <fsync_file+0x57>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fsync_file>:
push   %rax
test   %esi,%esi
je     112c <fsync_file+0xc>
call   1030 <fdatasync@plt>
jmp    1131 <fsync_file+0x11>
call   1040 <fsync@plt>
mov    0x2ea8(%rip),%rcx
xor    %edx,%edx
sub    (%rcx),%edx
sar    $0x1f,%eax
and    %edx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@errno = global i32 0
define i32 @fsync_file(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = load i32, i32* %5
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i32, i32* %4
%11 = call i32 @fdatasync(i32 %10)
store i32 %11, i32* %6
br label %15
12: ; preds = %2
%13 = load i32, i32* %4
%14 = call i32 @fsync(i32 %13)
store i32 %14, i32* %6
br label %15
15: ; preds = %12, %9
%16 = load i32, i32* %6
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i32, i32* @errno
%20 = sub nsw i32 0, %19
store i32 %20, i32* %3
br label %22
21: ; preds = %15
store i32 0, i32* %3
br label %22
22: ; preds = %21, %18
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
@errno = global i32 0
define i32 @fsync_file(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @fdatasync(i32 %0)
br label %8
6: ; preds = %2
%7 = tail call i32 @fsync(i32 %0)
br label %8
8: ; preds = %6, %4
%9 = phi i32 [ %5, %4 ], [ %7, %6 ]
%10 = icmp slt i32 %9, 0
%11 = load i32, i32* @errno
%12 = sub nsw i32 0, %11
%13 = select i1 %10, i32 %12, i32 0
ret i32 %13
}