xunge/DecIR huggingface dataset:
int hooked_close(int fd) {
  int c = 0;
  ;
  c = close$NOCANCEL$UNIX2003(fd);
  if (c >= 0) {
    ;
  } else {
    ;
  }
  return c;
}


x86 assembly (clang, -O0):
<hooked_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1030 <close$NOCANCEL$UNIX2003@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     113e <hooked_close+0x2e>
jmp    1143 <hooked_close+0x33>
jmp    1143 <hooked_close+0x33>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hooked_close>:
xor    %eax,%eax
jmp    1030 <close$NOCANCEL$UNIX2003@plt>

LLVM IR (-O0):
define i32 @hooked_close(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
%5 = call i32 (i32, ...) bitcast (i32 (...)* @"close$NOCANCEL$UNIX2003" to i32 (i32, ...)*)(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp sge i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
br label %10
9: ; preds = %1
br label %10
10: ; preds = %9, %8
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
define i32 @hooked_close(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @"close$NOCANCEL$UNIX2003" to i32 (i32, ...)*)(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int romanToInt(char *);
void romanToIntMain(void) {
  printf("%d\n", romanToInt("MMMCMXCIX"));
  printf("%d\n", romanToInt("MM"));
  printf("%d\n", romanToInt("MDCCCLXXXVIII"));
}


x86 assembly (clang, -O0):
<romanToIntMain>:
push   %rbp
mov    %rsp,%rbp
lea    0xed9(%rip),%rdi
call   1040 <romanToInt@plt>
mov    %eax,%esi
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
call   1040 <romanToInt@plt>
mov    %eax,%esi
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb2(%rip),%rdi
call   1040 <romanToInt@plt>
mov    %eax,%esi
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<romanToIntMain>:
push   %rbx
lea    0xedc(%rip),%rdi
call   1040 <romanToInt@plt>
lea    0xecc(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
call   1040 <romanToInt@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
call   1040 <romanToInt@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [10 x i8] c"MMMCMXCIX\00"
@.str.2 = [3 x i8] c"MM\00"
@.str.3 = [14 x i8] c"MDCCCLXXXVIII\00"
define void @romanToIntMain() {
%1 = call i32 @romanToInt(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = call i32 @romanToInt(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @romanToInt(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [10 x i8] c"MMMCMXCIX\00"
@.str.2 = [3 x i8] c"MM\00"
@.str.3 = [14 x i8] c"MDCCCLXXXVIII\00"
define void @romanToIntMain() {
%1 = tail call i32 @romanToInt(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @romanToInt(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @romanToInt(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int cmpp_sock_create(void) {
  int fd;
  fd = socket(AF_INET, SOCK_STREAM, 0);
  if (fd < 0) {
    return -1;
  }
  return fd;
}


x86 assembly (clang, -O0):
<cmpp_sock_create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <socket@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    114a <cmpp_sock_create+0x3a>
movl   $0xffffffff,-0x4(%rbp)
jmp    1150 <cmpp_sock_create+0x40>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmpp_sock_create>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
mov    0x2eb7(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <socket@plt>
test   %eax,%eax
mov    $0xffffffff,%ecx
cmovs  %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
define i32 @cmpp_sock_create() {
%1 = load i32, i32* @AF_INET
%2 = load i32, i32* @SOCK_STREAM
%3 = tail call i32 @socket(i32 %1, i32 %2, i32 0)
%4 = icmp sgt i32 %3, -1
%5 = select i1 %4, i32 %3, i32 -1
ret i32 %5
}
double ga_ri(double redchan, double nirchan, double bluechan,
             double greenchan) {
  double result;
  {
    result = (nirchan - (greenchan - (bluechan - redchan))) /
             (nirchan - (greenchan - (bluechan - redchan)));
  }
  return result;
}


x86 assembly (clang, -O0):
<ga_ri>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
subsd  -0x8(%rbp),%xmm2
subsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm3
subsd  -0x8(%rbp),%xmm3
subsd  %xmm3,%xmm2
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ga_ri>:
subsd  %xmm0,%xmm2
subsd  %xmm2,%xmm3
subsd  %xmm3,%xmm1
divsd  %xmm1,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @ga_ri(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%10 = load double, double* %6
%11 = load double, double* %8
%12 = load double, double* %7
%13 = load double, double* %5
%14 = fsub double %12, %13
%15 = fsub double %11, %14
%16 = fsub double %10, %15
%17 = load double, double* %6
%18 = load double, double* %8
%19 = load double, double* %7
%20 = load double, double* %5
%21 = fsub double %19, %20
%22 = fsub double %18, %21
%23 = fsub double %17, %22
%24 = fdiv double %16, %23
store double %24, double* %9
%25 = load double, double* %9
ret double %25
}

LLVM IR (-O2):
define double @ga_ri(double %0, double %1, double %2, double %3) {
%5 = fsub double %2, %0
%6 = fsub double %3, %5
%7 = fsub double %1, %6
%8 = fdiv double %7, %7
ret double %8
}
/* Variables and functions */
int /*<<< orphan*/ munmap(void *, int);
void free_buffer(void *buf, int size) { munmap(buf, size); }


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

x86 assembly (clang, -O2):
<free_buffer>:
jmp    1030 <munmap@plt>

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

LLVM IR (-O2):
define void @free_buffer(i8* %0, i32 %1) {
%3 = tail call i32 @munmap(i8* %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int nuc2num(char s) {
  switch (s) {
  case '\00':
    return 0;
  case '\01':
    return 2;
  case '\10':
    return 3;
  default:
    printf("Error happens in nuc2num(). Please check your input!\n");
    return -1;
  }
}


x86 assembly (clang, -O0):
<nuc2num>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     1154 <nuc2num+0x44>
jmp    1132 <nuc2num+0x22>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
je     1160 <nuc2num+0x50>
jmp    1143 <nuc2num+0x33>
mov    -0xc(%rbp),%eax
sub    $0x8,%eax
je     116c <nuc2num+0x5c>
jmp    1178 <nuc2num+0x68>
movl   $0x0,-0x4(%rbp)
jmp    118b <nuc2num+0x7b>
movl   $0x2,-0x4(%rbp)
jmp    118b <nuc2num+0x7b>
movl   $0x3,-0x4(%rbp)
jmp    118b <nuc2num+0x7b>
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nuc2num>:
mov    %edi,%eax
test   %edi,%edi
je     1142 <nuc2num+0x32>
cmp    $0x8,%eax
je     1126 <nuc2num+0x16>
cmp    $0x1,%eax
jne    112c <nuc2num+0x1c>
mov    $0x2,%eax
ret
mov    $0x3,%eax
ret
push   %rax
lea    0xecc(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
@.str = [54 x i8] c"Error happens in nuc2num(). Please check your input!\0A\00"
define i32 @nuc2num(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %9 [
i32 0, label %6
i32 1, label %7
i32 8, label %8
]
6: ; preds = %1
store i32 0, i32* %2
br label %11
7: ; preds = %1
store i32 2, i32* %2
br label %11
8: ; preds = %1
store i32 3, i32* %2
br label %11
9: ; preds = %1
%10 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %2
br label %11
11: ; preds = %9, %8, %7, %6
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
@str = [53 x i8] c"Error happens in nuc2num(). Please check your input!\00"
define i32 @nuc2num(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %5 [
i32 0, label %7
i32 1, label %3
i32 8, label %4
]
3: ; preds = %1
br label %7
4: ; preds = %1
br label %7
5: ; preds = %1
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str, i64 0, i64 0))
br label %7
7: ; preds = %1, %5, %4, %3
%8 = phi i32 [ -1, %5 ], [ 3, %4 ], [ 2, %3 ], [ %2, %1 ]
ret i32 %8
}
int charcount(char *str, int c) {
  char *cp;
  int i;
  for (i = 0, cp = str; *cp; cp++)
    if (*cp == c)
      i++;
  return (i);
}


x86 assembly (clang, -O0):
<charcount>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1156 <charcount+0x56>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    -0xc(%rbp),%eax
jne    1140 <charcount+0x40>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1145 <charcount+0x45>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    111a <charcount+0x1a>
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<charcount>:
mov    (%rdi),%cl
test   %cl,%cl
je     1128 <charcount+0x28>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
xor    %edx,%edx
cmp    %esi,%ecx
sete   %dl
add    %edx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <charcount+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @charcount(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %14, %5 ], [ %3, %2 ]
%7 = phi i32 [ %12, %5 ], [ 0, %2 ]
%8 = phi i8* [ %13, %5 ], [ %0, %2 ]
%9 = sext i8 %6 to i32
%10 = icmp eq i32 %9, %1
%11 = zext i1 %10 to i32
%12 = add nuw nsw i32 %7, %11
%13 = getelementptr inbounds i8, i8* %8, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %5, %2
%17 = phi i32 [ 0, %2 ], [ %12, %5 ]
ret i32 %17
}
void update_tzname_etc(const struct __state *sp, const struct ttinfo *ttisp) {}


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

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

LLVM IR (-O0):
%struct.__state = type opaque
%struct.ttinfo = type opaque
define void @update_tzname_etc(%struct.__state* %0, %struct.ttinfo* %1) {
%3 = alloca %struct.__state*
%4 = alloca %struct.ttinfo*
store %struct.__state* %0, %struct.__state** %3
store %struct.ttinfo* %1, %struct.ttinfo** %4
ret void
}

LLVM IR (-O2):
%struct.__state = type opaque
%struct.ttinfo = type opaque
define void @update_tzname_etc(%struct.__state* nocapture %0, %struct.ttinfo* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ U_WMRNOTIMPLEMENTED_swap(char *, int);
void U_WMREE_swap(char *record, int torev) {
  U_WMRNOTIMPLEMENTED_swap(record, torev);
}


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

x86 assembly (clang, -O2):
<U_WMREE_swap>:
jmp    1030 <U_WMRNOTIMPLEMENTED_swap@plt>

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

LLVM IR (-O2):
define void @U_WMREE_swap(i8* %0, i32 %1) {
%3 = tail call i32 @U_WMRNOTIMPLEMENTED_swap(i8* %0, i32 %1)
ret void
}
/* Variables and functions */
scalar_t__ random();
int randomCoord(int max) { return (int)random() % (max - 20) + 10; }


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

x86 assembly (clang, -O2):
<randomCoord>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <random@plt>
add    $0xffffffec,%ebx
cltd
idiv   %ebx
lea    0xa(%rdx),%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @randomCoord(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i64 (...) @random()
%4 = trunc i64 %3 to i32
%5 = load i32, i32* %2
%6 = sub nsw i32 %5, 20
%7 = srem i32 %4, %6
%8 = add nsw i32 %7, 10
ret i32 %8
}

LLVM IR (-O2):
define i32 @randomCoord(i32 %0) {
%2 = tail call i64 (...) @random()
%3 = trunc i64 %2 to i32
%4 = add nsw i32 %0, -20
%5 = srem i32 %3, %4
%6 = add nsw i32 %5, 10
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ read(int, unsigned char *, int);
ssize_t readcs(int fd, void *buf, size_t count) {
  ssize_t result = read(fd, buf, count);
  unsigned char checksum[1];
  read(fd, checksum, 1);
  return result;
}


x86 assembly (clang, -O0):
<readcs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    %eax,%edx
call   1030 <read@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x1d(%rbp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readcs>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
call   1030 <read@plt>
mov    %eax,%ebp
lea    0x7(%rsp),%rsi
mov    %ebx,%edi
mov    $0x1,%edx
call   1030 <read@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @readcs(i32 %0, i8* nocapture %1, i64 %2) {
%4 = alloca [1 x i8]
%5 = trunc i64 %2 to i32
%6 = tail call i32 @read(i32 %0, i8* %1, i32 %5)
%7 = getelementptr inbounds [1 x i8], [1 x i8]* %4, i64 0, i64 0
%8 = call i32 @read(i32 %0, i8* %7, i32 1)
ret i32 %6
}
int cmpchar(const void *c1, const void *c2) {
  return *(char *)c1 - *(char *)c2;
}


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

x86 assembly (clang, -O2):
<cmpchar>:
movsbl (%rdi),%eax
movsbl (%rsi),%ecx
sub    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @cmpchar(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = sext i8 %3 to i32
%5 = load i8, i8* %1
%6 = sext i8 %5 to i32
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Variables and functions */
int i2c_smbus_write_word_data(int, int, int);
int hummingboardI2CWriteReg16(int fd, int reg, int data) {
  return i2c_smbus_write_word_data(fd, reg, data);
}


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

x86 assembly (clang, -O2):
<hummingboardI2CWriteReg16>:
jmp    1030 <i2c_smbus_write_word_data@plt>

LLVM IR (-O0):
define i32 @hummingboardI2CWriteReg16(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 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @i2c_smbus_write_word_data(i32 %7, i32 %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @hummingboardI2CWriteReg16(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @i2c_smbus_write_word_data(i32 %0, i32 %1, i32 %2)
ret i32 %4
}
int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buf) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.scsi_disk = type opaque
define i32 @sd_zbc_read_zones(%struct.scsi_disk* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
unsigned xrop3_190_1_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  stk2 = T ^ S;
  stk1 = D | stk2;
  return (stk1 & (~S) & (~T)) | (D & S) | (D & T);
}


x86 assembly (clang, -O0):
<xrop3_190_1_1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x10(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0x10(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_190_1_1>:
mov    %esi,%ecx
or     %edi,%esi
mov    %edi,%eax
shl    $0x8,%eax
shl    $0x8,%ecx
mov    %ecx,%edx
xor    %eax,%edx
or     $0xff,%edx
or     %esi,%eax
or     %ecx,%eax
not    %eax
and    %edx,%eax
or     %esi,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_190_1_1(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%10 = load i8, i8* %3
%11 = zext i8 %10 to i32
%12 = shl i32 %11, 8
%13 = load i8, i8* %3
%14 = zext i8 %13 to i32
%15 = or i32 %12, %14
store i32 %15, i32* %6
%16 = load i8, i8* %4
%17 = zext i8 %16 to i32
%18 = shl i32 %17, 8
%19 = load i8, i8* %4
%20 = zext i8 %19 to i32
%21 = or i32 %18, %20
store i32 %21, i32* %7
%22 = load i32, i32* %7
%23 = load i32, i32* %6
%24 = xor i32 %22, %23
store i32 %24, i32* %9
%25 = load i32, i32* %5
%26 = load i32, i32* %9
%27 = or i32 %25, %26
store i32 %27, i32* %8
%28 = load i32, i32* %8
%29 = load i32, i32* %6
%30 = xor i32 %29, -1
%31 = and i32 %28, %30
%32 = load i32, i32* %7
%33 = xor i32 %32, -1
%34 = and i32 %31, %33
%35 = load i32, i32* %5
%36 = load i32, i32* %6
%37 = and i32 %35, %36
%38 = or i32 %34, %37
%39 = load i32, i32* %5
%40 = load i32, i32* %7
%41 = and i32 %39, %40
%42 = or i32 %38, %41
ret i32 %42
}

LLVM IR (-O2):
define i32 @xrop3_190_1_1(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = shl nuw nsw i32 %3, 8
%5 = zext i8 %1 to i32
%6 = shl nuw nsw i32 %5, 8
%7 = xor i32 %6, %4
%8 = or i32 %7, 255
%9 = or i8 %1, %0
%10 = zext i8 %9 to i32
%11 = or i32 %4, %10
%12 = or i32 %11, %6
%13 = xor i32 %12, -1
%14 = and i32 %8, %13
%15 = or i32 %14, %10
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ factorbug();
int /*<<< orphan*/ print_string(char *);
void primitive_die(void) {
  print_string("The die word was called by the library. Unless you called it "
               "yourself,\n");
  print_string("you have triggered a bug in Factor. Please report.\n");
  factorbug();
}


x86 assembly (clang, -O0):
<primitive_die>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <print_string@plt>
lea    0xf11(%rip),%rdi
call   1030 <print_string@plt>
mov    $0x0,%al
call   1040 <factorbug@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<primitive_die>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <print_string@plt>
lea    0xf14(%rip),%rdi
call   1030 <print_string@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <factorbug@plt>

LLVM IR (-O0):
@.str = [72 x i8] c"The die word was called by the library. Unless you called it yourself,\0A\00"
@.str.1 = [52 x i8] c"you have triggered a bug in Factor. Please report.\0A\00"
define void @primitive_die() {
%1 = call i32 @print_string(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @print_string(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 (...) @factorbug()
ret void
}

LLVM IR (-O2):
@.str = [72 x i8] c"The die word was called by the library. Unless you called it yourself,\0A\00"
@.str.1 = [52 x i8] c"you have triggered a bug in Factor. Please report.\0A\00"
define void @primitive_die() {
%1 = tail call i32 @print_string(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @print_string(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 (...) @factorbug()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exact_square(int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int ch, res;
  printf("Vasheto chislo : ");
  scanf("%d", &ch);
  exact_square(res, ch);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1040 <exact_square@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [18 x i8] c"Vasheto chislo : \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @exact_square(i32 undef, i32 %5)
ret i32 0
}
int processarCaractere(char caractere) {
  switch (caractere) {
  case '0':
    return 6;
  case '1':
    return 2;
  case '2':
    return 5;
  case '3':
    return 5;
  case '4':
    return 4;
  case '5':
    return 5;
  case '6':
    return 6;
  case '7':
    return 3;
  case '8':
    return 7;
  case '9':
    return 6;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<processarCaractere>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
add    $0xffffffd0,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x9,%eax
ja     11ac <processarCaractere+0xac>
mov    -0x10(%rbp),%rax
lea    0xed5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x6,-0x4(%rbp)
jmp    11b3 <processarCaractere+0xb3>
movl   $0x2,-0x4(%rbp)
jmp    11b3 <processarCaractere+0xb3>
movl   $0x5,-0x4(%rbp)
jmp    11b3 <processarCaractere+0xb3>
movl   $0x5,-0x4(%rbp)
jmp    11b3 <processarCaractere+0xb3>
movl   $0x4,-0x4(%rbp)
jmp    11b3 <processarCaractere+0xb3>
movl   $0x5,-0x4(%rbp)
jmp    11b3 <processarCaractere+0xb3>
movl   $0x6,-0x4(%rbp)
jmp    11b3 <processarCaractere+0xb3>
movl   $0x3,-0x4(%rbp)
jmp    11b3 <processarCaractere+0xb3>
movl   $0x7,-0x4(%rbp)
jmp    11b3 <processarCaractere+0xb3>
movl   $0x6,-0x4(%rbp)
jmp    11b3 <processarCaractere+0xb3>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<processarCaractere>:
add    $0xffffffd0,%edi
xor    %eax,%eax
cmp    $0x9,%edi
ja     1117 <processarCaractere+0x17>
movslq %edi,%rax
lea    0xeec(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @processarCaractere(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %16 [
i32 48, label %6
i32 49, label %7
i32 50, label %8
i32 51, label %9
i32 52, label %10
i32 53, label %11
i32 54, label %12
i32 55, label %13
i32 56, label %14
i32 57, label %15
]
6: ; preds = %1
store i32 6, i32* %2
br label %17
7: ; preds = %1
store i32 2, i32* %2
br label %17
8: ; preds = %1
store i32 5, i32* %2
br label %17
9: ; preds = %1
store i32 5, i32* %2
br label %17
10: ; preds = %1
store i32 4, i32* %2
br label %17
11: ; preds = %1
store i32 5, i32* %2
br label %17
12: ; preds = %1
store i32 6, i32* %2
br label %17
13: ; preds = %1
store i32 3, i32* %2
br label %17
14: ; preds = %1
store i32 7, i32* %2
br label %17
15: ; preds = %1
store i32 6, i32* %2
br label %17
16: ; preds = %1
store i32 0, i32* %2
br label %17
17: ; preds = %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
@switch.table.processarCaractere = [10 x i32] [i32 6, i32 2, i32 5, i32 5, i32 4, i32 5, i32 6, i32 3, i32 7, i32 6]
define i32 @processarCaractere(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, -48
%4 = icmp ult i32 %3, 10
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = sext i32 %3 to i64
%7 = getelementptr inbounds [10 x i32], [10 x i32]* @switch.table.processarCaractere, i64 0, i64 %6
%8 = load i32, i32* %7
br label %9
9: ; preds = %1, %5
%10 = phi i32 [ %8, %5 ], [ 0, %1 ]
ret i32 %10
}
int func(int y, int z) { return y && z; }


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x9(%rbp)
je     1123 <func+0x23>
cmpl   $0x0,-0x8(%rbp)
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<func>:
test   %edi,%edi
setne  %al
test   %esi,%esi
setne  %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @func(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 = icmp ne i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 0
br label %10
10: ; preds = %7, %2
%11 = phi i1 [ false, %2 ], [ %9, %7 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @func(i32 %0, i32 %1) {
%3 = icmp ne i32 %0, 0
%4 = icmp ne i32 %1, 0
%5 = and i1 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int intel_ich_gpio_set(int, int);
int intel_ich_gpio19_raise(void) { return intel_ich_gpio_set(19, 1); }


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

x86 assembly (clang, -O2):
<intel_ich_gpio19_raise>:
mov    $0x13,%edi
mov    $0x1,%esi
jmp    1030 <intel_ich_gpio_set@plt>

LLVM IR (-O0):
define i32 @intel_ich_gpio19_raise() {
%1 = call i32 @intel_ich_gpio_set(i32 19, i32 1)
ret i32 %1
}

LLVM IR (-O2):
define i32 @intel_ich_gpio19_raise() {
%1 = tail call i32 @intel_ich_gpio_set(i32 19, i32 1)
ret i32 %1
}
__int128_t f_scalar_5(__int128_t x) { return x; }


x86 assembly (clang, -O0):
<f_scalar_5>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
pop    %rbp
ret

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

LLVM IR (-O0):
define { i64, i64 } @f_scalar_5(i64 %0, i64 %1) {
%3 = alloca i128
%4 = alloca i128
%5 = alloca i128
%6 = bitcast i128* %4 to { i64, i64 }*
%7 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %6, i32 0, i32 0
store i64 %0, i64* %7
%8 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %6, i32 0, i32 1
store i64 %1, i64* %8
%9 = load i128, i128* %4
store i128 %9, i128* %5
%10 = load i128, i128* %5
store i128 %10, i128* %3
%11 = bitcast i128* %3 to { i64, i64 }*
%12 = load { i64, i64 }, { i64, i64 }* %11
ret { i64, i64 } %12
}

LLVM IR (-O2):
define { i64, i64 } @f_scalar_5(i64 %0, i64 %1) {
%3 = insertvalue { i64, i64 } poison, i64 %0, 0
%4 = insertvalue { i64, i64 } %3, i64 %1, 1
ret { i64, i64 } %4
}
/* Variables and functions */
int /*<<< orphan*/ fs_create_dir(char *);
int _mkdir(char *path) { fs_create_dir(path); }


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

x86 assembly (clang, -O2):
<_mkdir>:
jmp    1030 <fs_create_dir@plt>

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

LLVM IR (-O2):
define i32 @_mkdir(i8* %0) {
%2 = tail call i32 @fs_create_dir(i8* %0)
ret i32 undef
}
int _LZ_ReadVarSize(unsigned int *x, unsigned char *buf) {
  unsigned int y, b, num_bytes;
  y = 0;
  num_bytes = 0;
  do {
    b = (unsigned int)(*buf++);
    y = (y << 7) | (b & 0x0000007f);
    ++num_bytes;
  } while (b & 0x00000080);
  *x = y;
  return num_bytes;
}


x86 assembly (clang, -O0):
<_LZ_ReadVarSize>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movzbl (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x7,%eax
mov    -0x18(%rbp),%ecx
and    $0x7f,%ecx
or     %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
jne    111a <_LZ_ReadVarSize+0x1a>
mov    -0x14(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_LZ_ReadVarSize>:
xor    %eax,%eax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%rsi,%rax,1),%r8d
mov    %ecx,%edx
shl    $0x7,%edx
mov    %r8d,%ecx
and    $0x7f,%ecx
or     %edx,%ecx
add    $0x1,%rax
test   $0x80,%r8b
jne    1110 <_LZ_ReadVarSize+0x10>
mov    %ecx,(%rdi)
ret

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

LLVM IR (-O2):
define i32 @_LZ_ReadVarSize(i32* nocapture writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i32 [ 0, %2 ], [ %12, %3 ]
%5 = phi i8* [ %1, %2 ], [ %7, %3 ]
%6 = phi i32 [ 0, %2 ], [ %13, %3 ]
%7 = getelementptr inbounds i8, i8* %5, i64 1
%8 = load i8, i8* %5
%9 = zext i8 %8 to i32
%10 = shl i32 %4, 7
%11 = and i32 %9, 127
%12 = or i32 %11, %10
%13 = add i32 %6, 1
%14 = and i32 %9, 128
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %3
16: ; preds = %3
store i32 %12, i32* %0
ret i32 %13
}
unsigned long htonl(unsigned long h) {
  unsigned long n;
  unsigned char *p;
  p = (unsigned char *)&n;
  p[0] = h >> 24;
  p[1] = h >> 16;
  p[2] = h >> 8;
  p[3] = h;
  return n;
}


x86 assembly (clang, -O0):
<htonl>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x18,%rax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
shr    $0x10,%rax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x8(%rbp),%rax
shr    $0x8,%rax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x8(%rbp),%rax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i64 @htonl(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = tail call i32 @llvm.bswap.i32(i32 %2)
%4 = zext i32 %3 to i64
ret i64 %4
}
int recupererDirectionJoueurCasNormal(const unsigned int direction,
                                      const unsigned int dimension) {
  static const int baseDirectionJoueurCasNormal[4][2] = {
      {-1, 0}, {1, 0}, {0, -2}, {0, 2}};
  return baseDirectionJoueurCasNormal[direction][dimension];
}


x86 assembly (clang, -O0):
<recupererDirectionJoueurCasNormal>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
lea    0xeea(%rip),%rax
shl    $0x3,%rcx
add    %rcx,%rax
mov    -0x8(%rbp),%ecx
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<recupererDirectionJoueurCasNormal>:
mov    %edi,%eax
mov    %esi,%ecx
lea    0xef5(%rip),%rdx
lea    (%rdx,%rax,8),%rax
mov    (%rax,%rcx,4),%eax
ret

LLVM IR (-O0):
@recupererDirectionJoueurCasNormal.baseDirectionJoueurCasNormal = internal constant [4 x [2 x i32]] [[2 x i32] [i32 -1, i32 0], [2 x i32] [i32 1, i32 0], [2 x i32] [i32 0, i32 -2], [2 x i32] [i32 0, i32 2]]
define i32 @recupererDirectionJoueurCasNormal(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 = zext i32 %5 to i64
%7 = getelementptr inbounds [4 x [2 x i32]], [4 x [2 x i32]]* @recupererDirectionJoueurCasNormal.baseDirectionJoueurCasNormal, i64 0, i64 %6
%8 = load i32, i32* %4
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 %9
%11 = load i32, i32* %10
ret i32 %11
}

LLVM IR (-O2):
@recupererDirectionJoueurCasNormal.baseDirectionJoueurCasNormal = internal unnamed_addr constant [4 x [2 x i32]] [[2 x i32] [i32 -1, i32 0], [2 x i32] [i32 1, i32 0], [2 x i32] [i32 0, i32 -2], [2 x i32] [i32 0, i32 2]]
define i32 @recupererDirectionJoueurCasNormal(i32 %0, i32 %1) {
%3 = zext i32 %0 to i64
%4 = zext i32 %1 to i64
%5 = getelementptr inbounds [4 x [2 x i32]], [4 x [2 x i32]]* @recupererDirectionJoueurCasNormal.baseDirectionJoueurCasNormal, i64 0, i64 %3, i64 %4
%6 = load i32, i32* %5
ret i32 %6
}
/* Variables and functions */
double sqrt(int /*<<< orphan*/);
int /*<<< orphan*/ vec3_dot(double const *, double const *);
double vec3_len(const double *v1) { return sqrt(vec3_dot(v1, v1)); }


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

x86 assembly (clang, -O2):
<vec3_len>:
push   %rax
mov    %rdi,%rsi
call   1030 <vec3_dot@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <sqrt@plt>

LLVM IR (-O0):
define double @vec3_len(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = load double*, double** %2
%5 = call i32 @vec3_dot(double* %3, double* %4)
%6 = call double @sqrt(i32 %5)
ret double %6
}

LLVM IR (-O2):
define double @vec3_len(double* %0) {
%2 = tail call i32 @vec3_dot(double* %0, double* %0)
%3 = tail call double @sqrt(i32 %2)
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void welcome() {
  puts("*** Welcome to Simpletron ***\n"
       "*** Please enter your program one instruction ***\n"
       "*** (or data word) at time. I will type the   ***\n"
       "*** location number and a question mark (?).  ***\n"
       "*** You then type the word for that location. ***\n"
       "*** Type the sentinel -99999 to stop entering ***\n"
       "*** your program. ***\n");
}


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

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

LLVM IR (-O0):
@.str = [303 x i8] c"*** Welcome to Simpletron ***\0A*** Please enter your program one instruction ***\0A*** (or data word) at time. I will type the ***\0A*** location number and a question mark (?). ***\0A*** You then type the word for that location. ***\0A*** Type the sentinel -99999 to stop entering ***\0A*** your program. ***\0A\00"
define void @welcome() {
%1 = call i32 @puts(i8* getelementptr inbounds ([303 x i8], [303 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [303 x i8] c"*** Welcome to Simpletron ***\0A*** Please enter your program one instruction ***\0A*** (or data word) at time. I will type the ***\0A*** location number and a question mark (?). ***\0A*** You then type the word for that location. ***\0A*** Type the sentinel -99999 to stop entering ***\0A*** your program. ***\0A\00"
define void @welcome() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([303 x i8], [303 x i8]* @.str, i64 0, i64 0))
ret void
}
int test_imm_A1uint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0xA1 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_A1uint64_highword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
shr    $0x20,%rdx
and    $0xa1,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_A1uint64_highword_mem>:
testb  $0xa1,0x4(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_A1uint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 691489734656
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ __halt();
void fn0AB4() { __halt(); }


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

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

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

LLVM IR (-O2):
define void @fn0AB4() {
%1 = tail call i32 (...) @__halt()
ret void
}
int f(int b, int c) {
  int a = (b >> 16) * (c >> 16);
  return a;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x10,%eax
mov    -0x8(%rbp),%ecx
sar    $0x10,%ecx
imul   %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
mov    %esi,%eax
sar    $0x10,%edi
sar    $0x10,%eax
imul   %edi,%eax
ret

LLVM IR (-O0):
define i32 @f(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 = ashr i32 %6, 16
%8 = load i32, i32* %4
%9 = ashr i32 %8, 16
%10 = mul nsw i32 %7, %9
store i32 %10, i32* %5
%11 = load i32, i32* %5
ret i32 %11
}

LLVM IR (-O2):
define i32 @f(i32 %0, i32 %1) {
%3 = ashr i32 %0, 16
%4 = ashr i32 %1, 16
%5 = mul nsw i32 %4, %3
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ pthread_exit(void *);
void *thread_task2(void *args) {
  printf("thread 2 exit\n");
  pthread_exit((void *)6);
}


x86 assembly (clang, -O0):
<thread_task2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
mov    $0x6,%edi
call   1040 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread_task2>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x6,%edi
pop    %rax
jmp    1040 <pthread_exit@plt>

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

LLVM IR (-O2):
@str = [14 x i8] c"thread 2 exit\00"
define noalias i8* @thread_task2(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @pthread_exit(i8* inttoptr (i64 6 to i8*))
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ concatCombination(int *, int *, int /*<<< orphan*/, int,
                                     int /*<<< orphan*/, int);
void getCombination(int arr[], int n, int r) {
  int data[r];
  concatCombination(arr, data, 0, n - 1, 0, r);
}


x86 assembly (clang, -O0):
<getCombination>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x10(%rbp),%r9d
xor    %r8d,%r8d
mov    %r8d,%edx
call   1030 <concatCombination@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getCombination>:
push   %rbp
mov    %rsp,%rbp
mov    %edx,%r9d
mov    %edx,%ecx
mov    %rsp,%rax
lea    0xf(,%rcx,4),%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%rax
mov    %rax,%rsp
lea    -0x1(%rsi),%ecx
mov    %rax,%rsi
xor    %edx,%edx
xor    %r8d,%r8d
call   1030 <concatCombination@plt>
mov    %rbp,%rsp
pop    %rbp
ret

LLVM IR (-O0):
define void @getCombination(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %6
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %7
%12 = alloca i32, i64 %10
store i64 %10, i64* %8
%13 = load i32*, i32** %4
%14 = load i32, i32* %5
%15 = sub nsw i32 %14, 1
%16 = load i32, i32* %6
%17 = call i32 @concatCombination(i32* %13, i32* %12, i32 0, i32 %15, i32 0, i32 %16)
%18 = load i8*, i8** %7
ret void
}

LLVM IR (-O2):
define void @getCombination(i32* %0, i32 %1, i32 %2) {
%4 = zext i32 %2 to i64
%5 = alloca i32, i64 %4
%6 = add nsw i32 %1, -1
%7 = call i32 @concatCombination(i32* %0, i32* %5, i32 0, i32 %6, i32 0, i32 %2)
ret void
}