xunge/DecIR huggingface dataset:
/* Type definitions */
struct stat {
  int st_mode;
};

/* Variables and functions */
int S_IFMT;
scalar_t__ stat(char const *, struct stat *);
int fileTypeTest(const char *path, int type) {
  struct stat st;
  if (stat(path, &st) != 0) {
    return 1;
  };
  if ((st.st_mode & S_IFMT) == type) {
    return 0;
  };
  return 1;
}


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

x86 assembly (clang, -O2):
<fileTypeTest>:
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebx
lea    0x8(%rsp),%rsi
call   1030 <stat@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    1142 <fileTypeTest+0x32>
mov    0x2eab(%rip),%rax
mov    (%rax),%ecx
and    0x8(%rsp),%ecx
xor    %eax,%eax
cmp    %ebx,%ecx
setne  %al
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
%struct.stat = type { i32 }
@S_IFMT = global i32 0
define i32 @fileTypeTest(i8* %0, i32 %1) {
%3 = alloca %struct.stat
%4 = bitcast %struct.stat* %3 to i8*
%5 = call i64 @stat(i8* %0, %struct.stat* %3)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %2
%8 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%9 = load i32, i32* %8
%10 = load i32, i32* @S_IFMT
%11 = and i32 %10, %9
%12 = icmp ne i32 %11, %1
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %7, %2
%15 = phi i32 [ 1, %2 ], [ %13, %7 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ memset(char *, int, int);
void _F90_FCD_BLANK(char *trg_addr, int trg_len) {
  if (trg_len > 0)
    (void)memset(trg_addr, ((int)' '), trg_len);
  return;
}


x86 assembly (clang, -O0):
<_F90_FCD_BLANK>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    113a <_F90_FCD_BLANK+0x2a>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    $0x20,%esi
call   1030 <memset@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_F90_FCD_BLANK>:
test   %esi,%esi
jle    1120 <_F90_FCD_BLANK+0x10>
mov    %esi,%edx
mov    $0x20,%esi
jmp    1030 <memset@plt>
ret

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

LLVM IR (-O2):
define void @_F90_FCD_BLANK(i8* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @memset(i8* %0, i32 32, i32 %1)
br label %6
6: ; preds = %4, %2
ret void
}
/* Variables and functions */
scalar_t__ realloc(int *, int);
int *rebuild_vec_list(int *vec_list, int length) {
  vec_list = (int *)realloc(vec_list, (length + 1) * sizeof(int));
  return vec_list;
}


x86 assembly (clang, -O0):
<rebuild_vec_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x2,%rax
mov    %eax,%esi
call   1030 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rebuild_vec_list>:
lea    0x4(,%rsi,4),%esi
jmp    1030 <realloc@plt>

LLVM IR (-O0):
define i32* @rebuild_vec_list(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 = add nsw i32 %6, 1
%8 = sext i32 %7 to i64
%9 = mul i64 %8, 4
%10 = trunc i64 %9 to i32
%11 = call i64 @realloc(i32* %5, i32 %10)
%12 = inttoptr i64 %11 to i32*
store i32* %12, i32** %3
%13 = load i32*, i32** %3
ret i32* %13
}

LLVM IR (-O2):
define i32* @rebuild_vec_list(i32* %0, i32 %1) {
%3 = shl i32 %1, 2
%4 = add i32 %3, 4
%5 = tail call i64 @realloc(i32* %0, i32 %4)
%6 = inttoptr i64 %5 to i32*
ret i32* %6
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void HxFree(void *p) { free(p); }


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

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

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

LLVM IR (-O2):
define void @HxFree(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int match(char *, char *);
int /*<<< orphan*/ point(int);
int vspen(char *s) {
  if (s == 0)
    return (0);
  if (!point((int)s))
    return (0);
  return (match(s, "\\^"));
}


x86 assembly (clang, -O0):
<vspen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1143 <vspen+0x23>
movl   $0x0,-0x4(%rbp)
jmp    1176 <vspen+0x56>
mov    -0x10(%rbp),%rax
mov    %eax,%edi
call   1030 <point@plt>
cmp    $0x0,%eax
jne    1163 <vspen+0x43>
movl   $0x0,-0x4(%rbp)
jmp    1176 <vspen+0x56>
mov    -0x10(%rbp),%rdi
lea    0xe92(%rip),%rsi
call   1040 <match@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vspen>:
push   %rbx
test   %rdi,%rdi
je     1142 <vspen+0x22>
mov    %rdi,%rbx
call   1030 <point@plt>
test   %eax,%eax
je     1142 <vspen+0x22>
lea    0xec7(%rip),%rsi
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <match@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"\\^\00"
define i32 @vspen(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 0, i32* %2
br label %16
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = ptrtoint i8* %8 to i32
%10 = call i32 @point(i32 %9)
%11 = icmp ne i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %7
store i32 0, i32* %2
br label %16
13: ; preds = %7
%14 = load i8*, i8** %3
%15 = call i32 @match(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %15, i32* %2
br label %16
16: ; preds = %13, %12, %6
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
@.str = [3 x i8] c"\\^\00"
define i32 @vspen(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = ptrtoint i8* %0 to i64
%5 = trunc i64 %4 to i32
%6 = tail call i32 @point(i32 %5)
%7 = icmp eq i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %3
%9 = tail call i32 @match(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %3, %1, %8
%11 = phi i32 [ %9, %8 ], [ 0, %1 ], [ 0, %3 ]
ret i32 %11
}
/* Type definitions */
struct utimbuf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int utime(const char *filename, const struct utimbuf *buf) {
  errno = ENOSYS;
  return -1;
}


x86 assembly (clang, -O0):
<utime>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ed5(%rip),%rax
mov    (%rax),%ecx
mov    0x2ebc(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.utimbuf = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @utime(i8* %0, %struct.utimbuf* %1) {
%3 = alloca i8*
%4 = alloca %struct.utimbuf*
store i8* %0, i8** %3
store %struct.utimbuf* %1, %struct.utimbuf** %4
%5 = load i32, i32* @ENOSYS
store i32 %5, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
%struct.utimbuf = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @utime(i8* nocapture readnone %0, %struct.utimbuf* nocapture readnone %1) {
%3 = load i32, i32* @ENOSYS
store i32 %3, i32* @errno
ret i32 -1
}
int op_le(int a, int b) { return (a <= b); }


x86 assembly (clang, -O0):
<op_le>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setle  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<op_le>:
xor    %eax,%eax
cmp    %esi,%edi
setle  %al
ret

LLVM IR (-O0):
define i32 @op_le(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 sle i32 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @op_le(i32 %0, i32 %1) {
%3 = icmp sle i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int main() {
  float tc;
  printf("Celsius (oC): ");
  scanf("%f", &tc);
  printf("Kelvin: %.2f K", tc + 273.15);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xea2(%rip),%xmm1
addsd  %xmm1,%xmm0
lea    0xeb1(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xeae(%rip),%xmm0
lea    0xec1(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Celsius (oC): \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [15 x i8] c"Kelvin: %.2f K\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 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), float* %2)
%5 = load float, float* %2
%6 = fpext float %5 to double
%7 = fadd double %6, 2.731500e+02
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), double %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Celsius (oC): \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [15 x i8] c"Kelvin: %.2f K\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 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), float* %1)
%5 = load float, float* %1
%6 = fpext float %5 to double
%7 = fadd double %6, 2.731500e+02
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), double %7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ aes_cbc_encrypt(void *, unsigned char *, unsigned char *);
void crypto_cbc_encrypt(void *ctx, int cipher, unsigned char *plaintxt,
                        unsigned char *ciphertxt) {
  switch (cipher) {
  case 10:
  case 11:
  case 12:
    aes_cbc_encrypt(ctx, plaintxt, ciphertxt);
    break;
  }
}


x86 assembly (clang, -O0):
<crypto_cbc_encrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0xc(%rbp),%eax
add    $0xfffffff6,%eax
sub    $0x2,%eax
ja     114c <crypto_cbc_encrypt+0x3c>
jmp    113b <crypto_cbc_encrypt+0x2b>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <aes_cbc_encrypt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crypto_cbc_encrypt>:
add    $0xfffffff6,%esi
cmp    $0x2,%esi
ja     1123 <crypto_cbc_encrypt+0x13>
mov    %rdx,%rsi
mov    %rcx,%rdx
jmp    1030 <aes_cbc_encrypt@plt>
ret

LLVM IR (-O0):
define void @crypto_cbc_encrypt(i8* %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i32, i32* %6
switch i32 %9, label %15 [
i32 10, label %10
i32 11, label %10
i32 12, label %10
]
10: ; preds = %4, %4, %4
%11 = load i8*, i8** %5
%12 = load i8*, i8** %7
%13 = load i8*, i8** %8
%14 = call i32 @aes_cbc_encrypt(i8* %11, i8* %12, i8* %13)
br label %15
15: ; preds = %4, %10
ret void
}

LLVM IR (-O2):
define void @crypto_cbc_encrypt(i8* %0, i32 %1, i8* %2, i8* %3) {
%5 = add i32 %1, -10
%6 = icmp ult i32 %5, 3
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 @aes_cbc_encrypt(i8* %0, i8* %2, i8* %3)
br label %9
9: ; preds = %4, %7
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
void memset_good3() {
  int arr[10];
  memset(arr, 0, 20);
}


x86 assembly (clang, -O0):
<memset_good3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1030 <memset@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memset_good3>:
sub    $0x28,%rsp
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1030 <memset@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
define void @memset_good3() {
%1 = alloca [10 x i32]
%2 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%3 = call i32 @memset(i32* %2, i32 0, i32 20)
ret void
}

LLVM IR (-O2):
define void @memset_good3() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @memset(i32* %3, i32 0, i32 20)
ret void
}
/* Variables and functions */
int go32_exec(char const *, char const **, char const **);
int script_exec(const char *program, const char **argv, const char **envp) {
  return go32_exec(program, argv, envp);
}


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

x86 assembly (clang, -O2):
<script_exec>:
jmp    1030 <go32_exec@plt>

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

LLVM IR (-O2):
define i32 @script_exec(i8* %0, i8** %1, i8** %2) {
%4 = tail call i32 @go32_exec(i8* %0, i8** %1, i8** %2)
ret i32 %4
}
extern unsigned short inw(unsigned short port) {
  unsigned short _v;
  __asm__ __volatile__("in"
                       "w"
                       " %"
                       "w"
                       "1,%"
                       ""
                       "0"
                       : "=a"(_v)
                       : "Nd"(port));
  return _v;
}


x86 assembly (clang, -O0):
<inw>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%dx
in     (%dx),%ax
mov    %ax,-0x4(%rbp)
movzwl -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inw>:
mov    %edi,%edx
in     (%dx),%ax
ret

LLVM IR (-O0):
define zeroext i16 @inw(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i16
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = call i16 asm sideeffect "inw ${1:w},$0", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 %4)
store i16 %5, i16* %3
%6 = load i16, i16* %3
ret i16 %6
}

LLVM IR (-O2):
define zeroext i16 @inw(i16 zeroext %0) {
%2 = tail call i16 asm sideeffect "inw ${1:w},$0", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 %0)
ret i16 %2
}
void EndianSwap_4bytes(unsigned char *data) {
  unsigned int *ival = (unsigned int *)data;
  unsigned int val = *ival;
  *ival = ((val >> 24) & 0x000000ff) | ((val >> 8) & 0x0000ff00) |
          ((val << 8) & 0x00ff0000) | ((val << 24) & 0xff000000);
}


x86 assembly (clang, -O0):
<EndianSwap_4bytes>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
shr    $0x18,%ecx
and    $0xff,%ecx
mov    -0x14(%rbp),%eax
shr    $0x8,%eax
and    $0xff00,%eax
or     %eax,%ecx
mov    -0x14(%rbp),%eax
shl    $0x8,%eax
and    $0xff0000,%eax
or     %eax,%ecx
mov    -0x14(%rbp),%eax
shl    $0x18,%eax
and    $0xff000000,%eax
or     %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @EndianSwap_4bytes(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = bitcast i8* %5 to i32*
store i32* %6, i32** %3
%7 = load i32*, i32** %3
%8 = load i32, i32* %7
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = lshr i32 %9, 24
%11 = and i32 %10, 255
%12 = load i32, i32* %4
%13 = lshr i32 %12, 8
%14 = and i32 %13, 65280
%15 = or i32 %11, %14
%16 = load i32, i32* %4
%17 = shl i32 %16, 8
%18 = and i32 %17, 16711680
%19 = or i32 %15, %18
%20 = load i32, i32* %4
%21 = shl i32 %20, 24
%22 = and i32 %21, -16777216
%23 = or i32 %19, %22
%24 = load i32*, i32** %3
store i32 %23, i32* %24
ret void
}

LLVM IR (-O2):
define void @EndianSwap_4bytes(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @llvm.bswap.i32(i32 %3)
store i32 %4, i32* %2
ret void
}
int __attribute__((no)) my_printf(const char *p, ...) {
  static volatile int x;
  ++x;
}


x86 assembly (clang, -O0):
<my_printf>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    0x2f16(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2f0d(%rip)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_printf>:
addl   $0x1,0x2f1d(%rip)
ret

LLVM IR (-O0):
@my_printf.x = internal global i32 0
define i32 @my_printf(i8* %0, ...) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load volatile i32, i32* @my_printf.x
%5 = add nsw i32 %4, 1
store volatile i32 %5, i32* @my_printf.x
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
@my_printf.x = internal global i32 0
define i32 @my_printf(i8* nocapture readnone %0, ...) {
%2 = load volatile i32, i32* @my_printf.x
%3 = add nsw i32 %2, 1
store volatile i32 %3, i32* @my_printf.x
ret i32 undef
}
void pci_restore_aspm_l1ss_state(struct pci_dev *dev) {}


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

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

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

LLVM IR (-O2):
%struct.pci_dev = type opaque
define void @pci_restore_aspm_l1ss_state(%struct.pci_dev* nocapture %0) {
ret void
}
/* Variables and functions */
int mod_pow(int, int, int);
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int result1 = mod_pow(34, 12, 54);
  int result2 = mod_pow(21, 55, 23);
  printf("result1 = %d, result2 = %d\n", result1, result2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x22,%edi
mov    $0xc,%esi
mov    $0x36,%edx
call   1040 <mod_pow@plt>
mov    %eax,-0x8(%rbp)
mov    $0x15,%edi
mov    $0x37,%esi
mov    $0x17,%edx
call   1040 <mod_pow@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x22,%edi
mov    $0xc,%esi
mov    $0x36,%edx
call   1040 <mod_pow@plt>
mov    %eax,%ebx
mov    $0x15,%edi
mov    $0x37,%esi
mov    $0x17,%edx
call   1040 <mod_pow@plt>
lea    0xeae(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"result1 = %d, result2 = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @mod_pow(i32 34, i32 12, i32 54)
store i32 %4, i32* %2
%5 = call i32 @mod_pow(i32 21, i32 55, i32 23)
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"result1 = %d, result2 = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @mod_pow(i32 34, i32 12, i32 54)
%2 = tail call i32 @mod_pow(i32 21, i32 55, i32 23)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ MAIN__();
int test3_() {
  MAIN__();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @test3_() {
%1 = call i32 (...) @MAIN__()
ret i32 0
}

LLVM IR (-O2):
define i32 @test3_() {
%1 = tail call i32 (...) @MAIN__()
ret i32 0
}
/* Variables and functions */
int strcmp(char const *, char const *);
int cmp(const char *s1, const char *s2) { return (strcmp(s1, s2)); }


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

x86 assembly (clang, -O2):
<cmp>:
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcpy(char *, char const *);
int /*<<< orphan*/ strlen(char const *);
void test1(const char *msg) {
  char a[strlen(msg) + 1];
  strcpy(a, msg);
  printf("%s\n", a);
}


x86 assembly (clang, -O0):
<test1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x20(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x20(%rbp),%rsi
lea    0xe81(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test1>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1040 <strlen@plt>
add    $0x1,%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
lea    0xe9b(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
lea    -0x10(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @test1(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
%7 = add nsw i32 %6, 1
%8 = zext i32 %7 to i64
%9 = call i8* @llvm.stacksave()
store i8* %9, i8** %3
%10 = alloca i8, i64 %8
store i64 %8, i64* %4
%11 = load i8*, i8** %2
%12 = call i32 @strcpy(i8* %10, i8* %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %10)
%14 = load i8*, i8** %3
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @test1(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = zext i32 %3 to i64
%5 = alloca i8, i64 %4
%6 = call i32 @strcpy(i8* %5, i8* %0)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
ret void
}
/* Variables and functions */
int __simc(int, int, int /*<<< orphan*/, int /*<<< orphan*/);
int simc_close(int fd) { return __simc(6, fd, 0, 0); }


x86 assembly (clang, -O0):
<simc_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x6,%edi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1030 <__simc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<simc_close>:
mov    %edi,%esi
mov    $0x6,%edi
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <__simc@plt>

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

LLVM IR (-O2):
define i32 @simc_close(i32 %0) {
%2 = tail call i32 @__simc(i32 6, i32 %0, i32 0, i32 0)
ret i32 %2
}
/* Variables and functions */
int MPI_Comm_rank(int, int *);
int getrank() {
  int errorcode, rank;
  errorcode = MPI_Comm_rank((1), &rank);
  return rank;
}


x86 assembly (clang, -O0):
<getrank>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
lea    -0x8(%rbp),%rsi
call   1030 <MPI_Comm_rank@plt>
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getrank>:
push   %rax
lea    0x4(%rsp),%rsi
mov    $0x1,%edi
call   1030 <MPI_Comm_rank@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @getrank() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @MPI_Comm_rank(i32 1, i32* %1)
%4 = load i32, i32* %1
ret i32 %4
}
/* Variables and functions */
#define SIGINT 129
#define SIGKILL 128
int /*<<< orphan*/ printf(char *);
void multiple_handler(int signal) {
  printf("\n");
  switch (signal) {
  case SIGKILL:
    printf("SIGKILL\n");
    break;
  case SIGINT:
    printf("SIGINT : the user interrupted the program with ctrl-c\n");
    break;
  default:
    printf("Unknown signal.\n");
    break;
  }
}


x86 assembly (clang, -O0):
<multiple_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xf2d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x80,%eax
je     1150 <multiple_handler+0x40>
jmp    113d <multiple_handler+0x2d>
mov    -0x8(%rbp),%eax
sub    $0x81,%eax
je     1161 <multiple_handler+0x51>
jmp    1172 <multiple_handler+0x62>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
jmp    117e <multiple_handler+0x6e>
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
jmp    117e <multiple_handler+0x6e>
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<multiple_handler>:
push   %rbx
mov    %edi,%ebx
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    $0x81,%ebx
lea    0xec6(%rip),%rax
lea    0xefd(%rip),%rcx
cmove  %rax,%rcx
cmp    $0x80,%ebx
lea    0xee4(%rip),%rdi
cmovne %rcx,%rdi
pop    %rbx
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [9 x i8] c"SIGKILL\0A\00"
@.str.2 = [55 x i8] c"SIGINT : the user interrupted the program with ctrl-c\0A\00"
@.str.3 = [17 x i8] c"Unknown signal.\0A\00"
define void @multiple_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %2
switch i32 %4, label %9 [
i32 128, label %5
i32 129, label %7
]
5: ; preds = %1
%6 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %11
7: ; preds = %1
%8 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0))
br label %11
9: ; preds = %1
%10 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %11
11: ; preds = %9, %7, %5
ret void
}

LLVM IR (-O2):
@str = [54 x i8] c"SIGINT : the user interrupted the program with ctrl-c\00"
@str.4 = [8 x i8] c"SIGKILL\00"
@str.5 = [16 x i8] c"Unknown signal.\00"
define void @multiple_handler(i32 %0) {
%2 = tail call i32 @putchar(i32 10)
%3 = icmp eq i32 %0, 129
%4 = select i1 %3, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @str.5, i64 0, i64 0)
%5 = icmp eq i32 %0, 128
%6 = select i1 %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @str.4, i64 0, i64 0), i8* %4
%7 = tail call i32 @puts(i8* dereferenceable(1) %6)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
uint32_t hash(double value) {
  assert(sizeof(double) == 2 * sizeof(uint32_t));
  union u {
    double uValue;
    uint32_t word[2];
  };
  union u valueUnion;
  valueUnion.uValue = value;
  return valueUnion.word[0] ^ valueUnion.word[1];
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    $0x1,%edi
call   1030 <assert@plt>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
xor    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
push   %rax
movsd  %xmm0,(%rsp)
mov    $0x1,%edi
call   1030 <assert@plt>
movq   (%rsp),%xmm0
movq   %xmm0,%rcx
mov    %rcx,%rax
shr    $0x20,%rax
xor    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%union.u = type { double }
define i32 @hash(double %0) {
%2 = alloca double
%3 = alloca %union.u
store double %0, double* %2
%4 = call i32 @assert(i32 1)
%5 = load double, double* %2
%6 = bitcast %union.u* %3 to double*
store double %5, double* %6
%7 = bitcast %union.u* %3 to [2 x i32]*
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%9 = load i32, i32* %8
%10 = bitcast %union.u* %3 to [2 x i32]*
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %10, i64 0, i64 1
%12 = load i32, i32* %11
%13 = xor i32 %9, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @hash(double %0) {
%2 = tail call i32 @assert(i32 1)
%3 = bitcast double %0 to i64
%4 = lshr i64 %3, 32
%5 = xor i64 %4, %3
%6 = trunc i64 %5 to i32
ret i32 %6
}
/* Variables and functions */
double M_PI;
double rad2deg(double x) { return (x / (M_PI / 180.0)); }


x86 assembly (clang, -O0):
<rad2deg>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    0x2ed3(%rip),%rax
movsd  (%rax),%xmm1
movsd  0xedf(%rip),%xmm2
divsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<rad2deg>:
mov    0x2ee1(%rip),%rax
movsd  (%rax),%xmm1
divsd  0xeed(%rip),%xmm1
divsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @rad2deg(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* @M_PI
%5 = fdiv double %4, 1.800000e+02
%6 = fdiv double %3, %5
ret double %6
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @rad2deg(double %0) {
%2 = load double, double* @M_PI
%3 = fdiv double %2, 1.800000e+02
%4 = fdiv double %0, %3
ret double %4
}
int main() {
  void *p;
  void *q = &p;
  void *r = &p;
  p = &q;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i32 0, i32* %1
%5 = bitcast i8** %2 to i8*
store i8* %5, i8** %3
%6 = bitcast i8** %2 to i8*
store i8* %6, i8** %4
%7 = bitcast i8** %3 to i8*
store i8* %7, i8** %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ __console_tx_hex16(int /*<<< orphan*/, unsigned short);
void print_emerg_hex16(unsigned short value) { __console_tx_hex16(0, value); }


x86 assembly (clang, -O0):
<print_emerg_hex16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
xor    %edi,%edi
movzwl -0x2(%rbp),%esi
call   1030 <__console_tx_hex16@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_emerg_hex16>:
mov    %edi,%esi
xor    %edi,%edi
jmp    1030 <__console_tx_hex16@plt>

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

LLVM IR (-O2):
define void @print_emerg_hex16(i16 zeroext %0) {
%2 = tail call i32 @__console_tx_hex16(i32 0, i16 zeroext %0)
ret void
}
void test120_Mod_targetInit__I() {}


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

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

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

LLVM IR (-O2):
define void @test120_Mod_targetInit__I() {
ret void
}
void quit_command() {}


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

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

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

LLVM IR (-O2):
define void @quit_command() {
ret void
}
int test_imm_27uint32_reg(unsigned int val) {
  return ((val) & (0x27 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_27uint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x27,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_27uint32_reg(i32 %0) {
%2 = and i32 %0, 39
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void target_reset() { asm("call 0		\n	nop "); }


x86 assembly (clang, -O0):
<target_reset>:
push   %rbp
mov    %rsp,%rbp
call   0 <_init-0x1000>
nop
pop    %rbp
ret

x86 assembly (clang, -O2):
<target_reset>:
call   0 <_init-0x1000>
nop
ret

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

LLVM IR (-O2):
define void @target_reset() {
tail call void asm sideeffect "call 0\09\09\0A\09nop ", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
void output_char(char c) {
  *(long *)(0x100000208) = c;
  return;
}


x86 assembly (clang, -O0):
<output_char>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbq -0x1(%rbp),%rcx
movabs $0x100000208,%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_char>:
movslq %edi,%rax
movabs $0x100000208,%rcx
mov    %rax,(%rcx)
ret

LLVM IR (-O0):
define void @output_char(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i64
store i64 %4, i64* inttoptr (i64 4294967816 to i64*)
ret void
}

LLVM IR (-O2):
define void @output_char(i8 signext %0) {
%2 = sext i8 %0 to i64
store i64 %2, i64* inttoptr (i64 4294967816 to i64*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void fcyan(void) { fputs("\033[0;36m", stdout); }


x86 assembly (clang, -O0):
<fcyan>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <fputs@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fcyan>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
lea    0xee0(%rip),%rdi
jmp    1030 <fputs@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"\1B[0;36m\00"
@stdout = global i32 0
define void @fcyan() {
%1 = load i32, i32* @stdout
%2 = call i32 @fputs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"\1B[0;36m\00"
@stdout = global i32 0
define void @fcyan() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
int main(int argc, const char *argv[]) {
  float weight;
  weight = 14.2;
  printf("The turkey weighs %f.\n", weight);
  float cookingTime;
  cookingTime = 15.0 + 15.0 * weight;
  printf("Cook it for %f minutes.\n", cookingTime);
  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)
movss  0xeda(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeab(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef0(%rip),%rdi
movss  0xee0(%rip),%xmm0
call   1030 <printf@plt>
lea    0xef3(%rip),%rdi
movss  0xed0(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"The turkey weighs %f.\0A\00"
@.str.1 = [25 x i8] c"Cook it for %f minutes.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float
%7 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store float 0x402C666660000000, float* %6
%8 = load float, float* %6
%9 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), float %8)
%10 = load float, float* %6
%11 = fpext float %10 to double
%12 = call double @llvm.fmuladd.f64(double 1.500000e+01, double %11, double 1.500000e+01)
%13 = fptrunc double %12 to float
store float %13, float* %7
%14 = load float, float* %7
%15 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), float %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"The turkey weighs %f.\0A\00"
@.str.1 = [25 x i8] c"Cook it for %f minutes.\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), float 0x402C666660000000)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), float 2.280000e+02)
ret i32 0
}
void *tmq_thread(void *args __attribute__((unused))) { return (void *)-1; }


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

x86 assembly (clang, -O2):
<tmq_thread>:
mov    $0xffffffffffffffff,%rax
ret

LLVM IR (-O0):
define i8* @tmq_thread(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret i8* inttoptr (i64 -1 to i8*)
}

LLVM IR (-O2):
define i8* @tmq_thread(i8* nocapture readnone %0) {
ret i8* inttoptr (i64 -1 to i8*)
}
/* Variables and functions */
int /*<<< orphan*/ _clause(char const **);
int _symbolic_mode(char const **mode) {
  _clause(mode);
  while (**mode == ',') {
    (*mode)++;
    _clause(mode);
  }
  return **mode == '\0' ? 0 : 1;
}


x86 assembly (clang, -O0):
<_symbolic_mode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <_clause@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2c,%eax
jne    1154 <_symbolic_mode+0x44>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rdi
call   1030 <_clause@plt>
jmp    1125 <_symbolic_mode+0x15>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_symbolic_mode>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
call   1030 <_clause@plt>
mov    (%rbx),%rax
movzbl (%rax),%ecx
cmp    $0x2c,%cl
jne    113c <_symbolic_mode+0x2c>
add    $0x1,%rax
mov    %rax,(%rbx)
mov    %rbx,%rdi
jmp    1120 <_symbolic_mode+0x10>
xor    %eax,%eax
test   %cl,%cl
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @_symbolic_mode(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = call i32 @_clause(i8** %3)
br label %5
5: ; preds = %11, %1
%6 = load i8**, i8*** %2
%7 = load i8*, i8** %6
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 44
br i1 %10, label %11, label %17
11: ; preds = %5
%12 = load i8**, i8*** %2
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %12
%15 = load i8**, i8*** %2
%16 = call i32 @_clause(i8** %15)
br label %5
17: ; preds = %5
%18 = load i8**, i8*** %2
%19 = load i8*, i8** %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 0
%23 = zext i1 %22 to i64
%24 = select i1 %22, i32 0, i32 1
ret i32 %24
}

LLVM IR (-O2):
define i32 @_symbolic_mode(i8** %0) {
%2 = tail call i32 @_clause(i8** %0)
%3 = load i8*, i8** %0
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 44
br i1 %5, label %6, label %13
6: ; preds = %1, %6
%7 = phi i8* [ %10, %6 ], [ %3, %1 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
store i8* %8, i8** %0
%9 = tail call i32 @_clause(i8** %0)
%10 = load i8*, i8** %0
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 44
br i1 %12, label %6, label %13
13: ; preds = %6, %1
%14 = phi i8 [ %4, %1 ], [ %11, %6 ]
%15 = icmp ne i8 %14, 0
%16 = zext i1 %15 to i32
ret i32 %16
}
/* Variables and functions */
int barriereNatif32(int);
scalar_t__ systemeBigEndian();
int little32VersNatif(int little) {
  if (systemeBigEndian()) {
    return barriereNatif32(little);
  } else {
    return little;
  }
}


x86 assembly (clang, -O0):
<little32VersNatif>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <systemeBigEndian@plt>
cmp    $0x0,%rax
je     114c <little32VersNatif+0x2c>
mov    -0x8(%rbp),%edi
call   1040 <barriereNatif32@plt>
mov    %eax,-0x4(%rbp)
jmp    1152 <little32VersNatif+0x32>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<little32VersNatif>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <systemeBigEndian@plt>
test   %rax,%rax
je     1137 <little32VersNatif+0x17>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <barriereNatif32@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @little32VersNatif(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i64 (...) @systemeBigEndian()
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %3
%8 = call i32 @barriereNatif32(i32 %7)
store i32 %8, i32* %2
br label %11
9: ; preds = %1
%10 = load i32, i32* %3
store i32 %10, i32* %2
br label %11
11: ; preds = %9, %6
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @little32VersNatif(i32 %0) {
%2 = tail call i64 (...) @systemeBigEndian()
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @barriereNatif32(i32 %0)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ %0, %1 ]
ret i32 %7
}
_Complex int f3(void) {
  int x;
  return x;
}


x86 assembly (clang, -O0):
<f3>:
push   %rbp
mov    %rsp,%rbp
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @f3() {
%1 = alloca { i32, i32 }
%2 = alloca i32
%3 = load i32, i32* %2
%4 = getelementptr inbounds { i32, i32 }, { i32, i32 }* %1, i32 0, i32 0
%5 = getelementptr inbounds { i32, i32 }, { i32, i32 }* %1, i32 0, i32 1
store i32 %3, i32* %4
store i32 0, i32* %5
%6 = bitcast { i32, i32 }* %1 to i64*
%7 = load i64, i64* %6
ret i64 %7
}

LLVM IR (-O2):
define i64 @f3() {
ret i64 0
}
/* Variables and functions */
void stub1(int);
void testClosureIrV(void (*closure)(int), int a1) {
  if (closure != NULL)
    (*closure)(a1);
}


x86 assembly (clang, -O0):
<testClosureIrV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1123 <testClosureIrV+0x23>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%edi
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testClosureIrV>:
test   %rdi,%rdi
je     110c <testClosureIrV+0xc>
mov    %rdi,%rax
mov    %esi,%edi
jmp    *%rax
ret

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

LLVM IR (-O2):
define void @testClosureIrV(void (i32)* %0, i32 %1) {
%3 = icmp eq void (i32)* %0, null
br i1 %3, label %5, label %4
4: ; preds = %2
tail call void %0(i32 %1)
br label %5
5: ; preds = %4, %2
ret void
}
int is_memload(int opcode) { return (opcode & 0xF8) == 0x20; }


x86 assembly (clang, -O0):
<is_memload>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf8,%eax
cmp    $0x20,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_memload>:
and    $0xf8,%edi
xor    %eax,%eax
cmp    $0x20,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @is_memload(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 248
%5 = icmp eq i32 %4, 32
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @is_memload(i32 %0) {
%2 = and i32 %0, 248
%3 = icmp eq i32 %2, 32
%4 = zext i1 %3 to i32
ret i32 %4
}
void log_close() {}


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

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

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

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