xunge/DecIR huggingface dataset:
int get_char(addr)
char *addr;
{ return *addr; }


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

x86 assembly (clang, -O2):
<get_char>:
movsbl (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @get_char(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @get_char(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
ret i32 %3
}
/* Type definitions */
typedef int pid_t;

/* Variables and functions */
int /*<<< orphan*/ TIOCSPGRP;
int /*<<< orphan*/ _DIAGASSERT(int);
int ioctl(int, int /*<<< orphan*/, int *);
int tcsetpgrp(int fd, pid_t pgrp) {
  int s;
  _DIAGASSERT(fd != -1);
  s = pgrp;
  return (ioctl(fd, TIOCSPGRP, &s));
}


x86 assembly (clang, -O0):
<tcsetpgrp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <_DIAGASSERT@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e91(%rip),%rax
mov    (%rax),%esi
lea    -0xc(%rbp),%rdx
call   1030 <ioctl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tcsetpgrp>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
cmp    $0xffffffff,%ebp
setne  %dil
call   1040 <_DIAGASSERT@plt>
mov    %ebx,0x4(%rsp)
mov    0x2ea0(%rip),%rax
mov    (%rax),%esi
lea    0x4(%rsp),%rdx
mov    %ebp,%edi
call   1030 <ioctl@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@TIOCSPGRP = global i32 0
define i32 @tcsetpgrp(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 = icmp ne i32 %6, -1
%8 = zext i1 %7 to i32
%9 = call i32 @_DIAGASSERT(i32 %8)
%10 = load i32, i32* %4
store i32 %10, i32* %5
%11 = load i32, i32* %3
%12 = load i32, i32* @TIOCSPGRP
%13 = call i32 @ioctl(i32 %11, i32 %12, i32* %5)
ret i32 %13
}

LLVM IR (-O2):
@TIOCSPGRP = global i32 0
define i32 @tcsetpgrp(i32 %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = icmp ne i32 %0, -1
%6 = zext i1 %5 to i32
%7 = tail call i32 @_DIAGASSERT(i32 %6)
store i32 %1, i32* %3
%8 = load i32, i32* @TIOCSPGRP
%9 = call i32 @ioctl(i32 %0, i32 %8, i32* %3)
ret i32 %9
}
unsigned int hash_fun(char *key) {
  unsigned int seed = 131;
  unsigned int hash = 0;
  while (*key) {
    hash = hash * seed + *key;
    ++key;
  }
  return hash & 0x7FFFFFFF;
}


x86 assembly (clang, -O0):
<hash_fun>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x83,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1147 <hash_fun+0x47>
mov    -0x10(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1116 <hash_fun+0x16>
mov    -0x10(%rbp),%eax
and    $0x7fffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_fun>:
mov    (%rdi),%cl
test   %cl,%cl
je     112c <hash_fun+0x2c>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
imul   $0x83,%eax,%edx
movsbl %cl,%eax
add    %edx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash_fun+0x10>
and    $0x7fffffff,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @hash_fun(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %10, %4 ], [ 0, %1 ]
%7 = phi i8* [ %11, %4 ], [ %0, %1 ]
%8 = mul i32 %6, 131
%9 = sext i8 %5 to i32
%10 = add i32 %8, %9
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = and i32 %10, 2147483647
br label %16
16: ; preds = %14, %1
%17 = phi i32 [ 0, %1 ], [ %15, %14 ]
ret i32 %17
}
unsigned short int f6(unsigned short int x, long int y) {
  return (x << y) | (x >> ((-y) & (8 * 2 - 1)));
}


x86 assembly (clang, -O0):
<f6>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
movzwl -0x2(%rbp),%eax
mov    -0x10(%rbp),%rcx
shl    %cl,%eax
movzwl -0x2(%rbp),%edx
xor    %ecx,%ecx
sub    -0x10(%rbp),%rcx
and    $0xf,%rcx
sar    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f6>:
mov    %rsi,%rcx
mov    %edi,%eax
shl    %cl,%eax
neg    %cl
and    $0xf,%cl
shr    %cl,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define zeroext i16 @f6(i16 zeroext %0, i64 %1) {
%3 = alloca i16
%4 = alloca i64
store i16 %0, i16* %3
store i64 %1, i64* %4
%5 = load i16, i16* %3
%6 = zext i16 %5 to i32
%7 = load i64, i64* %4
%8 = trunc i64 %7 to i32
%9 = shl i32 %6, %8
%10 = load i16, i16* %3
%11 = zext i16 %10 to i32
%12 = load i64, i64* %4
%13 = sub nsw i64 0, %12
%14 = and i64 %13, 15
%15 = trunc i64 %14 to i32
%16 = ashr i32 %11, %15
%17 = or i32 %9, %16
%18 = trunc i32 %17 to i16
ret i16 %18
}

LLVM IR (-O2):
define zeroext i16 @f6(i16 zeroext %0, i64 %1) {
%3 = zext i16 %0 to i32
%4 = trunc i64 %1 to i32
%5 = shl i32 %3, %4
%6 = sub i32 0, %4
%7 = and i32 %6, 15
%8 = lshr i32 %3, %7
%9 = or i32 %8, %5
%10 = trunc i32 %9 to i16
ret i16 %10
}
/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
scalar_t__ umount(char *);
int main(void) {
  if (0 > umount("see.emily.play")) {
    return EXIT_FAILURE;
  } else
    return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <umount@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jle    114a <main+0x3a>
mov    0x2ea0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1156 <main+0x46>
mov    0x2e87(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <umount@plt>
test   %rax,%rax
jns    112b <main+0x1b>
mov    0x2eb7(%rip),%rax
jmp    1132 <main+0x22>
mov    0x2ea6(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"see.emily.play\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 @umount(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%3 = icmp sgt i64 0, %2
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = load i32, i32* @EXIT_FAILURE
store i32 %5, i32* %1
br label %8
6: ; preds = %0
%7 = load i32, i32* @EXIT_SUCCESS
store i32 %7, i32* %1
br label %8
8: ; preds = %6, %4
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
@.str = [15 x i8] c"see.emily.play\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i64 @umount(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = icmp slt i64 %1, 0
%3 = load i32, i32* @EXIT_FAILURE
%4 = load i32, i32* @EXIT_SUCCESS
%5 = select i1 %2, i32 %3, i32 %4
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char const *, char const *);
FILE *XSUM_fopen(const char *filename, const char *mode) {
  return fopen(filename, mode);
}


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

x86 assembly (clang, -O2):
<XSUM_fopen>:
jmp    1030 <fopen@plt>

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

LLVM IR (-O2):
define noalias i32* @XSUM_fopen(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32* @fopen(i8* %0, i8* %1)
ret i32* %3
}
/* Variables and functions */
int yahoo_M1Common(unsigned int, int);
int yahoo_f01_1c(int Salt, int Parameter) {
  unsigned b = Salt ^ 0x1D1C4911;
  return yahoo_M1Common(b, Parameter);
}


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

x86 assembly (clang, -O2):
<yahoo_f01_1c>:
xor    $0x1d1c4911,%edi
jmp    1030 <yahoo_M1Common@plt>

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

LLVM IR (-O2):
define i32 @yahoo_f01_1c(i32 %0, i32 %1) {
%3 = xor i32 %0, 488392977
%4 = tail call i32 @yahoo_M1Common(i32 %3, i32 %1)
ret i32 %4
}
/* Type definitions */
typedef int int16_t;

/* Variables and functions */
int16_t abs_16(int16_t s) { return ((s ^ (s >> 15)) - (s >> 15)); }


x86 assembly (clang, -O0):
<abs_16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sar    $0xf,%ecx
xor    %ecx,%eax
mov    -0x4(%rbp),%ecx
sar    $0xf,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<abs_16>:
mov    %edi,%eax
mov    %edi,%ecx
sar    $0xf,%ecx
xor    %ecx,%eax
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @abs_16(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = ashr i32 %4, 15
%6 = xor i32 %3, %5
%7 = load i32, i32* %2
%8 = ashr i32 %7, 15
%9 = sub nsw i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @abs_16(i32 %0) {
%2 = ashr i32 %0, 15
%3 = xor i32 %2, %0
%4 = sub nsw i32 %3, %2
ret i32 %4
}
/* Variables and functions */
char *concat(char const *, char *, char *);
char *HTMLGenComment(const char *innerHTML) {
  return concat(innerHTML, "<!--", "-->");
}


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

x86 assembly (clang, -O2):
<HTMLGenComment>:
lea    0xee9(%rip),%rsi
lea    0xee7(%rip),%rdx
jmp    1030 <concat@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"<!--\00"
@.str.1 = [4 x i8] c"-->\00"
define i8* @HTMLGenComment(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @concat(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret i8* %4
}

LLVM IR (-O2):
@.str = [5 x i8] c"<!--\00"
@.str.1 = [4 x i8] c"-->\00"
define i8* @HTMLGenComment(i8* %0) {
%2 = tail call i8* @concat(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ send(int, char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strcpy(char *, char const *);
int /*<<< orphan*/ strlen(char *);
void sendString(int client, const char *strToSend) {
  char buf[2048];
  strcpy(buf, strToSend);
  send(client, buf, strlen(buf), 0);
}


x86 assembly (clang, -O0):
<sendString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x820,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x810(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x81c(%rbp)
lea    -0x810(%rbp),%rax
mov    %rax,-0x818(%rbp)
lea    -0x810(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x81c(%rbp),%edi
mov    -0x818(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1050 <send@plt>
add    $0x820,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sendString>:
push   %rbp
push   %rbx
sub    $0x808,%rsp
mov    %edi,%ebp
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1050 <send@plt>
add    $0x808,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @sendString(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [2048 x i8]
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 0
%7 = load i8*, i8** %4
%8 = call i32 @strcpy(i8* %6, i8* %7)
%9 = load i32, i32* %3
%10 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 0
%11 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 0
%12 = call i32 @strlen(i8* %11)
%13 = call i32 @send(i32 %9, i8* %10, i32 %12, i32 0)
ret void
}

LLVM IR (-O2):
define void @sendString(i32 %0, i8* %1) {
%3 = alloca [2048 x i8]
%4 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%5 = call i32 @strcpy(i8* %4, i8* %1)
%6 = call i32 @strlen(i8* %4)
%7 = call i32 @send(i32 %0, i8* %4, i32 %6, i32 0)
ret void
}
void os_atomic_store_long(volatile long *ptr, long val) {
  __atomic_store_n(ptr, val, 5);
}


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

x86 assembly (clang, -O2):
<os_atomic_store_long>:
xchg   %rsi,(%rdi)
ret

LLVM IR (-O0):
define void @os_atomic_store_long(i64* %0, i64 %1) {
%3 = alloca i64*
%4 = alloca i64
%5 = alloca i64
store i64* %0, i64** %3
store i64 %1, i64* %4
%6 = load i64*, i64** %3
%7 = load i64, i64* %4
store i64 %7, i64* %5
%8 = load i64, i64* %5
store atomic volatile i64 %8, i64* %6 seq_cst
ret void
}

LLVM IR (-O2):
define void @os_atomic_store_long(i64* %0, i64 %1) {
store atomic volatile i64 %1, i64* %0 seq_cst
ret void
}
unsigned int lenn(char *pos, unsigned int max) {
  unsigned int p = 0;
  while (p < max && *pos++)
    p++;
  return p;
}


x86 assembly (clang, -O0):
<lenn>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
xor    %eax,%eax
cmp    -0xc(%rbp),%ecx
mov    %al,-0x11(%rbp)
jae    113e <lenn+0x3e>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    114e <lenn+0x4e>
jmp    115c <lenn+0x5c>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <lenn+0x12>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lenn>:
test   %esi,%esi
je     111f <lenn+0x1f>
mov    %esi,%eax
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
cmpb   $0x0,(%rdi,%rcx,1)
je     1122 <lenn+0x22>
add    $0x1,%rcx
cmp    %ecx,%eax
jne    1110 <lenn+0x10>
ret
xor    %eax,%eax
ret
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @lenn(i8* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %13, label %4
4: ; preds = %2, %9
%5 = phi i32 [ %11, %9 ], [ 0, %2 ]
%6 = phi i8* [ %10, %9 ], [ %0, %2 ]
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %4
%10 = getelementptr inbounds i8, i8* %6, i64 1
%11 = add nuw i32 %5, 1
%12 = icmp eq i32 %11, %1
br i1 %12, label %13, label %4
13: ; preds = %4, %9, %2
%14 = phi i32 [ 0, %2 ], [ %1, %9 ], [ %5, %4 ]
ret i32 %14
}
/* Variables and functions */
double log2(double);
double log(double x) {
  return log2(x) * 0.693147180559945309417232121458176568;
}


x86 assembly (clang, -O0):
<log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <log2@plt>
movsd  0xed1(%rip),%xmm1
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log>:
push   %rax
call   1030 <log2@plt>
mulsd  0xee2(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @log(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @log2(double %3)
%5 = fmul double %4, 0x3FE62E42FEFA39EF
ret double %5
}

LLVM IR (-O2):
define double @log(double %0) {
%2 = tail call double @log2(double %0)
%3 = fmul double %2, 0x3FE62E42FEFA39EF
ret double %3
}
/* Type definitions */
typedef scalar_t__ uint8_t;

/* Variables and functions */
uint8_t addmod8(uint8_t a, uint8_t b, uint8_t m) {
  a += b;
  while (a >= m)
    a -= m;
  return a;
}


x86 assembly (clang, -O0):
<addmod8>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x18(%rbp),%rax
jl     113e <addmod8+0x3e>
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <addmod8+0x1c>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<addmod8>:
mov    %rsi,%rax
add    %rdx,%rax
add    %rdi,%rax
nopl   0x0(%rax)
sub    %rdx,%rax
cmp    %rdx,%rax
jge    1110 <addmod8+0x10>
ret

LLVM IR (-O0):
define i64 @addmod8(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %5
%8 = load i64, i64* %4
%9 = add nsw i64 %8, %7
store i64 %9, i64* %4
br label %10
10: ; preds = %14, %3
%11 = load i64, i64* %4
%12 = load i64, i64* %6
%13 = icmp sge i64 %11, %12
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i64, i64* %6
%16 = load i64, i64* %4
%17 = sub nsw i64 %16, %15
store i64 %17, i64* %4
br label %10
18: ; preds = %10
%19 = load i64, i64* %4
ret i64 %19
}

LLVM IR (-O2):
define i64 @addmod8(i64 %0, i64 %1, i64 %2) {
%4 = add nsw i64 %1, %0
br label %5
5: ; preds = %5, %3
%6 = phi i64 [ %4, %3 ], [ %8, %5 ]
%7 = icmp slt i64 %6, %2
%8 = sub nsw i64 %6, %2
br i1 %7, label %9, label %5
9: ; preds = %5
ret i64 %6
}
/* Variables and functions */
unsigned int f22(unsigned int);
unsigned int f23(unsigned int a) { return f22(f22(a)); }


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

x86 assembly (clang, -O2):
<f23>:
push   %rax
call   1030 <f22@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <f22@plt>

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

LLVM IR (-O2):
define i32 @f23(i32 %0) {
%2 = tail call i32 @f22(i32 %0)
%3 = tail call i32 @f22(i32 %2)
ret i32 %3
}
/* Variables and functions */
void str_iteri(char *s, void (*f)(unsigned int, char *)) {
  for (size_t i = 0; s[i]; i++) {
    f(i, &s[i]);
  }
}


x86 assembly (clang, -O0):
<str_iteri>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     114f <str_iteri+0x4f>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %ecx,%edi
mov    -0x8(%rbp),%rsi
add    -0x18(%rbp),%rsi
call   *%rax
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1118 <str_iteri+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_iteri>:
push   %r15
push   %r14
push   %rbx
cmpb   $0x0,(%rdi)
je     1135 <str_iteri+0x35>
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    (%r15,%rbx,1),%rsi
mov    %ebx,%edi
call   *%r14
cmpb   $0x0,0x1(%r15,%rbx,1)
lea    0x1(%rbx),%rbx
jne    1120 <str_iteri+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @str_iteri(i8* %0, void (i32, i8*)* nocapture %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %6, %2
ret void
6: ; preds = %2, %6
%7 = phi i8* [ %11, %6 ], [ %0, %2 ]
%8 = phi i64 [ %10, %6 ], [ 0, %2 ]
%9 = trunc i64 %8 to i32
tail call void %1(i32 %9, i8* %7)
%10 = add i64 %8, 1
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %5, label %6
}
unsigned xrop3_148_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;
  unsigned stk3;
  unsigned stk4;
  stk4 = T | S;
  stk3 = D & stk4;
  stk2 = S ^ stk3;
  stk1 = T ^ stk2;
  return (stk1 & (~S) & (~T)) | (D & S) | (D & T);
}


x86 assembly (clang, -O0):
<xrop3_148_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
or     -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
and    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
xor    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
xor    -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_148_1_1>:
mov    %edi,%eax
or     %esi,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_148_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
%10 = alloca i32
%11 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%12 = load i8, i8* %3
%13 = zext i8 %12 to i32
%14 = shl i32 %13, 8
%15 = load i8, i8* %3
%16 = zext i8 %15 to i32
%17 = or i32 %14, %16
store i32 %17, i32* %6
%18 = load i8, i8* %4
%19 = zext i8 %18 to i32
%20 = shl i32 %19, 8
%21 = load i8, i8* %4
%22 = zext i8 %21 to i32
%23 = or i32 %20, %22
store i32 %23, i32* %7
%24 = load i32, i32* %7
%25 = load i32, i32* %6
%26 = or i32 %24, %25
store i32 %26, i32* %11
%27 = load i32, i32* %5
%28 = load i32, i32* %11
%29 = and i32 %27, %28
store i32 %29, i32* %10
%30 = load i32, i32* %6
%31 = load i32, i32* %10
%32 = xor i32 %30, %31
store i32 %32, i32* %9
%33 = load i32, i32* %7
%34 = load i32, i32* %9
%35 = xor i32 %33, %34
store i32 %35, i32* %8
%36 = load i32, i32* %8
%37 = load i32, i32* %6
%38 = xor i32 %37, -1
%39 = and i32 %36, %38
%40 = load i32, i32* %7
%41 = xor i32 %40, -1
%42 = and i32 %39, %41
%43 = load i32, i32* %5
%44 = load i32, i32* %6
%45 = and i32 %43, %44
%46 = or i32 %42, %45
%47 = load i32, i32* %5
%48 = load i32, i32* %7
%49 = and i32 %47, %48
%50 = or i32 %46, %49
ret i32 %50
}

LLVM IR (-O2):
define i32 @xrop3_148_1_1(i8 zeroext %0, i8 zeroext %1) {
%3 = or i8 %1, %0
%4 = zext i8 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ ordena(int *, int *, int *);
int /*<<< orphan*/ printf(char *, int, int, int);
int /*<<< orphan*/ scanf(char *, int *, int *, int *);
int main() {
  int num1, num2, num3;
  scanf("%d %d %d", &num1, &num2, &num3);
  ordena(&num1, &num2, &num3);
  printf("%d %d %d", num1, num2, num3);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xebe(%rip),%r14
lea    0x14(%rsp),%rbx
lea    0x10(%rsp),%r15
lea    0xc(%rsp),%r12
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1040 <ordena@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%ecx
mov    %r14,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"%d %d %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%8 = call i32 @ordena(i32* %1, i32* %2, i32* %3)
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %10, i32 %11)
ret i32 0
}
int linear(int iterations) {
  int result = 0;
  int i = 0;
  while (i < iterations) {
    result = result + i;
    i = i + 1;
  }
  return result;
}


x86 assembly (clang, -O0):
<linear>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1138 <linear+0x38>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1115 <linear+0x15>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<linear>:
test   %edi,%edi
jle    1118 <linear+0x18>
lea    -0x1(%rdi),%eax
lea    -0x2(%rdi),%ecx
imul   %rax,%rcx
shr    %rcx
lea    (%rcx,%rdi,1),%eax
add    $0xffffffff,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @linear(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %13
3: ; preds = %1
%4 = add nsw i32 %0, -1
%5 = zext i32 %4 to i33
%6 = add nsw i32 %0, -2
%7 = zext i32 %6 to i33
%8 = mul i33 %5, %7
%9 = lshr i33 %8, 1
%10 = trunc i33 %9 to i32
%11 = add i32 %10, %0
%12 = add i32 %11, -1
br label %13
13: ; preds = %3, %1
%14 = phi i32 [ 0, %1 ], [ %12, %3 ]
ret i32 %14
}
int pushC(char *stack, int top, char x) {
  if (top == 20 - 1) {
    return 0;
  }
  top = top + 1;
  stack[top] = x;
  return top;
}


x86 assembly (clang, -O0):
<pushC>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %al,-0x15(%rbp)
cmpl   $0x13,-0x14(%rbp)
jne    1126 <pushC+0x26>
movl   $0x0,-0x4(%rbp)
jmp    1143 <pushC+0x43>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x15(%rbp),%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pushC>:
xor    %eax,%eax
cmp    $0x13,%esi
je     1112 <pushC+0x12>
movslq %esi,%rax
mov    %dl,0x1(%rdi,%rax,1)
add    $0x1,%rax
ret

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

LLVM IR (-O2):
define i32 @pushC(i8* nocapture writeonly %0, i32 %1, i8 signext %2) {
%4 = icmp eq i32 %1, 19
br i1 %4, label %9, label %5
5: ; preds = %3
%6 = add nsw i32 %1, 1
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
store i8 %2, i8* %8
br label %9
9: ; preds = %3, %5
%10 = phi i32 [ %6, %5 ], [ 0, %3 ]
ret i32 %10
}
void broken_longjmp(void *p) { __builtin_longjmp(p, 1); }


x86 assembly (clang, -O0):
<broken_longjmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rbp
mov    0x8(%rcx),%rax
mov    0x10(%rcx),%rsp
jmp    *%rax

x86 assembly (clang, -O2):
<broken_longjmp>:
push   %rbp
mov    (%rdi),%rbp
mov    0x8(%rdi),%rax
mov    0x10(%rdi),%rsp
jmp    *%rax

LLVM IR (-O0):
define void @broken_longjmp(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i8**
%5 = bitcast i8** %4 to i8*
unreachable
}

LLVM IR (-O2):
define void @broken_longjmp(i8* %0) {
tail call void @llvm.eh.sjlj.longjmp(i8* %0)
unreachable
}
int fun1081() { return 1081; }


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

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

LLVM IR (-O0):
define i32 @fun1081() {
ret i32 1081
}

LLVM IR (-O2):
define i32 @fun1081() {
ret i32 1081
}
/* Variables and functions */
int /*<<< orphan*/ *find_function(char const *);
int function_registered(const char func_name[]) {
  return find_function(func_name) != NULL;
}


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

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

LLVM IR (-O0):
define i32 @function_registered(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32* @find_function(i8* %3)
%5 = icmp ne i32* %4, null
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @function_registered(i8* %0) {
%2 = tail call i32* @find_function(i8* %0)
%3 = icmp ne i32* %2, null
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ nsc_assert(int);
void ttwakeup(void) {
  nsc_assert(0 && "This function is unimplemented.");
  ;
}


x86 assembly (clang, -O0):
<ttwakeup>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ttwakeup>:
xor    %edi,%edi
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
define void @ttwakeup() {
%1 = call i32 @nsc_assert(i32 0)
ret void
}

LLVM IR (-O2):
define void @ttwakeup() {
%1 = tail call i32 @nsc_assert(i32 0)
ret void
}
int foo() {
  register int X __asm__("ebx");
  return X;
}


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

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

LLVM IR (-O0):
define i32 @foo() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @foo() {
ret i32 undef
}
/* Variables and functions */
double abs(float);
float pretty(float x) {
  float xx = x;
  if (abs(xx) < 5.0e-6)
    xx = 0;
  return xx;
}


x86 assembly (clang, -O0):
<pretty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <abs@plt>
movaps %xmm0,%xmm1
movsd  0xec4(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    114e <pretty+0x3e>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pretty>:
push   %rax
movss  %xmm0,0x4(%rsp)
call   1030 <abs@plt>
movsd  0xedc(%rip),%xmm1
ucomisd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ja     1134 <pretty+0x24>
movss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @pretty(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
store float %4, float* %3
%5 = load float, float* %3
%6 = call double @abs(float %5)
%7 = fcmp olt double %6, 5.000000e-06
br i1 %7, label %8, label %9
8: ; preds = %1
store float 0.000000e+00, float* %3
br label %9
9: ; preds = %8, %1
%10 = load float, float* %3
ret float %10
}

LLVM IR (-O2):
define float @pretty(float %0) {
%2 = tail call double @abs(float %0)
%3 = fcmp olt double %2, 5.000000e-06
%4 = select i1 %3, float 0.000000e+00, float %0
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *);
int main() {
  char firstName[] = "Martin";
  char lastName[] = "Markov";
  printf("%s\n%s\n", firstName, lastName);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xedb(%rip),%eax
mov    %eax,-0xb(%rbp)
mov    0xed5(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xecd(%rip),%al
mov    %al,-0x5(%rbp)
mov    0xec5(%rip),%eax
mov    %eax,-0x12(%rbp)
mov    0xebf(%rip),%ax
mov    %ax,-0xe(%rbp)
mov    0xeb7(%rip),%al
mov    %al,-0xc(%rbp)
lea    -0xb(%rbp),%rsi
lea    -0x12(%rbp),%rdx
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movl   $0x6e6974,0x13(%rsp)
movl   $0x7472614d,0x10(%rsp)
74
movl   $0x766f6b,0xb(%rsp)
movl   $0x6b72614d,0x8(%rsp)
6b
lea    0xed3(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.firstName = [7 x i8] c"Martin\00"
@__const.main.lastName = [7 x i8] c"Markov\00"
@.str = [7 x i8] c"%s\0A%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i8]
%3 = alloca [7 x i8]
store i32 0, i32* %1
%4 = bitcast [7 x i8]* %2 to i8*
%5 = bitcast [7 x i8]* %3 to i8*
%6 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%8 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %7)
ret i32 0
}

LLVM IR (-O2):
@__const.main.firstName = [7 x i8] c"Martin\00"
@__const.main.lastName = [7 x i8] c"Markov\00"
@.str = [7 x i8] c"%s\0A%s\0A\00"
define i32 @main() {
%1 = alloca [7 x i8]
%2 = alloca [7 x i8]
%3 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%5 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %4)
ret i32 0
}
/* Variables and functions */
int mkdir(char *, int);
int main(void) {
  if (mkdir("/home/lappop/THISTHETEST", 448) == -1)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x1c0,%esi
call   1030 <mkdir@plt>
cmp    $0xffffffff,%eax
jne    1145 <main+0x35>
movl   $0xffffffff,-0x4(%rbp)
jmp    114c <main+0x3c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x1c0,%esi
call   1030 <mkdir@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
sete   %cl
neg    %ecx
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"/home/lappop/THISTHETEST\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @mkdir(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 448)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %5
4: ; preds = %0
store i32 -1, i32* %1
br label %6
5: ; preds = %0
store i32 0, i32* %1
br label %6
6: ; preds = %5, %4
%7 = load i32, i32* %1
ret i32 %7
}

LLVM IR (-O2):
@.str = [25 x i8] c"/home/lappop/THISTHETEST\00"
define i32 @main() {
%1 = tail call i32 @mkdir(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 448)
%2 = icmp eq i32 %1, -1
%3 = sext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
char *normalize_path(char *, char);
char *unix_path(char *str) { return normalize_path(str, '/'); }


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

x86 assembly (clang, -O2):
<unix_path>:
mov    $0x2f,%esi
jmp    1030 <normalize_path@plt>

LLVM IR (-O0):
define i8* @unix_path(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @normalize_path(i8* %3, i8 signext 47)
ret i8* %4
}

LLVM IR (-O2):
define i8* @unix_path(i8* %0) {
%2 = tail call i8* @normalize_path(i8* %0, i8 signext 47)
ret i8* %2
}
/* Variables and functions */
char *energymon_strencpy(char *, char *, size_t);
char *energymon_get_source_msr(char *buffer, size_t n) {
  return energymon_strencpy(buffer, "X86 MSR", n);
}


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

x86 assembly (clang, -O2):
<energymon_get_source_msr>:
mov    %rsi,%rdx
lea    0xee6(%rip),%rsi
jmp    1030 <energymon_strencpy@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"X86 MSR\00"
define i8* @energymon_get_source_msr(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i8* @energymon_strencpy(i8* %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64 %6)
ret i8* %7
}

LLVM IR (-O2):
@.str = [8 x i8] c"X86 MSR\00"
define i8* @energymon_get_source_msr(i8* %0, i64 %1) {
%3 = tail call i8* @energymon_strencpy(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64 %1)
ret i8* %3
}
void odp_cpu_pause(void) { __asm__ __volatile__("pause"); }


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

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

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

LLVM IR (-O2):
define void @odp_cpu_pause() {
tail call void asm sideeffect "pause", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
int byte_col_big5hkscs(int byte) {
  if (byte >= 0x40 && byte < 0x7f)
    return byte - 0x40;
  else if (byte >= 0xa1 && byte < 0xff)
    return byte - 0x62;
  else
    return -1;
}


x86 assembly (clang, -O0):
<byte_col_big5hkscs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x40,-0x8(%rbp)
jl     1129 <byte_col_big5hkscs+0x29>
cmpl   $0x7f,-0x8(%rbp)
jge    1129 <byte_col_big5hkscs+0x29>
mov    -0x8(%rbp),%eax
sub    $0x40,%eax
mov    %eax,-0x4(%rbp)
jmp    1158 <byte_col_big5hkscs+0x58>
cmpl   $0xa1,-0x8(%rbp)
jl     1151 <byte_col_big5hkscs+0x51>
cmpl   $0xff,-0x8(%rbp)
jge    1151 <byte_col_big5hkscs+0x51>
mov    -0x8(%rbp),%eax
sub    $0x62,%eax
mov    %eax,-0x4(%rbp)
jmp    1158 <byte_col_big5hkscs+0x58>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<byte_col_big5hkscs>:
lea    -0xa1(%rdi),%eax
lea    -0x62(%rdi),%ecx
cmp    $0x5e,%eax
mov    $0xffffffff,%eax
cmovb  %ecx,%eax
lea    -0x40(%rdi),%ecx
cmp    $0x3f,%ecx
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @byte_col_big5hkscs(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 64
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 127
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, 64
store i32 %11, i32* %2
br label %22
12: ; preds = %6, %1
%13 = load i32, i32* %3
%14 = icmp sge i32 %13, 161
br i1 %14, label %15, label %21
15: ; preds = %12
%16 = load i32, i32* %3
%17 = icmp slt i32 %16, 255
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i32, i32* %3
%20 = sub nsw i32 %19, 98
store i32 %20, i32* %2
br label %22
21: ; preds = %15, %12
store i32 -1, i32* %2
br label %22
22: ; preds = %21, %18, %9
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
define i32 @byte_col_big5hkscs(i32 %0) {
%2 = add i32 %0, -64
%3 = icmp ult i32 %2, 63
%4 = add i32 %0, -161
%5 = icmp ult i32 %4, 94
%6 = add nsw i32 %0, -98
%7 = select i1 %5, i32 %6, i32 -1
%8 = select i1 %3, i32 %2, i32 %7
ret i32 %8
}
pgxpRecNULL() {}


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

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

LLVM IR (-O0):
define i32 @pgxpRecNULL() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @pgxpRecNULL() {
ret i32 undef
}
void avcodec_license() {}


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

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

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

LLVM IR (-O2):
define void @avcodec_license() {
ret void
}
int compare(const void *key1, const void *key2) {
  return (*(int *)key1 - *(int *)key2);
}


x86 assembly (clang, -O0):
<compare>:
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>:
mov    (%rdi),%eax
sub    (%rsi),%eax
ret

LLVM IR (-O0):
define i32 @compare(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(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 null_progbeg(int argc, char *argv[]) {}


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

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

LLVM IR (-O0):
define void @null_progbeg(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
ret void
}

LLVM IR (-O2):
define void @null_progbeg(i32 %0, i8** nocapture %1) {
ret void
}
int gg_getopt_long(argc, argv, options, long_options, opt_index)
int argc;
char *const *argv;
const char *options;
const struct gg_option *long_options;
int *opt_index;
{ return _getopt_internal(argc, argv, options, long_options, opt_index, 0); }


x86 assembly (clang, -O0):
<gg_getopt_long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
xor    %r9d,%r9d
mov    $0x0,%al
call   1030 <_getopt_internal@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gg_getopt_long>:
xor    %r9d,%r9d
xor    %eax,%eax
jmp    1030 <_getopt_internal@plt>

LLVM IR (-O0):
%struct.gg_option = type opaque
define i32 @gg_getopt_long(i32 %0, i8** %1, i8* %2, %struct.gg_option* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8*
%9 = alloca %struct.gg_option*
%10 = alloca i32*
store i32 %0, i32* %6
store i8** %1, i8*** %7
store i8* %2, i8** %8
store %struct.gg_option* %3, %struct.gg_option** %9
store i32* %4, i32** %10
%11 = load i32, i32* %6
%12 = load i8**, i8*** %7
%13 = load i8*, i8** %8
%14 = load %struct.gg_option*, %struct.gg_option** %9
%15 = load i32*, i32** %10
%16 = call i32 (i32, i8**, i8*, %struct.gg_option*, i32*, i32, ...) bitcast (i32 (...)* @_getopt_internal to i32 (i32, i8**, i8*, %struct.gg_option*, i32*, i32, ...)*)(i32 %11, i8** %12, i8* %13, %struct.gg_option* %14, i32* %15, i32 0)
ret i32 %16
}

LLVM IR (-O2):
%struct.gg_option = type opaque
define i32 @gg_getopt_long(i32 %0, i8** %1, i8* %2, %struct.gg_option* %3, i32* %4) {
%6 = tail call i32 (i32, i8**, i8*, %struct.gg_option*, i32*, i32, ...) bitcast (i32 (...)* @_getopt_internal to i32 (i32, i8**, i8*, %struct.gg_option*, i32*, i32, ...)*)(i32 %0, i8** %1, i8* %2, %struct.gg_option* %3, i32* %4, i32 0)
ret i32 %6
}
/* Variables and functions */
int cs2qhv();
int cs2qhv_() {
  int result = cs2qhv();
  return result;
}


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

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

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

LLVM IR (-O2):
define i32 @cs2qhv_() {
%1 = tail call i32 (...) @cs2qhv()
ret i32 %1
}