xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ set_globals();
int /*<<< orphan*/ strcpy(char *, char *);
int main() {
  int x, y, z;
  char *m;
  x = 100;
  y = 200;
  z = 300;
  m = malloc(5);
  strcpy(m, "str!");
  set_globals();
  printf("");
  free(m);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x64,-0x4(%rbp)
movl   $0xc8,-0x8(%rbp)
movl   $0x12c,-0xc(%rbp)
mov    $0x5,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe7a(%rip),%rsi
call   1040 <strcpy@plt>
mov    $0x0,%al
call   1070 <set_globals@plt>
lea    0xe6b(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x5,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xeab(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
xor    %eax,%eax
call   1060 <set_globals@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"str!\00"
@.str.1 = [1 x i8] zeroinitializer
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
store i32 100, i32* %1
store i32 200, i32* %2
store i32 300, i32* %3
%5 = call i8* @malloc(i32 5)
store i8* %5, i8** %4
%6 = load i8*, i8** %4
%7 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (...) @set_globals()
%9 = call i32 @printf(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%10 = load i8*, i8** %4
%11 = call i32 @free(i8* %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"str!\00"
define i32 @main() {
%1 = tail call dereferenceable_or_null(5) i8* @malloc(i32 5)
%2 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @set_globals()
%4 = tail call i32 @free(i8* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void input_root() { printf("input_root\n"); }


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

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

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

LLVM IR (-O2):
@str = [11 x i8] c"input_root\00"
define void @input_root() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void mem_err() {
  fprintf(stderr, "No more memory. Aborting.\n");
  exit(1);
}


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

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

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [27 x i8] c"No more memory. Aborting.\0A\00"
define void @mem_err() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
char **check_pptr_VSTREAM_PPNchar(char **v) { return v; }


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

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

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

LLVM IR (-O2):
define i8** @check_pptr_VSTREAM_PPNchar(i8** readnone returned %0) {
ret i8** %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, int, int);
void zraiseIndexOutOfRange(const char *caller, int index, int length) {
  printf("Error: Index out of range in %s(): %d > %d.\n", caller, index,
         length - 1);
}


x86 assembly (clang, -O0):
<zraiseIndexOutOfRange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zraiseIndexOutOfRange>:
mov    %esi,%eax
mov    %rdi,%rsi
lea    -0x1(%rdx),%ecx
lea    0xee1(%rip),%rdi
mov    %eax,%edx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [45 x i8] c"Error: Index out of range in %s(): %d > %d.\0A\00"
define void @zraiseIndexOutOfRange(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 i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = sub nsw i32 %9, 1
%11 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %8, i32 %10)
ret void
}

LLVM IR (-O2):
@.str = [45 x i8] c"Error: Index out of range in %s(): %d > %d.\0A\00"
define void @zraiseIndexOutOfRange(i8* %0, i32 %1, i32 %2) {
%4 = add nsw i32 %2, -1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i32 %4)
ret void
}
int WebPGetEncoderVersion(void) { return (0 << 16) | (3 << 8) | 1; }


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

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

LLVM IR (-O0):
define i32 @WebPGetEncoderVersion() {
ret i32 769
}

LLVM IR (-O2):
define i32 @WebPGetEncoderVersion() {
ret i32 769
}
/* Variables and functions */
unsigned char *xsalsa20_encrypt(unsigned char *, size_t *,
                                unsigned char const *, size_t,
                                unsigned char const *, unsigned char const *);
unsigned char *crypt_encrypt_xsalsa20(unsigned char *out, size_t *out_len,
                                      const unsigned char *in, size_t in_len,
                                      const unsigned char *nonce,
                                      const unsigned char *key) {
  return xsalsa20_encrypt(out, out_len, in, in_len, nonce, key);
}


x86 assembly (clang, -O0):
<crypt_encrypt_xsalsa20>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
call   1030 <xsalsa20_encrypt@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crypt_encrypt_xsalsa20>:
jmp    1030 <xsalsa20_encrypt@plt>

LLVM IR (-O0):
define i8* @crypt_encrypt_xsalsa20(i8* %0, i64* %1, i8* %2, i64 %3, i8* %4, i8* %5) {
%7 = alloca i8*
%8 = alloca i64*
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i8*
%12 = alloca i8*
store i8* %0, i8** %7
store i64* %1, i64** %8
store i8* %2, i8** %9
store i64 %3, i64* %10
store i8* %4, i8** %11
store i8* %5, i8** %12
%13 = load i8*, i8** %7
%14 = load i64*, i64** %8
%15 = load i8*, i8** %9
%16 = load i64, i64* %10
%17 = load i8*, i8** %11
%18 = load i8*, i8** %12
%19 = call i8* @xsalsa20_encrypt(i8* %13, i64* %14, i8* %15, i64 %16, i8* %17, i8* %18)
ret i8* %19
}

LLVM IR (-O2):
define i8* @crypt_encrypt_xsalsa20(i8* %0, i64* %1, i8* %2, i64 %3, i8* %4, i8* %5) {
%7 = tail call i8* @xsalsa20_encrypt(i8* %0, i64* %1, i8* %2, i64 %3, i8* %4, i8* %5)
ret i8* %7
}
/* Type definitions */
typedef int /*<<< orphan*/ PKCS12;
typedef int /*<<< orphan*/ BIO;

/* Variables and functions */
int ASN1_item_i2d_bio(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                      int /*<<< orphan*/ *);
int /*<<< orphan*/ PKCS12_it;
int i2d_PKCS12_bio(BIO *bp, PKCS12 *p12) {
  return ASN1_item_i2d_bio(&PKCS12_it, bp, p12);
}


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

x86 assembly (clang, -O2):
<i2d_PKCS12_bio>:
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    0x2ec3(%rip),%rdi
jmp    1030 <ASN1_item_i2d_bio@plt>

LLVM IR (-O0):
@PKCS12_it = global i32 0
define i32 @i2d_PKCS12_bio(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 @ASN1_item_i2d_bio(i32* @PKCS12_it, i32* %5, i32* %6)
ret i32 %7
}

LLVM IR (-O2):
@PKCS12_it = global i32 0
define i32 @i2d_PKCS12_bio(i32* %0, i32* %1) {
%3 = tail call i32 @ASN1_item_i2d_bio(i32* @PKCS12_it, i32* %0, i32* %1)
ret i32 %3
}
int uxmi_cfg_read() { return (1); }


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

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

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

LLVM IR (-O2):
define i32 @uxmi_cfg_read() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  int i = 1;
  double d = 1.0;
  if (i == d)
    printf(" BeLLA\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movsd  0xed2(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jne    1155 <main+0x45>
jp     1155 <main+0x45>
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [8 x i8] c" BeLLA\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
store i32 0, i32* %1
store i32 1, i32* %2
store double 1.000000e+00, double* %3
%4 = load i32, i32* %2
%5 = sitofp i32 %4 to double
%6 = load double, double* %3
%7 = fcmp oeq double %5, %6
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %0
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
@str = [7 x i8] c" BeLLA\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ debug(int, int, int, int, int, int, int, int, int, int, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int main(void) {
  debug(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0x123400005678LL);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
mov    $0x4,%ecx
mov    $0x5,%r8d
mov    $0x6,%r9d
movl   $0x7,(%rsp)
movl   $0x8,0x8(%rsp)
movl   $0x9,0x10(%rsp)
movl   $0xa,0x18(%rsp)
movl   $0x5678,0x20(%rsp)
call   1030 <debug@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
sub    $0x8,%rsp
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
mov    $0x4,%ecx
mov    $0x5,%r8d
mov    $0x6,%r9d
push   $0x5678
push   $0xa
push   $0x9
push   $0x8
push   $0x7
call   1030 <debug@plt>
add    $0x30,%rsp
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @debug(i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 22136)
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @debug(i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 22136)
%2 = tail call i32 @exit(i32 0)
unreachable
}
void waitForWaiter() {}


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

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

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

LLVM IR (-O2):
define void @waitForWaiter() {
ret void
}
/* Type definitions */
struct timeval {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ z_ms_day_print(struct timeval *);
void z_now_ms_day_print() {
  struct timeval t;
  gettimeofday(&t, NULL);
  z_ms_day_print(&t);
}


x86 assembly (clang, -O0):
<z_now_ms_day_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
lea    -0x8(%rbp),%rdi
call   1040 <z_ms_day_print@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<z_now_ms_day_print>:
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
mov    %rbx,%rdi
call   1040 <z_ms_day_print@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
define void @z_now_ms_day_print() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = call i32 @z_ms_day_print(%struct.timeval* %1)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
define void @z_now_ms_day_print() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = call i32 @z_ms_day_print(%struct.timeval* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ read_audio_state(int, int, int /*<<< orphan*/, float *);
int device_channels(int dev) {
  float val[1];
  read_audio_state(dev, 2, 0, val);
  return ((int)val[0]);
}


x86 assembly (clang, -O0):
<device_channels>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rcx
mov    $0x2,%esi
xor    %edx,%edx
call   1030 <read_audio_state@plt>
cvttss2si -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<device_channels>:
push   %rax
lea    0x4(%rsp),%rcx
mov    $0x2,%esi
xor    %edx,%edx
call   1030 <read_audio_state@plt>
cvttss2si 0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @device_channels(i32 %0) {
%2 = alloca i32
%3 = alloca [1 x float]
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = getelementptr inbounds [1 x float], [1 x float]* %3, i64 0, i64 0
%6 = call i32 @read_audio_state(i32 %4, i32 2, i32 0, float* %5)
%7 = getelementptr inbounds [1 x float], [1 x float]* %3, i64 0, i64 0
%8 = load float, float* %7
%9 = fptosi float %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @device_channels(i32 %0) {
%2 = alloca [1 x float]
%3 = bitcast [1 x float]* %2 to i8*
%4 = getelementptr inbounds [1 x float], [1 x float]* %2, i64 0, i64 0
%5 = call i32 @read_audio_state(i32 %0, i32 2, i32 0, float* %4)
%6 = load float, float* %4
%7 = fptosi float %6 to i32
ret i32 %7
}
int f9(unsigned x) {
  unsigned a = 1, b = 0x7fffffff;
  return x - a >= b;
}


x86 assembly (clang, -O0):
<f9>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x7fffffff,-0xc(%rbp)
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
setae  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f9>:
xor    %eax,%eax
test   %edi,%edi
setle  %al
ret

LLVM IR (-O0):
define i32 @f9(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
store i32 2147483647, i32* %4
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = sub i32 %5, %6
%8 = load i32, i32* %4
%9 = icmp uge i32 %7, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @f9(i32 %0) {
%2 = icmp slt i32 %0, 1
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ WNOHANG;
int errno;
scalar_t__ waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
void sigchld_handler(int s) {
  int saved_errno = errno;
  while (waitpid(-1, NULL, WNOHANG) > 0)
    ;
  errno = saved_errno;
}


x86 assembly (clang, -O0):
<sigchld_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eb6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <waitpid@plt>
cmp    $0x0,%rax
jle    114d <sigchld_handler+0x3d>
jmp    1127 <sigchld_handler+0x17>
mov    -0x8(%rbp),%ecx
mov    0x2e81(%rip),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigchld_handler>:
push   %rbp
push   %r14
push   %rbx
mov    0x2ebd(%rip),%r14
mov    (%r14),%ebp
mov    0x2ec3(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%rbx),%edx
mov    $0xffffffff,%edi
xor    %esi,%esi
call   1030 <waitpid@plt>
test   %rax,%rax
jg     1130 <sigchld_handler+0x20>
mov    %ebp,(%r14)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@errno = global i32 0
@WNOHANG = global i32 0
define void @sigchld_handler(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* @errno
store i32 %4, i32* %3
br label %5
5: ; preds = %9, %1
%6 = load i32, i32* @WNOHANG
%7 = call i64 @waitpid(i32 -1, i32* null, i32 %6)
%8 = icmp sgt i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %5
br label %5
10: ; preds = %5
%11 = load i32, i32* %3
store i32 %11, i32* @errno
ret void
}

LLVM IR (-O2):
@errno = global i32 0
@WNOHANG = global i32 0
define void @sigchld_handler(i32 %0) {
%2 = load i32, i32* @errno
br label %3
3: ; preds = %3, %1
%4 = load i32, i32* @WNOHANG
%5 = tail call i64 @waitpid(i32 -1, i32* null, i32 %4)
%6 = icmp sgt i64 %5, 0
br i1 %6, label %3, label %7
7: ; preds = %3
store i32 %2, i32* @errno
ret void
}
unsigned long ulongsqrint(int x) {
  return ((unsigned long)x * (unsigned long)x);
}


x86 assembly (clang, -O0):
<ulongsqrint>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
movslq -0x4(%rbp),%rcx
imul   %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ulongsqrint>:
movslq %edi,%rax
imul   %rax,%rax
ret

LLVM IR (-O0):
define i64 @ulongsqrint(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
%5 = load i32, i32* %2
%6 = sext i32 %5 to i64
%7 = mul i64 %4, %6
ret i64 %7
}

LLVM IR (-O2):
define i64 @ulongsqrint(i32 %0) {
%2 = sext i32 %0 to i64
%3 = mul nsw i64 %2, %2
ret i64 %3
}
int ChargerPartie(char *tableau) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @ChargerPartie(i8* nocapture readnone %0) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
struct lldp_tlv {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ validate_length_max_255(struct lldp_tlv *);
uint8_t validate_system_description_tlv(struct lldp_tlv *tlv) {
  return validate_length_max_255(tlv);
}


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

x86 assembly (clang, -O2):
<validate_system_description_tlv>:
jmp    1030 <validate_length_max_255@plt>

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

LLVM IR (-O2):
%struct.lldp_tlv = type { i32 }
define i32 @validate_system_description_tlv(%struct.lldp_tlv* %0) {
%2 = tail call i32 @validate_length_max_255(%struct.lldp_tlv* %0)
ret i32 %2
}
int cube(int x) { return x * (x * x); }


x86 assembly (clang, -O0):
<cube>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
imul   -0x4(%rbp),%ecx
imul   %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cube>:
mov    %edi,%eax
imul   %edi,%eax
imul   %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @cube(i32 %0) {
%2 = mul nsw i32 %0, %0
%3 = mul nsw i32 %2, %0
ret i32 %3
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ window;
};
struct TYPE_4__ {
  TYPE_1__ xcreatewindow;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
unsigned long get_XEvent_xcreatewindow_window(void *_p) {
  return (unsigned long)((XEvent *)_p)->xcreatewindow.window;
}


x86 assembly (clang, -O0):
<get_XEvent_xcreatewindow_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_XEvent_xcreatewindow_window>:
mov    (%rdi),%rax
ret

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

LLVM IR (-O2):
define i64 @get_XEvent_xcreatewindow_window(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ manager_resume();
void __attribute__((visibility("default"))) pthread_workqueue_resume_np(void) {
  manager_resume();
}


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

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

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

LLVM IR (-O2):
define void @pthread_workqueue_resume_np() {
%1 = tail call i32 (...) @manager_resume()
ret void
}
main() {
  void GetAtomlist();
  void GetAtomlist_mod();
  void GetCOdict();
  void AnalyzeTrajectory();
  void PostProcess();
  GetAtomlist_mod("bonds.reax");
  GetCOdict("Cutoff.dic");
  AnalyzeTrajectory("bonds.reax", "num.out");
  PostProcess("fra.out", "mol.out", "num.out");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <GetAtomlist_mod@plt>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1040 <GetCOdict@plt>
lea    0xe99(%rip),%rdi
lea    0xea8(%rip),%rsi
mov    $0x0,%al
call   1060 <AnalyzeTrajectory@plt>
lea    0xea2(%rip),%rdi
lea    0xea3(%rip),%rsi
lea    0xe8c(%rip),%rdx
mov    $0x0,%al
call   1050 <PostProcess@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xeb5(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <GetAtomlist_mod@plt>
lea    0xeaf(%rip),%rdi
xor    %eax,%eax
call   1040 <GetCOdict@plt>
lea    0xeac(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <AnalyzeTrajectory@plt>
lea    0xea0(%rip),%rdi
lea    0xea1(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <PostProcess@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [11 x i8] c"bonds.reax\00"
@.str.1 = [11 x i8] c"Cutoff.dic\00"
@.str.2 = [8 x i8] c"num.out\00"
@.str.3 = [8 x i8] c"fra.out\00"
@.str.4 = [8 x i8] c"mol.out\00"
define i32 @main() {
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"bonds.reax\00"
@.str.1 = [11 x i8] c"Cutoff.dic\00"
@.str.2 = [8 x i8] c"num.out\00"
@.str.3 = [8 x i8] c"fra.out\00"
@.str.4 = [8 x i8] c"mol.out\00"
define i32 @main() {
tail call void (i8*, ...) bitcast (void (...)* @GetAtomlist_mod to void (i8*, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
tail call void (i8*, ...) bitcast (void (...)* @GetCOdict to void (i8*, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
tail call void (i8*, i8*, ...) bitcast (void (...)* @AnalyzeTrajectory to void (i8*, i8*, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
tail call void (i8*, i8*, i8*, ...) bitcast (void (...)* @PostProcess to void (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ wint_t;
typedef char wchar_t;

/* Variables and functions */
scalar_t__ wcschr(char const *, int /*<<< orphan*/);
int iswspace(wint_t wc) {
  static const wchar_t spaces[] = {
      ' ',    '\t',   '\n',   '\r',   11,     12,     0x0085, 0x2000,
      0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2008, 0x2009,
      0x200a, 0x2028, 0x2029, 0x205f, 0x3000, 0};
  if (wcschr(spaces, wc))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<iswspace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <wcschr@plt>
cmp    $0x0,%rax
je     1140 <iswspace+0x30>
movl   $0x1,-0x4(%rbp)
jmp    1147 <iswspace+0x37>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iswspace>:
push   %rax
mov    %edi,%esi
lea    0xee6(%rip),%rdi
call   1030 <wcschr@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@iswspace.spaces = internal constant [22 x i8] c" \09\0A\0D\0B\0C\85\00\01\02\03\04\05\06\08\09\0A()_\00\00"
define i32 @iswspace(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i64 @wcschr(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @iswspace.spaces, i64 0, i64 0), i32 %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 1, i32* %2
br label %9
8: ; preds = %1
store i32 0, i32* %2
br label %9
9: ; preds = %8, %7
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
@iswspace.spaces = internal constant [22 x i8] c" \09\0A\0D\0B\0C\85\00\01\02\03\04\05\06\08\09\0A()_\00\00"
define i32 @iswspace(i32 %0) {
%2 = tail call i64 @wcschr(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @iswspace.spaces, i64 0, i64 0), i32 %0)
%3 = icmp ne i64 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ idtinit();
int /*<<< orphan*/ init_8259A();
int /*<<< orphan*/ intrinit();
int /*<<< orphan*/ kallocinit();
int /*<<< orphan*/ kpageinit();
int /*<<< orphan*/ kputs(char *);
int /*<<< orphan*/ schedule();
int /*<<< orphan*/ seginit();
int /*<<< orphan*/ taskinit();
int /*<<< orphan*/ userinit();
int main() {
  kpageinit();
  seginit();
  init_8259A();
  idtinit();
  kallocinit();
  taskinit();
  userinit();
  intrinit();
  kputs("scheduling..");
  schedule();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <kpageinit@plt>
mov    $0x0,%al
call   10c0 <seginit@plt>
mov    $0x0,%al
call   1070 <init_8259A@plt>
mov    $0x0,%al
call   1080 <idtinit@plt>
mov    $0x0,%al
call   1090 <kallocinit@plt>
mov    $0x0,%al
call   10b0 <taskinit@plt>
mov    $0x0,%al
call   1060 <userinit@plt>
mov    $0x0,%al
call   1040 <intrinit@plt>
lea    0xe12(%rip),%rdi
call   10a0 <kputs@plt>
mov    $0x0,%al
call   1030 <schedule@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <kpageinit@plt>
xor    %eax,%eax
call   10c0 <seginit@plt>
xor    %eax,%eax
call   1070 <init_8259A@plt>
xor    %eax,%eax
call   1080 <idtinit@plt>
xor    %eax,%eax
call   1090 <kallocinit@plt>
xor    %eax,%eax
call   10b0 <taskinit@plt>
xor    %eax,%eax
call   1060 <userinit@plt>
xor    %eax,%eax
call   1040 <intrinit@plt>
lea    0xe20(%rip),%rdi
call   10a0 <kputs@plt>
xor    %eax,%eax
call   1030 <schedule@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"scheduling..\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @kpageinit()
%3 = call i32 (...) @seginit()
%4 = call i32 (...) @init_8259A()
%5 = call i32 (...) @idtinit()
%6 = call i32 (...) @kallocinit()
%7 = call i32 (...) @taskinit()
%8 = call i32 (...) @userinit()
%9 = call i32 (...) @intrinit()
%10 = call i32 @kputs(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (...) @schedule()
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"scheduling..\00"
define i32 @main() {
%1 = tail call i32 (...) @kpageinit()
%2 = tail call i32 (...) @seginit()
%3 = tail call i32 (...) @init_8259A()
%4 = tail call i32 (...) @idtinit()
%5 = tail call i32 (...) @kallocinit()
%6 = tail call i32 (...) @taskinit()
%7 = tail call i32 (...) @userinit()
%8 = tail call i32 (...) @intrinit()
%9 = tail call i32 @kputs(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 (...) @schedule()
ret i32 0
}
int CG_HorizontalAlignForWidth(const int x, int align, int width) {
  int nx = x;
  if (align % 3 == 0)
    nx = x;
  if (align % 3 == 1)
    nx = x - width / 2;
  if (align % 3 == 2)
    nx = x - width;
  return nx;
}


x86 assembly (clang, -O0):
<CG_HorizontalAlignForWidth>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    112d <CG_HorizontalAlignForWidth+0x2d>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    115c <CG_HorizontalAlignForWidth+0x5c>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x2,%edx
jne    1179 <CG_HorizontalAlignForWidth+0x79>
mov    -0x4(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CG_HorizontalAlignForWidth>:
mov    %edi,%eax
movslq %esi,%rcx
imul   $0x55555556,%rcx,%rsi
mov    %rsi,%rdi
shr    $0x3f,%rdi
shr    $0x20,%rsi
add    %edi,%esi
lea    (%rsi,%rsi,2),%esi
sub    %esi,%ecx
mov    %eax,%esi
cmp    $0x1,%ecx
jne    1132 <CG_HorizontalAlignForWidth+0x32>
mov    %edx,%edi
shr    $0x1f,%edi
add    %edx,%edi
sar    %edi
mov    %eax,%esi
sub    %edi,%esi
sub    %edx,%eax
cmp    $0x2,%ecx
cmovne %esi,%eax
ret

LLVM IR (-O0):
define i32 @CG_HorizontalAlignForWidth(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
store i32 %8, i32* %7
%9 = load i32, i32* %5
%10 = srem i32 %9, 3
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %3
%13 = load i32, i32* %4
store i32 %13, i32* %7
br label %14
14: ; preds = %12, %3
%15 = load i32, i32* %5
%16 = srem i32 %15, 3
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %23
18: ; preds = %14
%19 = load i32, i32* %4
%20 = load i32, i32* %6
%21 = sdiv i32 %20, 2
%22 = sub nsw i32 %19, %21
store i32 %22, i32* %7
br label %23
23: ; preds = %18, %14
%24 = load i32, i32* %5
%25 = srem i32 %24, 3
%26 = icmp eq i32 %25, 2
br i1 %26, label %27, label %31
27: ; preds = %23
%28 = load i32, i32* %4
%29 = load i32, i32* %6
%30 = sub nsw i32 %28, %29
store i32 %30, i32* %7
br label %31
31: ; preds = %27, %23
%32 = load i32, i32* %7
ret i32 %32
}

LLVM IR (-O2):
define i32 @CG_HorizontalAlignForWidth(i32 %0, i32 %1, i32 %2) {
%4 = srem i32 %1, 3
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = sdiv i32 %2, -2
%8 = add i32 %7, %0
br label %9
9: ; preds = %6, %3
%10 = phi i32 [ %8, %6 ], [ %0, %3 ]
%11 = icmp eq i32 %4, 2
%12 = sub nsw i32 %0, %2
%13 = select i1 %11, i32 %12, i32 %10
ret i32 %13
}
void syn() {}


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

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

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

LLVM IR (-O2):
define void @syn() {
ret void
}
int count_ones(int n) {
  int counter = 0;
  while (n) {
    counter += n & 1;
    n >>= 1;
  }
  return counter;
}


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

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

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

LLVM IR (-O2):
define i32 @count_ones(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %8, %3 ], [ %0, %1 ]
%6 = and i32 %5, 1
%7 = add nuw nsw i32 %4, %6
%8 = ashr i32 %5, 1
%9 = icmp ult i32 %5, 2
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %11
}
int s_isleap(int year) {
  if (!(year % 4) && (year % 100))
    return 1;
  else if (!(year % 100) && !(year % 400))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<s_isleap>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    113b <s_isleap+0x3b>
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     113b <s_isleap+0x3b>
movl   $0x1,-0x4(%rbp)
jmp    117b <s_isleap+0x7b>
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    116f <s_isleap+0x6f>
mov    -0x8(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    116f <s_isleap+0x6f>
movl   $0x1,-0x4(%rbp)
jmp    117b <s_isleap+0x7b>
jmp    1174 <s_isleap+0x74>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<s_isleap>:
movslq %edi,%rcx
imul   $0x51eb851f,%rcx,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
mov    %rdx,%rax
sar    $0x25,%rax
add    %esi,%eax
imul   $0x64,%eax,%eax
sub    %eax,%ecx
test   $0x3,%dil
jne    112f <s_isleap+0x2f>
mov    $0x1,%eax
test   %ecx,%ecx
je     112f <s_isleap+0x2f>
ret
sar    $0x27,%rdx
add    %esi,%edx
imul   $0x190,%edx,%eax
sub    %eax,%edi
xor    %eax,%eax
or     %edi,%ecx
sete   %al
ret

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

LLVM IR (-O2):
define i32 @s_isleap(i32 %0) {
%2 = and i32 %0, 3
%3 = icmp ne i32 %2, 0
%4 = srem i32 %0, 100
%5 = icmp eq i32 %4, 0
%6 = or i1 %3, %5
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = srem i32 %0, 400
%9 = or i32 %4, %8
%10 = icmp eq i32 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %7, %1
%13 = phi i32 [ 1, %1 ], [ %11, %7 ]
ret i32 %13
}
void HTS221_IO_ITConfig(void) {}


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

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

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

LLVM IR (-O2):
define void @HTS221_IO_ITConfig() {
ret void
}
/* Variables and functions */
int lettura(int matrice[][5], size_t indice_righe, size_t indice_colonne) {
  int dato_letto;
  dato_letto = matrice[indice_righe][indice_colonne];
  return (dato_letto);
}


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

x86 assembly (clang, -O2):
<lettura>:
lea    (%rsi,%rsi,4),%rax
lea    (%rdi,%rax,4),%rax
mov    (%rax,%rdx,4),%eax
ret

LLVM IR (-O0):
define i32 @lettura([5 x i32]* %0, i64 %1, i64 %2) {
%4 = alloca [5 x i32]*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i32
store [5 x i32]* %0, [5 x i32]** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%8 = load [5 x i32]*, [5 x i32]** %4
%9 = load i64, i64* %5
%10 = getelementptr inbounds [5 x i32], [5 x i32]* %8, i64 %9
%11 = load i64, i64* %6
%12 = getelementptr inbounds [5 x i32], [5 x i32]* %10, i64 0, i64 %11
%13 = load i32, i32* %12
store i32 %13, i32* %7
%14 = load i32, i32* %7
ret i32 %14
}

LLVM IR (-O2):
define i32 @lettura([5 x i32]* nocapture %0, i64 %1, i64 %2) {
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %0, i64 %1, i64 %2
%5 = load i32, i32* %4
ret i32 %5
}
/* Variables and functions */
char toupper(char);
void mytoupper(char a[]) {
  int i = 0;
  for (i = 0; (a[i] = toupper(a[i])); i++)
    ;
}


x86 assembly (clang, -O0):
<mytoupper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <toupper@plt>
mov    -0x8(%rbp),%rcx
movslq -0xc(%rbp),%rdx
mov    %al,(%rcx,%rdx,1)
cmp    $0x0,%al
je     1161 <mytoupper+0x51>
jmp    1153 <mytoupper+0x43>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112a <mytoupper+0x1a>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mytoupper>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl (%rbx),%edi
call   1030 <toupper@plt>
mov    %al,(%rbx)
add    $0x1,%rbx
test   %al,%al
jne    1120 <mytoupper+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @mytoupper(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %8, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = tail call signext i8 @toupper(i8 signext %5)
store i8 %6, i8* %4
%7 = icmp eq i8 %6, 0
%8 = add nuw i64 %3, 1
br i1 %7, label %9, label %2
9: ; preds = %2
ret void
}
void cfg_erase(void) {}


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

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

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

LLVM IR (-O2):
define void @cfg_erase() {
ret void
}
/* Variables and functions */
double acos(int);
int glmComputeVectorLength2d(double const *);
int glmDotProduct2d(double const *, double const *);
double glmComputeVectorAngle2dRad(const double v1[2], const double v2[2]) {
  return acos(glmDotProduct2d(v1, v2) /
              (glmComputeVectorLength2d(v1) * glmComputeVectorLength2d(v2)));
}


x86 assembly (clang, -O0):
<glmComputeVectorAngle2dRad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <glmDotProduct2d@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <glmComputeVectorLength2d@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <glmComputeVectorLength2d@plt>
mov    -0x18(%rbp),%ecx
mov    %eax,%edx
mov    -0x14(%rbp),%eax
imul   %edx,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <acos@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmComputeVectorAngle2dRad>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1050 <glmDotProduct2d@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <glmComputeVectorLength2d@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1040 <glmComputeVectorLength2d@plt>
mov    %eax,%ecx
imul   %ebx,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
mov    %eax,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <acos@plt>

LLVM IR (-O0):
define double @glmComputeVectorAngle2dRad(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** %4
%7 = call i32 @glmDotProduct2d(double* %5, double* %6)
%8 = load double*, double** %3
%9 = call i32 @glmComputeVectorLength2d(double* %8)
%10 = load double*, double** %4
%11 = call i32 @glmComputeVectorLength2d(double* %10)
%12 = mul nsw i32 %9, %11
%13 = sdiv i32 %7, %12
%14 = call double @acos(i32 %13)
ret double %14
}

LLVM IR (-O2):
define double @glmComputeVectorAngle2dRad(double* %0, double* %1) {
%3 = tail call i32 @glmDotProduct2d(double* %0, double* %1)
%4 = tail call i32 @glmComputeVectorLength2d(double* %0)
%5 = tail call i32 @glmComputeVectorLength2d(double* %1)
%6 = mul nsw i32 %5, %4
%7 = sdiv i32 %3, %6
%8 = tail call double @acos(i32 %7)
ret double %8
}
/* Variables and functions */
int rand();
int get_random(void) { return rand() % (16 * (1 << 10)); }


x86 assembly (clang, -O0):
<get_random>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x4000,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_random>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
lea    0x3fff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffffc000,%ecx
sub    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @get_random() {
%1 = call i32 (...) @rand()
%2 = srem i32 %1, 16384
ret i32 %2
}

LLVM IR (-O2):
define i32 @get_random() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 16384
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int M228_f(char *s) {
  debug("M228_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<M228_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M228_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf06(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"M228_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M228_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [47 x i8] c"M228_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M228_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void formattedonly(void) {
  fprintf(
      stderr,
      "The output formats for Tk and TkMan require nroff-formatted input\n");
  exit(1);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [67 x i8] c"The output formats for Tk and TkMan require nroff-formatted input\0A\00"
define void @formattedonly() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [67 x i8] c"The output formats for Tk and TkMan require nroff-formatted input\0A\00"
define void @formattedonly() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int factorial(int);
int main() { return factorial(5); }


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

x86 assembly (clang, -O2):
<main>:
mov    $0x5,%edi
jmp    1030 <factorial@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @factorial(i32 5)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ putchar(int);
void sio_write(int x) { putchar(x); }


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

x86 assembly (clang, -O2):
<sio_write>:
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @sio_write(i32 %0) {
%2 = tail call i32 @putchar(i32 %0)
ret void
}