xunge/DecIR huggingface dataset:
void swap(int *num1, int *num2) {
  int t = *num1;
  *num1 = *num2;
  *num2 = t;
}


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

x86 assembly (clang, -O2):
<swap>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
mov    %ecx,(%rdi)
mov    %eax,(%rsi)
ret

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

LLVM IR (-O2):
define void @swap(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
store i32 %4, i32* %0
store i32 %3, i32* %1
ret void
}
int compare_up(const void *num1, const void *num2) {
  return (*(int *)num1 - *(int *)num2);
}


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

x86 assembly (clang, -O2):
<compare_up>:
mov    (%rdi),%eax
sub    (%rsi),%eax
ret

LLVM IR (-O0):
define i32 @compare_up(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 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @compare_up(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
void fortranprintd_(double *val) {}


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

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

LLVM IR (-O0):
define void @fortranprintd_(double* %0) {
%2 = alloca double*
store double* %0, double** %2
ret void
}

LLVM IR (-O2):
define void @fortranprintd_(double* nocapture %0) {
ret void
}
int min_int(int x, int y) {
  if (x < y)
    return x;
  else
    return y;
}


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

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

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

LLVM IR (-O2):
define i32 @min_int(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
int printit(const char *str) {
  printf("[%s]\n", str);
  return 0;
}


x86 assembly (clang, -O0):
<printit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"[%s]\0A\00"
define i32 @printit(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ rp_Release();
void end_acq() { rp_Release(); }


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

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

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

LLVM IR (-O2):
define void @end_acq() {
%1 = tail call i32 (...) @rp_Release()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char *, unsigned int);
double to_double(char *);
double to_n_double(char *buffer, unsigned int size) {
  char copy[10 + 1] = {
      0,
  };
  memcpy(copy, buffer, (((size) < (10 + 1)) ? (size) : (10 + 1)));
  return to_double(copy);
}


x86 assembly (clang, -O0):
<to_n_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x17(%rbp),%rdi
xor    %esi,%esi
mov    $0xb,%edx
call   1030 <memset@plt>
lea    -0x17(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpl   $0xb,-0xc(%rbp)
jae    1174 <to_n_double+0x44>
mov    -0xc(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    1181 <to_n_double+0x51>
mov    $0xb,%eax
mov    %eax,-0x2c(%rbp)
jmp    1181 <to_n_double+0x51>
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%edx
call   1040 <memcpy@plt>
lea    -0x17(%rbp),%rdi
call   1050 <to_double@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_n_double>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rax
movl   $0x0,0x7(%rsp)
movq   $0x0,(%rsp)
cmp    $0xb,%esi
mov    $0xb,%edx
cmovb  %esi,%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <memcpy@plt>
mov    %rbx,%rdi
call   1040 <to_double@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @to_n_double(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [11 x i8]
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = bitcast [11 x i8]* %5 to i8*
%7 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 0
%8 = load i8*, i8** %3
%9 = load i32, i32* %4
%10 = icmp ult i32 %9, 11
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = load i32, i32* %4
br label %14
13: ; preds = %2
br label %14
14: ; preds = %13, %11
%15 = phi i32 [ %12, %11 ], [ 11, %13 ]
%16 = call i32 @memcpy(i8* %7, i8* %8, i32 %15)
%17 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 0
%18 = call double @to_double(i8* %17)
ret double %18
}

LLVM IR (-O2):
define double @to_n_double(i8* %0, i32 %1) {
%3 = alloca [11 x i8]
%4 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 0
%5 = icmp ult i32 %1, 11
%6 = select i1 %5, i32 %1, i32 11
%7 = call i32 @memcpy(i8* %4, i8* %0, i32 %6)
%8 = call double @to_double(i8* %4)
ret double %8
}
/* Variables and functions */
int d_get_codeword(int);
unsigned char d_get_root(int);
int /*<<< orphan*/ s_init();
int /*<<< orphan*/ s_push(unsigned char);
void get_string(int codeword) {
  unsigned char root;
  int current_codeword;
  current_codeword = codeword;
  s_init();
  while (current_codeword > 0xff) {
    root = d_get_root(current_codeword);
    current_codeword = d_get_codeword(current_codeword);
    s_push(root);
  }
  s_push((unsigned char)current_codeword);
}


x86 assembly (clang, -O0):
<get_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1060 <s_init@plt>
cmpl   $0xff,-0xc(%rbp)
jle    1189 <get_string+0x49>
mov    -0xc(%rbp),%edi
call   1050 <d_get_root@plt>
mov    %al,-0x5(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <d_get_codeword@plt>
mov    %eax,-0xc(%rbp)
movzbl -0x5(%rbp),%edi
call   1040 <s_push@plt>
jmp    1158 <get_string+0x18>
mov    -0xc(%rbp),%eax
movzbl %al,%edi
call   1040 <s_push@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_string>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %eax,%eax
call   1060 <s_init@plt>
cmp    $0x100,%ebx
jl     1183 <get_string+0x43>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebx,%edi
call   1050 <d_get_root@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1030 <d_get_codeword@plt>
mov    %eax,%ebx
movzbl %bpl,%edi
call   1040 <s_push@plt>
cmp    $0xff,%ebx
jg     1160 <get_string+0x20>
movzbl %bl,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <s_push@plt>

LLVM IR (-O0):
define void @get_string(i32 %0) {
%2 = alloca i32
%3 = alloca i8
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
store i32 %5, i32* %4
%6 = call i32 (...) @s_init()
br label %7
7: ; preds = %10, %1
%8 = load i32, i32* %4
%9 = icmp sgt i32 %8, 255
br i1 %9, label %10, label %17
10: ; preds = %7
%11 = load i32, i32* %4
%12 = call zeroext i8 @d_get_root(i32 %11)
store i8 %12, i8* %3
%13 = load i32, i32* %4
%14 = call i32 @d_get_codeword(i32 %13)
store i32 %14, i32* %4
%15 = load i8, i8* %3
%16 = call i32 @s_push(i8 zeroext %15)
br label %7
17: ; preds = %7
%18 = load i32, i32* %4
%19 = trunc i32 %18 to i8
%20 = call i32 @s_push(i8 zeroext %19)
ret void
}

LLVM IR (-O2):
define void @get_string(i32 %0) {
%2 = tail call i32 (...) @s_init()
%3 = icmp sgt i32 %0, 255
br i1 %3, label %4, label %10
4: ; preds = %1, %4
%5 = phi i32 [ %7, %4 ], [ %0, %1 ]
%6 = tail call zeroext i8 @d_get_root(i32 %5)
%7 = tail call i32 @d_get_codeword(i32 %5)
%8 = tail call i32 @s_push(i8 zeroext %6)
%9 = icmp sgt i32 %7, 255
br i1 %9, label %4, label %10
10: ; preds = %4, %1
%11 = phi i32 [ %0, %1 ], [ %7, %4 ]
%12 = trunc i32 %11 to i8
%13 = tail call i32 @s_push(i8 zeroext %12)
ret void
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int, int);
void replicate_get_missing_name(char *buff, int32_t pid, int32_t fd) {
  static int i = 0;
  sprintf(buff, "UNKNOWN_FILE_%06d_%06d", pid, fd);
  i++;
}


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

x86 assembly (clang, -O2):
<replicate_get_missing_name>:
push   %rax
mov    %edx,%ecx
mov    %esi,%edx
lea    0xee4(%rip),%rsi
call   1030 <sprintf@plt>
addl   $0x1,0x2f04(%rip)
pop    %rax
ret

LLVM IR (-O0):
@replicate_get_missing_name.i = internal global i32 0
@.str = [23 x i8] c"UNKNOWN_FILE_%06d_%06d\00"
define void @replicate_get_missing_name(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 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
%11 = load i32, i32* @replicate_get_missing_name.i
%12 = add nsw i32 %11, 1
store i32 %12, i32* @replicate_get_missing_name.i
ret void
}

LLVM IR (-O2):
@replicate_get_missing_name.i = internal unnamed_addr global i32 0
@.str = [23 x i8] c"UNKNOWN_FILE_%06d_%06d\00"
define void @replicate_get_missing_name(i8* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
%5 = load i32, i32* @replicate_get_missing_name.i
%6 = add nsw i32 %5, 1
store i32 %6, i32* @replicate_get_missing_name.i
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ fs_univ_undel(int /*<<< orphan*/, int /*<<< orphan*/,
                                 int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ main_time();
uint8_t fs_undel(uint32_t rootinode, uint8_t sesflags, uint32_t inode) {
  return fs_univ_undel(main_time(), rootinode, sesflags, inode);
}


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

x86 assembly (clang, -O2):
<fs_undel>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <main_time@plt>
mov    %eax,%edi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <fs_univ_undel@plt>

LLVM IR (-O0):
define i32 @fs_undel(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = call i32 (...) @main_time()
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call i32 @fs_univ_undel(i32 %7, i32 %8, i32 %9, i32 %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @fs_undel(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 (...) @main_time()
%5 = tail call i32 @fs_univ_undel(i32 %4, i32 %0, i32 %1, i32 %2)
ret i32 %5
}
char *te_getvowel(char *t) {
  if (t[0] == 'c') {
    return (++t);
  } else {
    return (t);
  }
}


x86 assembly (clang, -O0):
<te_getvowel>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x63,%eax
jne    112d <te_getvowel+0x2d>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    %rax,-0x8(%rbp)
jmp    1135 <te_getvowel+0x35>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<te_getvowel>:
xor    %eax,%eax
cmpb   $0x63,(%rdi)
sete   %al
add    %rdi,%rax
ret

LLVM IR (-O0):
define i8* @te_getvowel(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 99
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %3
store i8* %11, i8** %2
br label %14
12: ; preds = %1
%13 = load i8*, i8** %3
store i8* %13, i8** %2
br label %14
14: ; preds = %12, %9
%15 = load i8*, i8** %2
ret i8* %15
}

LLVM IR (-O2):
define i8* @te_getvowel(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 99
%4 = zext i1 %3 to i64
%5 = getelementptr i8, i8* %0, i64 %4
ret i8* %5
}
/* Type definitions */
typedef scalar_t__ pid_t;

/* Variables and functions */
scalar_t__ fork();
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ waitpid(scalar_t__, int /*<<< orphan*/ *,
                           int /*<<< orphan*/);
int main(void) {
  pid_t pid;
  pid = fork();
  printf("%s", pid == 0 ? "X" : "XX");
  if (pid != 0)
    waitpid(pid, NULL, 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <fork@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
lea    0xeae(%rip),%rsi
lea    0xea8(%rip),%rax
cmp    $0x0,%rcx
cmove  %rax,%rsi
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
cmpq   $0x0,-0x10(%rbp)
je     118a <main+0x5a>
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1040 <waitpid@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1050 <fork@plt>
mov    %rax,%rbx
test   %rax,%rax
lea    0xebf(%rip),%rax
lea    0xeb7(%rip),%rsi
cmove  %rax,%rsi
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
test   %rbx,%rbx
je     116d <main+0x3d>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <waitpid@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [2 x i8] c"X\00"
@.str.2 = [3 x i8] c"XX\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
store i32 0, i32* %1
%3 = call i64 (...) @fork()
store i64 %3, i64* %2
%4 = load i64, i64* %2
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%8 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = load i64, i64* %2
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %0
%12 = load i64, i64* %2
%13 = call i32 @waitpid(i64 %12, i32* null, i32 0)
br label %14
14: ; preds = %11, %0
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [2 x i8] c"X\00"
@.str.2 = [3 x i8] c"XX\00"
define i32 @main() {
%1 = tail call i64 (...) @fork()
%2 = icmp eq i64 %1, 0
%3 = select i1 %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
br i1 %2, label %7, label %5
5: ; preds = %0
%6 = tail call i32 @waitpid(i64 %1, i32* null, i32 0)
br label %7
7: ; preds = %5, %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ scanf(char *, float *);
main() {
  float kelvin;
  scanf("%f", &kelvin);
  printf("%f", kelvin - 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
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeb0(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xedc(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xeb5(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %2)
%4 = load float, float* %2
%5 = fpext float %4 to double
%6 = fsub double %5, 2.731500e+02
%7 = fptrunc double %6 to float
%8 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
%4 = load float, float* %1
%5 = fpext float %4 to double
%6 = fadd double %5, -2.731500e+02
%7 = fptrunc double %6 to float
%8 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float %7)
ret i32 0
}
main() { int x[10] = {5}; }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = bitcast i8* %2 to <{ i32, [9 x i32] }>*
%4 = getelementptr inbounds <{ i32, [9 x i32] }>, <{ i32, [9 x i32] }>* %3, i32 0, i32 0
store i32 5, i32* %4
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
unsigned char is_any(const char c) { return (c >= 32 && c <= 122) ? 1 : 0; }


x86 assembly (clang, -O0):
<is_any>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x2(%rbp)
jl     1129 <is_any+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x7a,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_any>:
add    $0xe0,%dil
cmp    $0x5b,%dil
setb   %al
ret

LLVM IR (-O0):
define zeroext i8 @is_any(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 32
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 122
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i64
%13 = select i1 %11, i32 1, i32 0
%14 = trunc i32 %13 to i8
ret i8 %14
}

LLVM IR (-O2):
define zeroext i8 @is_any(i8 signext %0) {
%2 = add i8 %0, -32
%3 = icmp ult i8 %2, 91
%4 = zext i1 %3 to i8
ret i8 %4
}
/* Type definitions */
struct wl_resource {
  int dummy;
};
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ wl_resource_post_event(struct wl_resource *, int,
                                          char const *, int /*<<< orphan*/);
void wl_data_source_send_send(struct wl_resource *resource_,
                              const char *mime_type, int32_t fd) {
  wl_resource_post_event(resource_, 1, mime_type, fd);
}


x86 assembly (clang, -O0):
<wl_data_source_send_send>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    $0x1,%esi
call   1030 <wl_resource_post_event@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wl_data_source_send_send>:
mov    %edx,%ecx
mov    %rsi,%rdx
mov    $0x1,%esi
jmp    1030 <wl_resource_post_event@plt>

LLVM IR (-O0):
%struct.wl_resource = type { i32 }
define void @wl_data_source_send_send(%struct.wl_resource* %0, i8* %1, i32 %2) {
%4 = alloca %struct.wl_resource*
%5 = alloca i8*
%6 = alloca i32
store %struct.wl_resource* %0, %struct.wl_resource** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load %struct.wl_resource*, %struct.wl_resource** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @wl_resource_post_event(%struct.wl_resource* %7, i32 1, i8* %8, i32 %9)
ret void
}

LLVM IR (-O2):
%struct.wl_resource = type { i32 }
define void @wl_data_source_send_send(%struct.wl_resource* %0, i8* %1, i32 %2) {
%4 = tail call i32 @wl_resource_post_event(%struct.wl_resource* %0, i32 1, i8* %1, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ put32(unsigned long);
int /*<<< orphan*/ put8(int);
void push_imm32(unsigned long imm32) {
  put8(0x68);
  put32(imm32);
}


x86 assembly (clang, -O0):
<push_imm32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x68,%edi
call   1030 <put8@plt>
mov    -0x8(%rbp),%rdi
call   1040 <put32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<push_imm32>:
push   %rbx
mov    %rdi,%rbx
mov    $0x68,%edi
call   1030 <put8@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <put32@plt>

LLVM IR (-O0):
define void @push_imm32(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = call i32 @put8(i32 104)
%4 = load i64, i64* %2
%5 = call i32 @put32(i64 %4)
ret void
}

LLVM IR (-O2):
define void @push_imm32(i64 %0) {
%2 = tail call i32 @put8(i32 104)
%3 = tail call i32 @put32(i64 %0)
ret void
}
void foo753(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo753(i32 %0) {
ret void
}
/* Variables and functions */
scalar_t__ TaskScheduler_DoUsart();
int /*<<< orphan*/ UsartHardware_TransmitString(char *);
char *UsartModel_GetFormattedTemperature();
void UsartConductor_Run(void) {
  char *temp;
  if (TaskScheduler_DoUsart()) {
    temp = UsartModel_GetFormattedTemperature();
    UsartHardware_TransmitString(temp);
  }
}


x86 assembly (clang, -O0):
<UsartConductor_Run>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <TaskScheduler_DoUsart@plt>
cmp    $0x0,%rax
je     115d <UsartConductor_Run+0x2d>
mov    $0x0,%al
call   1040 <UsartModel_GetFormattedTemperature@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <UsartHardware_TransmitString@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UsartConductor_Run>:
push   %rax
xor    %eax,%eax
call   1050 <TaskScheduler_DoUsart@plt>
test   %rax,%rax
je     114d <UsartConductor_Run+0x1d>
xor    %eax,%eax
call   1040 <UsartModel_GetFormattedTemperature@plt>
mov    %rax,%rdi
pop    %rax
jmp    1030 <UsartHardware_TransmitString@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @UsartConductor_Run() {
%1 = alloca i8*
%2 = call i64 (...) @TaskScheduler_DoUsart()
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %0
%5 = call i8* (...) @UsartModel_GetFormattedTemperature()
store i8* %5, i8** %1
%6 = load i8*, i8** %1
%7 = call i32 @UsartHardware_TransmitString(i8* %6)
br label %8
8: ; preds = %4, %0
ret void
}

LLVM IR (-O2):
define void @UsartConductor_Run() {
%1 = tail call i64 (...) @TaskScheduler_DoUsart()
%2 = icmp eq i64 %1, 0
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = tail call i8* (...) @UsartModel_GetFormattedTemperature()
%5 = tail call i32 @UsartHardware_TransmitString(i8* %4)
br label %6
6: ; preds = %3, %0
ret void
}
int main() {
  char c$1 = 1;
  signed char sc$1 = 2;
  unsigned char uc$1 = 3u;
  short s$1 = 4;
  unsigned short us$1 = 5u;
  int i$1 = 6;
  unsigned int u$1 = 7u;
  long l$1 = 8;
  unsigned long lu$1 = 9u;
  long long ll$1 = 10ll;
  unsigned long long ull$1 = 10ull;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movb   $0x1,-0x1(%rbp)
movb   $0x2,-0x2(%rbp)
movb   $0x3,-0x3(%rbp)
movw   $0x4,-0x6(%rbp)
movw   $0x5,-0x8(%rbp)
movl   $0x6,-0xc(%rbp)
movl   $0x7,-0x10(%rbp)
movq   $0x8,-0x18(%rbp)
movq   $0x9,-0x20(%rbp)
movq   $0xa,-0x28(%rbp)
movq   $0xa,-0x30(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i8
%2 = alloca i8
%3 = alloca i8
%4 = alloca i16
%5 = alloca i16
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
store i8 1, i8* %1
store i8 2, i8* %2
store i8 3, i8* %3
store i16 4, i16* %4
store i16 5, i16* %5
store i32 6, i32* %6
store i32 7, i32* %7
store i64 8, i64* %8
store i64 9, i64* %9
store i64 10, i64* %10
store i64 10, i64* %11
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t rev_byte(uint8_t b) {
  b = (b & 0xF0) >> 4 | (b & 0x0F) << 4;
  b = (b & 0xCC) >> 2 | (b & 0x33) << 2;
  b = (b & 0xAA) >> 1 | (b & 0x55) << 1;
  return b;
}


x86 assembly (clang, -O0):
<rev_byte>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf0,%eax
sar    $0x4,%eax
mov    -0x4(%rbp),%ecx
and    $0xf,%ecx
shl    $0x4,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xcc,%eax
sar    $0x2,%eax
mov    -0x4(%rbp),%ecx
and    $0x33,%ecx
shl    $0x2,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xaa,%eax
sar    $0x1,%eax
mov    -0x4(%rbp),%ecx
and    $0x55,%ecx
shl    $0x1,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rev_byte>:
rol    $0x4,%dil
mov    %edi,%eax
and    $0x33,%al
shl    $0x2,%al
shr    $0x2,%dil
and    $0x33,%dil
or     %al,%dil
mov    %edi,%eax
and    $0x55,%al
add    %al,%al
shr    %dil
and    $0x55,%dil
or     %al,%dil
movzbl %dil,%eax
ret

LLVM IR (-O0):
define i32 @rev_byte(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 240
%5 = ashr i32 %4, 4
%6 = load i32, i32* %2
%7 = and i32 %6, 15
%8 = shl i32 %7, 4
%9 = or i32 %5, %8
store i32 %9, i32* %2
%10 = load i32, i32* %2
%11 = and i32 %10, 204
%12 = ashr i32 %11, 2
%13 = load i32, i32* %2
%14 = and i32 %13, 51
%15 = shl i32 %14, 2
%16 = or i32 %12, %15
store i32 %16, i32* %2
%17 = load i32, i32* %2
%18 = and i32 %17, 170
%19 = ashr i32 %18, 1
%20 = load i32, i32* %2
%21 = and i32 %20, 85
%22 = shl i32 %21, 1
%23 = or i32 %19, %22
store i32 %23, i32* %2
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
define i32 @rev_byte(i32 %0) {
%2 = trunc i32 %0 to i8
%3 = tail call i8 @llvm.bitreverse.i8(i8 %2)
%4 = zext i8 %3 to i32
ret i32 %4
}
void *thread_1(void *arg) {
  printf("fun = %s thread_id = %u, arg = %d \n", __func__, (int)pthread_self(),
         (int)(long)arg);
}


x86 assembly (clang, -O0):
<thread_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <pthread_self@plt>
mov    %eax,%edx
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
lea    0xebe(%rip),%rdi
lea    0xedb(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread_1>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <pthread_self@plt>
lea    0xece(%rip),%rdi
lea    0xeeb(%rip),%rsi
mov    %eax,%edx
mov    %ebx,%ecx
xor    %eax,%eax
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"fun = %s thread_id = %u, arg = %d \0A\00"
@__func__.thread_1 = [9 x i8] c"thread_1\00"
define i8* @thread_1(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = call i32 (...) @pthread_self()
%5 = load i8*, i8** %3
%6 = ptrtoint i8* %5 to i64
%7 = trunc i64 %6 to i32
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__func__.thread_1, i64 0, i64 0), i32 %4, i32 %7)
%9 = load i8*, i8** %2
ret i8* %9
}

LLVM IR (-O2):
@.str = [36 x i8] c"fun = %s thread_id = %u, arg = %d \0A\00"
@__func__.thread_1 = [9 x i8] c"thread_1\00"
define noalias i8* @thread_1(i8* %0) {
%2 = tail call i32 (...) @pthread_self()
%3 = ptrtoint i8* %0 to i64
%4 = trunc i64 %3 to i32
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__func__.thread_1, i64 0, i64 0), i32 %2, i32 %4)
ret i8* undef
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int64_t cfs_stub_fremovexattr(int fd, const char *name) {
  errno = ENOSYS;
  return -1;
}


x86 assembly (clang, -O0):
<cfs_stub_fremovexattr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ed6(%rip),%rax
mov    (%rax),%ecx
mov    0x2ebd(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @cfs_stub_fremovexattr(i32 %0, i8* nocapture readnone %1) {
%3 = load i32, i32* @ENOSYS
store i32 %3, i32* @errno
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ usleep_range(unsigned long, unsigned long);
void usleep(unsigned long usecs) { usleep_range(usecs, usecs); }


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

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

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

LLVM IR (-O2):
define void @usleep(i64 %0) {
%2 = tail call i32 @usleep_range(i64 %0, i64 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gl_histadd(char *);
void cAddHist(char *line) { gl_histadd(line); }


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

x86 assembly (clang, -O2):
<cAddHist>:
jmp    1030 <gl_histadd@plt>

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

LLVM IR (-O2):
define void @cAddHist(i8* %0) {
%2 = tail call i32 @gl_histadd(i8* %0)
ret void
}
void x1(void) {
  void x2(void);
  x2();
}


x86 assembly (clang, -O0):
<x1>:
push   %rbp
mov    %rsp,%rbp
call   1030 <x2@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<x1>:
jmp    1030 <x2@plt>

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

LLVM IR (-O2):
define void @x1() {
tail call void @x2()
ret void
}
/* Type definitions */
typedef scalar_t__ pid_t;

/* Variables and functions */
int /*<<< orphan*/ parent_log(char *, ...);
scalar_t__ waitpid(scalar_t__, int *, int /*<<< orphan*/);
int wait_for_process(pid_t pid) {
  int child_exit_status;
  while (waitpid(pid, &child_exit_status, 0) != pid) {
  }
  parent_log("Parent: Child exit status%d\n", child_exit_status);
  parent_log("Parent: Done waiting\n");
  return child_exit_status;
}


x86 assembly (clang, -O0):
<wait_for_process>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
xor    %edx,%edx
call   1030 <waitpid@plt>
cmp    -0x8(%rbp),%rax
je     114a <wait_for_process+0x2a>
jmp    112c <wait_for_process+0xc>
mov    -0xc(%rbp),%esi
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1040 <parent_log@plt>
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1040 <parent_log@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_for_process>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0x4(%rsp),%r14
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1030 <waitpid@plt>
cmp    %rbx,%rax
jne    1130 <wait_for_process+0x10>
mov    0x4(%rsp),%esi
lea    0xeb3(%rip),%rdi
xor    %eax,%eax
call   1040 <parent_log@plt>
lea    0xec2(%rip),%rdi
xor    %eax,%eax
call   1040 <parent_log@plt>
mov    0x4(%rsp),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Parent: Child exit status%d\0A\00"
@.str.1 = [22 x i8] c"Parent: Done waiting\0A\00"
define i32 @wait_for_process(i64 %0) {
%2 = alloca i64
%3 = alloca i32
store i64 %0, i64* %2
br label %4
4: ; preds = %9, %1
%5 = load i64, i64* %2
%6 = call i64 @waitpid(i64 %5, i32* %3, i32 0)
%7 = load i64, i64* %2
%8 = icmp ne i64 %6, %7
br i1 %8, label %9, label %10
9: ; preds = %4
br label %4
10: ; preds = %4
%11 = load i32, i32* %3
%12 = call i32 (i8*, ...) @parent_log(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = call i32 (i8*, ...) @parent_log(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
@.str = [29 x i8] c"Parent: Child exit status%d\0A\00"
@.str.1 = [22 x i8] c"Parent: Done waiting\0A\00"
define i32 @wait_for_process(i64 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
br label %4
4: ; preds = %4, %1
%5 = call i64 @waitpid(i64 %0, i32* %2, i32 0)
%6 = icmp eq i64 %5, %0
br i1 %6, label %7, label %4
7: ; preds = %4
%8 = load i32, i32* %2
%9 = call i32 (i8*, ...) @parent_log(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 (i8*, ...) @parent_log(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32, i32* %2
ret i32 %11
}
int fswap(a, b)
short *a, *b;
{
  short temp;
  temp = *a;
  *a = *b;
  *b = temp;
  return (1);
}


x86 assembly (clang, -O0):
<fswap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ax
mov    %ax,-0x12(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%cx
mov    -0x8(%rbp),%rax
mov    %cx,(%rax)
mov    -0x12(%rbp),%cx
mov    -0x10(%rbp),%rax
mov    %cx,(%rax)
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fswap>:
movzwl (%rdi),%eax
movzwl (%rsi),%ecx
mov    %cx,(%rdi)
mov    %ax,(%rsi)
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @fswap(i16* nocapture %0, i16* nocapture %1) {
%3 = load i16, i16* %0
%4 = load i16, i16* %1
store i16 %4, i16* %0
store i16 %3, i16* %1
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ disable_interrupts();
int /*<<< orphan*/ wait_for_interrupts();
void freeze_system(void) {
  disable_interrupts();
  for (;;)
    wait_for_interrupts();
}


x86 assembly (clang, -O0):
<freeze_system>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <disable_interrupts@plt>
mov    $0x0,%al
call   1030 <wait_for_interrupts@plt>
jmp    112b <freeze_system+0xb>

x86 assembly (clang, -O2):
<freeze_system>:
push   %rax
xor    %eax,%eax
call   1040 <disable_interrupts@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <wait_for_interrupts@plt>
jmp    1130 <freeze_system+0x10>

LLVM IR (-O0):
define void @freeze_system() {
%1 = call i32 (...) @disable_interrupts()
br label %2
2: ; preds = %2, %0
%3 = call i32 (...) @wait_for_interrupts()
br label %2
}

LLVM IR (-O2):
define void @freeze_system() {
%1 = tail call i32 (...) @disable_interrupts()
br label %2
2: ; preds = %2, %0
%3 = tail call i32 (...) @wait_for_interrupts()
br label %2
}
/* Variables and functions */
int /*<<< orphan*/ gmx_densorder(int, char **);
int main(int argc, char *argv[]) {
  gmx_densorder(argc, argv);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @gmx_densorder(i32 %0, i8** %1)
ret i32 0
}
/* Variables and functions */
char strcmp(char *, char *);
char action_eql(void *a, void *b) { return strcmp((char *)a, (char *)b); }


x86 assembly (clang, -O0):
<action_eql>:
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>
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i8 @action_eql(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 signext i8 @strcmp(i8* %5, i8* %6)
ret i8 %7
}

LLVM IR (-O2):
define signext i8 @action_eql(i8* %0, i8* %1) {
%3 = tail call signext i8 @strcmp(i8* %0, i8* %1)
ret i8 %3
}
int serial_region() { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @serial_region() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void PrintNum(int n) { printf("Test1 is called, the num is %d\n", n); }


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

x86 assembly (clang, -O2):
<PrintNum>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"Test1 is called, the num is %d\0A\00"
define void @PrintNum(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"Test1 is called, the num is %d\0A\00"
define void @PrintNum(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int foo();
__attribute__((no)) int bar() { return foo(); }


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

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

LLVM IR (-O0):
define i32 @bar() {
%1 = call i32 (...) @foo()
ret i32 %1
}

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


x86 assembly (clang, -O0):
<M307_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):
<M307_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"M307_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M307_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"M307_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M307_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
}
int test_imm_7Buint16_reg(unsigned short val) {
  return ((val) & (-0x7B << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_7Buint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xffffff85,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_7Buint16_reg>:
test   $0xff85,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_7Buint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -123
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int sonIguales(int mat1[2], int mat2[2]) {
  int var = 0;
  for (int j = 0; j < 2; ++j) {
    if (mat1[j] == mat2[j])
      var++;
  }
  return var;
}


x86 assembly (clang, -O0):
<sonIguales>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x2,-0x18(%rbp)
jge    115c <sonIguales+0x5c>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x10(%rbp),%rcx
movslq -0x18(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jne    1149 <sonIguales+0x49>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114e <sonIguales+0x4e>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    111a <sonIguales+0x1a>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sonIguales>:
movq   (%rdi),%xmm0
movq   (%rsi),%xmm1
pcmpeqd %xmm0,%xmm1
movdqa %xmm1,%xmm0
psrld  $0x1f,%xmm0
pshufd $0x55,%xmm0,%xmm0
psubd  %xmm1,%xmm0
movd   %xmm0,%eax
ret

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

LLVM IR (-O2):
define i32 @sonIguales(i32* nocapture %0, i32* nocapture %1) {
%3 = bitcast i32* %0 to <2 x i32>*
%4 = load <2 x i32>, <2 x i32>* %3
%5 = bitcast i32* %1 to <2 x i32>*
%6 = load <2 x i32>, <2 x i32>* %5
%7 = icmp eq <2 x i32> %4, %6
%8 = zext <2 x i1> %7 to <2 x i32>
%9 = shufflevector <2 x i32> %8, <2 x i32> poison, <2 x i32> <i32 1, i32 undef>
%10 = add nuw nsw <2 x i32> %9, %8
%11 = extractelement <2 x i32> %10, i64 0
ret i32 %11
}