xunge/DecIR huggingface dataset:
long tru(int s1, int s2) { return s1 - s2; }


x86 assembly (clang, -O0):
<tru>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<tru>:
sub    %esi,%edi
movslq %edi,%rax
ret

LLVM IR (-O0):
define i64 @tru(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = sub nsw i32 %5, %6
%8 = sext i32 %7 to i64
ret i64 %8
}

LLVM IR (-O2):
define i64 @tru(i32 %0, i32 %1) {
%3 = sub nsw i32 %0, %1
%4 = sext i32 %3 to i64
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void time7(int value) {
  if (value != 7) {
    printf("FAIL: time7 expected 6\n");
    exit(1);
  }
  printf("PASS: test6\n");
  exit(0);
}


x86 assembly (clang, -O0):
<time7>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x7,-0x4(%rbp)
je     114b <time7+0x2b>
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<time7>:
push   %rax
cmp    $0x7,%edi
jne    1139 <time7+0x19>
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>
lea    0xecc(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"FAIL: time7 expected 6\0A\00"
@.str.1 = [13 x i8] c"PASS: test6\0A\00"
define void @time7(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 7
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @exit(i32 1)
unreachable
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [12 x i8] c"PASS: test6\00"
@str.2 = [23 x i8] c"FAIL: time7 expected 6\00"
define void @time7(i32 %0) {
%2 = icmp eq i32 %0, 7
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.2, i64 0, i64 0))
%5 = tail call i32 @exit(i32 1)
unreachable
6: ; preds = %1
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int util_save_image(char const *orig_file_name, char const *save_file_name) {
  (void)fprintf(stderr,
                "util_save_image: not implemented on your operating system\n");
  return 0;
}


x86 assembly (clang, -O0):
<util_save_image>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<util_save_image>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [59 x i8] c"util_save_image: not implemented on your operating system\0A\00"
define i32 @util_save_image(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [59 x i8] c"util_save_image: not implemented on your operating system\0A\00"
define i32 @util_save_image(i8* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
long int square(long int n) { return n * n; }


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

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

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

LLVM IR (-O2):
define i64 @square(i64 %0) {
%2 = mul nsw i64 %0, %0
ret i64 %2
}
extern int gui_ksys_get_current_process_information(void *mem) {
  int value;
  __asm__ __volatile__("int $0x40" : "=a"(value) : "a"(9), "b"(mem), "c"(-1));
  return (value);
}


x86 assembly (clang, -O0):
<gui_ksys_get_current_process_information>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rbx
mov    $0x9,%eax
mov    $0xffffffff,%ecx
int    $0x40
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<gui_ksys_get_current_process_information>:
push   %rbx
mov    %rdi,%rbx
mov    $0x9,%eax
mov    $0xffffffff,%ecx
int    $0x40
pop    %rbx
ret

LLVM IR (-O0):
define i32 @gui_ksys_get_current_process_information(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 asm sideeffect "int $$0x40", "={ax},{ax},{bx},{cx},~{dirflag},~{fpsr},~{flags}"(i32 9, i8* %4, i32 -1)
store i32 %5, i32* %3
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @gui_ksys_get_current_process_information(i8* %0) {
%2 = tail call i32 asm sideeffect "int $$0x40", "={ax},{ax},{bx},{cx},~{dirflag},~{fpsr},~{flags}"(i32 9, i8* %0, i32 -1)
ret i32 %2
}
void rop3_230_1_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  stk3 = T & S;
  stk3 = ~stk3;
  stk2 = *D & stk3;
  stk1 = S ^ stk2;
  *D = (stk1 & (~S) & (~T)) | (*D & S) | (*D & T);
}


x86 assembly (clang, -O0):
<rop3_230_1_1>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0x9(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xd(%rbp)
movzbl -0xd(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xd(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xc(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
movzbl -0xa(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0xa(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @rop3_230_1_1(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%10 = load i8, i8* %6
%11 = zext i8 %10 to i32
%12 = load i8, i8* %5
%13 = zext i8 %12 to i32
%14 = and i32 %11, %13
%15 = trunc i32 %14 to i8
store i8 %15, i8* %9
%16 = load i8, i8* %9
%17 = zext i8 %16 to i32
%18 = xor i32 %17, -1
%19 = trunc i32 %18 to i8
store i8 %19, i8* %9
%20 = load i8*, i8** %4
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = load i8, i8* %9
%24 = zext i8 %23 to i32
%25 = and i32 %22, %24
%26 = trunc i32 %25 to i8
store i8 %26, i8* %8
%27 = load i8, i8* %5
%28 = zext i8 %27 to i32
%29 = load i8, i8* %8
%30 = zext i8 %29 to i32
%31 = xor i32 %28, %30
%32 = trunc i32 %31 to i8
store i8 %32, i8* %7
%33 = load i8, i8* %7
%34 = zext i8 %33 to i32
%35 = load i8, i8* %5
%36 = zext i8 %35 to i32
%37 = xor i32 %36, -1
%38 = and i32 %34, %37
%39 = load i8, i8* %6
%40 = zext i8 %39 to i32
%41 = xor i32 %40, -1
%42 = and i32 %38, %41
%43 = load i8*, i8** %4
%44 = load i8, i8* %43
%45 = zext i8 %44 to i32
%46 = load i8, i8* %5
%47 = zext i8 %46 to i32
%48 = and i32 %45, %47
%49 = or i32 %42, %48
%50 = load i8*, i8** %4
%51 = load i8, i8* %50
%52 = zext i8 %51 to i32
%53 = load i8, i8* %6
%54 = zext i8 %53 to i32
%55 = and i32 %52, %54
%56 = or i32 %49, %55
%57 = trunc i32 %56 to i8
%58 = load i8*, i8** %4
store i8 %57, i8* %58
ret void
}

LLVM IR (-O2):
define void @rop3_230_1_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
ret void
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int mask(int64_t hash, int shift) { return (hash >> shift) & 0x1f; }


x86 assembly (clang, -O0):
<mask>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
and    $0x1f,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mask>:
mov    %esi,%ecx
mov    %edi,%eax
sar    %cl,%eax
and    $0x1f,%eax
ret

LLVM IR (-O0):
define i32 @mask(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = ashr i32 %5, %6
%8 = and i32 %7, 31
ret i32 %8
}

LLVM IR (-O2):
define i32 @mask(i32 %0, i32 %1) {
%3 = ashr i32 %0, %1
%4 = and i32 %3, 31
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
void childs_play() {
  sleep(3);
  printf("Hey, I need some money! \n");
  sleep(1);
}


x86 assembly (clang, -O0):
<childs_play>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
call   1040 <sleep@plt>
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<childs_play>:
push   %rax
mov    $0x3,%edi
call   1040 <sleep@plt>
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
pop    %rax
jmp    1040 <sleep@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"Hey, I need some money! \0A\00"
define void @childs_play() {
%1 = call i32 @sleep(i32 3)
%2 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @sleep(i32 1)
ret void
}

LLVM IR (-O2):
@str = [25 x i8] c"Hey, I need some money! \00"
define void @childs_play() {
%1 = tail call i32 @sleep(i32 3)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @sleep(i32 1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ evutil_socket_t;

/* Variables and functions */
short EV_READ;
int /*<<< orphan*/ stdin_read_callback(int /*<<< orphan*/, void *);
void stdin_callback(evutil_socket_t fd, short ev, void *arg) {
  if (ev & EV_READ)
    stdin_read_callback(fd, arg);
}


x86 assembly (clang, -O0):
<stdin_callback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %edi,-0x4(%rbp)
mov    %ax,-0x6(%rbp)
mov    %rdx,-0x10(%rbp)
movswl -0x6(%rbp),%eax
mov    0x2eb7(%rip),%rcx
movswl (%rcx),%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     114b <stdin_callback+0x3b>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <stdin_read_callback@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stdin_callback>:
mov    0x2ed1(%rip),%rax
test   %si,(%rax)
je     1124 <stdin_callback+0x14>
mov    %rdx,%rsi
jmp    1030 <stdin_read_callback@plt>
ret

LLVM IR (-O0):
@EV_READ = global i16 0
define void @stdin_callback(i32 %0, i16 signext %1, i8* %2) {
%4 = alloca i32
%5 = alloca i16
%6 = alloca i8*
store i32 %0, i32* %4
store i16 %1, i16* %5
store i8* %2, i8** %6
%7 = load i16, i16* %5
%8 = sext i16 %7 to i32
%9 = load i16, i16* @EV_READ
%10 = sext i16 %9 to i32
%11 = and i32 %8, %10
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %3
%14 = load i32, i32* %4
%15 = load i8*, i8** %6
%16 = call i32 @stdin_read_callback(i32 %14, i8* %15)
br label %17
17: ; preds = %13, %3
ret void
}

LLVM IR (-O2):
@EV_READ = global i16 0
define void @stdin_callback(i32 %0, i16 signext %1, i8* %2) {
%4 = load i16, i16* @EV_READ
%5 = and i16 %4, %1
%6 = icmp eq i16 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = tail call i32 @stdin_read_callback(i32 %0, i8* %2)
br label %9
9: ; preds = %7, %3
ret void
}
/* Type definitions */
struct nlmsghdr {
  int nlmsg_flags;
};

/* Variables and functions */
int NLM_F_ECHO;
int nlmsg_report(struct nlmsghdr *nlh) {
  return !!(nlh->nlmsg_flags & NLM_F_ECHO);
}


x86 assembly (clang, -O0):
<nlmsg_report>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    0x2ed3(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nlmsg_report>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%ecx
xor    %eax,%eax
test   %ecx,(%rdi)
setne  %al
ret

LLVM IR (-O0):
%struct.nlmsghdr = type { i32 }
@NLM_F_ECHO = global i32 0
define i32 @nlmsg_report(%struct.nlmsghdr* %0) {
%2 = alloca %struct.nlmsghdr*
store %struct.nlmsghdr* %0, %struct.nlmsghdr** %2
%3 = load %struct.nlmsghdr*, %struct.nlmsghdr** %2
%4 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %3, i32 0, i32 0
%5 = load i32, i32* %4
%6 = load i32, i32* @NLM_F_ECHO
%7 = and i32 %5, %6
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
%10 = xor i1 %9, true
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
%struct.nlmsghdr = type { i32 }
@NLM_F_ECHO = global i32 0
define i32 @nlmsg_report(%struct.nlmsghdr* nocapture %0) {
%2 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = load i32, i32* @NLM_F_ECHO
%5 = and i32 %4, %3
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ __fortify_fail(char *);
void __attribute__((noreturn)) __stack_chk_fail(void) {
  __fortify_fail("stack smashing detected");
}


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

x86 assembly (clang, -O2):
<__stack_chk_fail>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <__fortify_fail@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"stack smashing detected\00"
define void @__stack_chk_fail() {
%1 = call i32 @__fortify_fail(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
unreachable
}

LLVM IR (-O2):
@.str = [24 x i8] c"stack smashing detected\00"
define void @__stack_chk_fail() {
%1 = tail call i32 @__fortify_fail(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
unreachable
}
/* Type definitions */
struct timespec {
  int tv_sec;
  int tv_nsec;
};

/* Variables and functions */
int nanosleep(struct timespec *, int /*<<< orphan*/ *);
__attribute__((visibility("hidden"))) int SYS_USleep(int iTimeVal) {
  struct timespec mrqtp;
  mrqtp.tv_sec = iTimeVal / 1000000;
  mrqtp.tv_nsec = (iTimeVal - (mrqtp.tv_sec * 1000000)) * 1000;
  return nanosleep(&mrqtp, NULL);
}


x86 assembly (clang, -O0):
<SYS_USleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
imul   $0xf4240,-0x10(%rbp),%ecx
sub    %ecx,%eax
imul   $0x3e8,%eax,%eax
mov    %eax,-0xc(%rbp)
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <nanosleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SYS_USleep>:
push   %rax
movslq %edi,%rax
imul   $0x431bde83,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x32,%rcx
add    %edx,%ecx
mov    %ecx,(%rsp)
imul   $0xfff0bdc0,%ecx,%ecx
add    %ecx,%eax
imul   $0x3e8,%eax,%eax
mov    %eax,0x4(%rsp)
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <nanosleep@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i32 }
define hidden i32 @SYS_USleep(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.timespec
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sdiv i32 %4, 1000000
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
store i32 %5, i32* %6
%7 = load i32, i32* %2
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
%9 = load i32, i32* %8
%10 = mul nsw i32 %9, 1000000
%11 = sub nsw i32 %7, %10
%12 = mul nsw i32 %11, 1000
%13 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 1
store i32 %12, i32* %13
%14 = call i32 @nanosleep(%struct.timespec* %3, i32* null)
ret i32 %14
}

LLVM IR (-O2):
%struct.timespec = type { i32, i32 }
define hidden i32 @SYS_USleep(i32 %0) {
%2 = alloca %struct.timespec
%3 = bitcast %struct.timespec* %2 to i8*
%4 = sdiv i32 %0, 1000000
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 0
store i32 %4, i32* %5
%6 = mul nsw i32 %4, -1000000
%7 = add i32 %6, %0
%8 = mul nsw i32 %7, 1000
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 1
store i32 %8, i32* %9
%10 = call i32 @nanosleep(%struct.timespec* %2, i32* null)
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
scalar_t__ is_littleendian();
uint64_t convert_ID(uint64_t ID) {
  unsigned short i;
  uint64_t result;
  unsigned char *res_p = (unsigned char *)&result, *ID_p = (unsigned char *)&ID;
  if (is_littleendian()) {
    for (i = 0; i < 8; i++)
      res_p[i] = ID_p[7 - i];
  } else {
    result = ID;
  }
  return result;
}


x86 assembly (clang, -O0):
<convert_ID>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1030 <is_littleendian@plt>
cmp    $0x0,%rax
je     1185 <convert_ID+0x75>
movw   $0x0,-0x6(%rbp)
movzwl -0x6(%rbp),%eax
cmp    $0x8,%eax
jge    1180 <convert_ID+0x70>
mov    -0x20(%rbp),%rax
movzwl -0x6(%rbp),%edx
mov    $0x7,%ecx
sub    %edx,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x18(%rbp),%rax
movzwl -0x6(%rbp),%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x6(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x6(%rbp)
jmp    1142 <convert_ID+0x32>
jmp    118b <convert_ID+0x7b>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_ID>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <is_littleendian@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @convert_ID(i32 %0) {
%2 = alloca i32
%3 = alloca i16
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
store i32 %0, i32* %2
%7 = bitcast i32* %4 to i8*
store i8* %7, i8** %5
%8 = bitcast i32* %2 to i8*
store i8* %8, i8** %6
%9 = call i64 (...) @is_littleendian()
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %32
11: ; preds = %1
store i16 0, i16* %3
br label %12
12: ; preds = %28, %11
%13 = load i16, i16* %3
%14 = zext i16 %13 to i32
%15 = icmp slt i32 %14, 8
br i1 %15, label %16, label %31
16: ; preds = %12
%17 = load i8*, i8** %6
%18 = load i16, i16* %3
%19 = zext i16 %18 to i32
%20 = sub nsw i32 7, %19
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %17, i64 %21
%23 = load i8, i8* %22
%24 = load i8*, i8** %5
%25 = load i16, i16* %3
%26 = zext i16 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
store i8 %23, i8* %27
br label %28
28: ; preds = %16
%29 = load i16, i16* %3
%30 = add i16 %29, 1
store i16 %30, i16* %3
br label %12
31: ; preds = %12
br label %34
32: ; preds = %1
%33 = load i32, i32* %2
store i32 %33, i32* %4
br label %34
34: ; preds = %32, %31
%35 = load i32, i32* %4
ret i32 %35
}

LLVM IR (-O2):
define i32 @convert_ID(i32 %0) {
%2 = tail call i64 (...) @is_littleendian()
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ acc_copyin(int *, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  int i;
#pragma acc enter data create(i)
  fprintf(stderr, "CheCKpOInT\n");
  acc_copyin(&i, sizeof i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ea3(%rip),%rax
mov    (%rax),%edi
lea    0xeba(%rip),%rsi
call   1040 <fprintf@plt>
lea    -0x14(%rbp),%rdi
mov    $0x4,%esi
call   1030 <acc_copyin@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1040 <fprintf@plt>
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
call   1030 <acc_copyin@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [12 x i8] c"CheCKpOInT\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @acc_copyin(i32* %6, i32 4)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [12 x i8] c"CheCKpOInT\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @acc_copyin(i32* %3, i32 4)
ret i32 0
}
/* Type definitions */
struct trie_node {
  int dummy;
};
struct trie_list {
  int dummy;
};

/* Variables and functions */
struct trie_list *_trie_node_list(struct trie_node *, int /*<<< orphan*/,
                                  int *);
struct trie_list *trie_node_list(struct trie_node *first) {
  int duplen;
  return _trie_node_list(first, 0, &duplen);
}


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

x86 assembly (clang, -O2):
<trie_node_list>:
push   %rax
lea    0x4(%rsp),%rdx
xor    %esi,%esi
call   1030 <_trie_node_list@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.trie_list = type { i32 }
%struct.trie_node = type { i32 }
define %struct.trie_list* @trie_node_list(%struct.trie_node* %0) {
%2 = alloca %struct.trie_node*
%3 = alloca i32
store %struct.trie_node* %0, %struct.trie_node** %2
%4 = load %struct.trie_node*, %struct.trie_node** %2
%5 = call %struct.trie_list* @_trie_node_list(%struct.trie_node* %4, i32 0, i32* %3)
ret %struct.trie_list* %5
}

LLVM IR (-O2):
%struct.trie_list = type { i32 }
%struct.trie_node = type { i32 }
define %struct.trie_list* @trie_node_list(%struct.trie_node* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call %struct.trie_list* @_trie_node_list(%struct.trie_node* %0, i32 0, i32* %2)
ret %struct.trie_list* %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
void testShiftRight() { printf("%d >> %d = %d\n", 100, 4, 100 >> 4); }


x86 assembly (clang, -O0):
<testShiftRight>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x64,%esi
mov    $0x4,%edx
mov    $0x6,%ecx
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<testShiftRight>:
lea    0xee9(%rip),%rdi
mov    $0x64,%esi
mov    $0x4,%edx
mov    $0x6,%ecx
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [15 x i8] c"%d >> %d = %d\0A\00"
define void @testShiftRight() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 100, i32 4, i32 6)
ret void
}
/* Type definitions */
struct proctal {
  int dummy;
};

/* Variables and functions */
int proctal_implementation_pid(struct proctal *);
int proctal_pid(struct proctal *p) { return proctal_implementation_pid(p); }


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

x86 assembly (clang, -O2):
<proctal_pid>:
jmp    1030 <proctal_implementation_pid@plt>

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

LLVM IR (-O2):
%struct.proctal = type { i32 }
define i32 @proctal_pid(%struct.proctal* %0) {
%2 = tail call i32 @proctal_implementation_pid(%struct.proctal* %0)
ret i32 %2
}
unsigned short int f29(unsigned short int x, int y) {
  return (x >> ((-y) & (8 * sizeof(unsigned short) - 1))) ^ (x << y);
}


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

x86 assembly (clang, -O2):
<f29>:
mov    %esi,%ecx
neg    %cl
and    $0xf,%cl
mov    %edi,%eax
shr    %cl,%eax
mov    %esi,%ecx
shl    %cl,%edi
xor    %edi,%eax
ret

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

LLVM IR (-O2):
define zeroext i16 @f29(i16 zeroext %0, i32 %1) {
%3 = zext i16 %0 to i32
%4 = sub nsw i32 0, %1
%5 = and i32 %4, 15
%6 = lshr i32 %3, %5
%7 = shl i32 %3, %1
%8 = xor i32 %6, %7
%9 = trunc i32 %8 to i16
ret i16 %9
}
/* Variables and functions */
int abs(int);
int gcd(int a, int b) {
  int val;
  b = abs(b);
  if (b > a)
    val = a, a = b, b = val;
  while (b != 0) {
    val = a % b;
    a = b;
    b = val;
  }
  return a;
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jle    1147 <gcd+0x37>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    114c <gcd+0x3c>
cmpl   $0x0,-0x8(%rbp)
je     1171 <gcd+0x61>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    114c <gcd+0x3c>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
mov    %esi,%edx
neg    %edx
cmovs  %esi,%edx
cmp    %edi,%edx
mov    %edi,%eax
cmovg  %edx,%eax
cmovg  %edi,%edx
test   %edx,%edx
je     112d <gcd+0x2d>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %edx,%ecx
cltd
idiv   %ecx
mov    %ecx,%eax
test   %edx,%edx
jne    1120 <gcd+0x20>
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @gcd(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* %4
%7 = call i32 @abs(i32 %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = load i32, i32* %3
%10 = icmp sgt i32 %8, %9
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* %3
store i32 %12, i32* %5
%13 = load i32, i32* %4
store i32 %13, i32* %3
%14 = load i32, i32* %5
store i32 %14, i32* %4
br label %15
15: ; preds = %11, %2
br label %16
16: ; preds = %19, %15
%17 = load i32, i32* %4
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %25
19: ; preds = %16
%20 = load i32, i32* %3
%21 = load i32, i32* %4
%22 = srem i32 %20, %21
store i32 %22, i32* %5
%23 = load i32, i32* %4
store i32 %23, i32* %3
%24 = load i32, i32* %5
store i32 %24, i32* %4
br label %16
25: ; preds = %16
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
define i32 @gcd(i32 %0, i32 %1) {
%3 = tail call i32 @llvm.abs.i32(i32 %1, i1 true)
%4 = icmp sgt i32 %3, %0
%5 = select i1 %4, i32 %3, i32 %0
%6 = select i1 %4, i32 %0, i32 %3
%7 = icmp eq i32 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %2, %8
%9 = phi i32 [ %11, %8 ], [ %6, %2 ]
%10 = phi i32 [ %9, %8 ], [ %5, %2 ]
%11 = srem i32 %10, %9
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %8
13: ; preds = %8, %2
%14 = phi i32 [ %5, %2 ], [ %9, %8 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ GC_add_entry(int /*<<< orphan*/);
int /*<<< orphan*/ ht_newpair(void *);
void GC_new(void *pointer) { GC_add_entry(ht_newpair(pointer)); }


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

x86 assembly (clang, -O2):
<GC_new>:
push   %rax
call   1040 <ht_newpair@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <GC_add_entry@plt>

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

LLVM IR (-O2):
define void @GC_new(i8* %0) {
%2 = tail call i32 @ht_newpair(i8* %0)
%3 = tail call i32 @GC_add_entry(i32 %2)
ret void
}
int t(unsigned int a, unsigned int b) { return (a <= b ? 5 : -5); }


x86 assembly (clang, -O0):
<t>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%esi
mov    $0xfffffffb,%eax
mov    $0x5,%ecx
cmp    %esi,%edx
cmovbe %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<t>:
cmp    %esi,%edi
mov    $0xfffffffb,%ecx
mov    $0x5,%eax
cmova  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @t(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp ule i32 %5, %6
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 5, i32 -5
ret i32 %9
}

LLVM IR (-O2):
define i32 @t(i32 %0, i32 %1) {
%3 = icmp ugt i32 %0, %1
%4 = select i1 %3, i32 -5, i32 5
ret i32 %4
}
/* Variables and functions */
double acos(double const);
void acosharmonic_value(const double r, const double *p, double *f) {
  double theta = acos(r);
  *f = p[0] * (theta - p[1]) * (theta - p[1]);
}


x86 assembly (clang, -O0):
<acosharmonic_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <acos@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x20(%rbp),%xmm1
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm1
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<acosharmonic_value>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <acos@plt>
subsd  0x8(%rbx),%xmm0
movsd  (%rbx),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @acosharmonic_value(double %0, double* %1, double* %2) {
%4 = alloca double
%5 = alloca double*
%6 = alloca double*
%7 = alloca double
store double %0, double* %4
store double* %1, double** %5
store double* %2, double** %6
%8 = load double, double* %4
%9 = call double @acos(double %8)
store double %9, double* %7
%10 = load double*, double** %5
%11 = getelementptr inbounds double, double* %10, i64 0
%12 = load double, double* %11
%13 = load double, double* %7
%14 = load double*, double** %5
%15 = getelementptr inbounds double, double* %14, i64 1
%16 = load double, double* %15
%17 = fsub double %13, %16
%18 = fmul double %12, %17
%19 = load double, double* %7
%20 = load double*, double** %5
%21 = getelementptr inbounds double, double* %20, i64 1
%22 = load double, double* %21
%23 = fsub double %19, %22
%24 = fmul double %18, %23
%25 = load double*, double** %6
store double %24, double* %25
ret void
}

LLVM IR (-O2):
define void @acosharmonic_value(double %0, double* nocapture %1, double* nocapture writeonly %2) {
%4 = tail call double @acos(double %0)
%5 = load double, double* %1
%6 = getelementptr inbounds double, double* %1, i64 1
%7 = load double, double* %6
%8 = fsub double %4, %7
%9 = fmul double %5, %8
%10 = fmul double %8, %9
store double %10, double* %2
ret void
}
int getPositionInAlphabet_DoWhile(char c) {
  int offset = -1;
  do {
    offset++;
  } while (offset < 26 && 'a' + offset != c);
  if (offset == 26) {
    return -1;
  }
  return offset;
}


x86 assembly (clang, -O0):
<getPositionInAlphabet_DoWhile>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movl   $0xffffffff,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0x1a,-0xc(%rbp)
mov    %al,-0xd(%rbp)
jge    113b <getPositionInAlphabet_DoWhile+0x3b>
mov    -0xc(%rbp),%eax
add    $0x61,%eax
movsbl -0x5(%rbp),%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1111 <getPositionInAlphabet_DoWhile+0x11>
cmpl   $0x1a,-0xc(%rbp)
jne    115c <getPositionInAlphabet_DoWhile+0x5c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1162 <getPositionInAlphabet_DoWhile+0x62>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getPositionInAlphabet_DoWhile>:
lea    -0x61(%rdi),%eax
cmp    $0x1a,%eax
mov    $0x1a,%ecx
cmovb  %eax,%ecx
mov    $0xffffffff,%eax
cmovb  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @getPositionInAlphabet_DoWhile(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, -97
%4 = call i32 @llvm.umin.i32(i32 %3, i32 26)
%5 = icmp ugt i32 %3, 25
%6 = select i1 %5, i32 -1, i32 %4
ret i32 %6
}
/* Type definitions */
struct altos_file {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ altos_putchar(struct altos_file *, char);
void altos_puts(struct altos_file *file, char *string) {
  char c;
  while ((c = *string++))
    altos_putchar(file, c);
}


x86 assembly (clang, -O0):
<altos_puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    %al,-0x11(%rbp)
cmp    $0x0,%al
je     114e <altos_puts+0x3e>
mov    -0x8(%rbp),%rdi
movsbl -0x11(%rbp),%esi
call   1030 <altos_putchar@plt>
jmp    1120 <altos_puts+0x10>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<altos_puts>:
push   %r14
push   %rbx
push   %rax
mov    (%rsi),%al
test   %al,%al
je     1146 <altos_puts+0x36>
mov    %rsi,%rbx
mov    %rdi,%r14
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl %al,%esi
mov    %r14,%rdi
call   1030 <altos_putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <altos_puts+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.altos_file = type { i32 }
define void @altos_puts(%struct.altos_file* %0, i8* %1) {
%3 = alloca %struct.altos_file*
%4 = alloca i8*
%5 = alloca i8
store %struct.altos_file* %0, %struct.altos_file** %3
store i8* %1, i8** %4
br label %6
6: ; preds = %11, %2
%7 = load i8*, i8** %4
%8 = getelementptr inbounds i8, i8* %7, i32 1
store i8* %8, i8** %4
%9 = load i8, i8* %7
store i8 %9, i8* %5
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %6
%12 = load %struct.altos_file*, %struct.altos_file** %3
%13 = load i8, i8* %5
%14 = call i32 @altos_putchar(%struct.altos_file* %12, i8 signext %13)
br label %6
15: ; preds = %6
ret void
}

LLVM IR (-O2):
%struct.altos_file = type { i32 }
define void @altos_puts(%struct.altos_file* %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %10, %5 ], [ %3, %2 ]
%7 = phi i8* [ %8, %5 ], [ %1, %2 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = tail call i32 @altos_putchar(%struct.altos_file* %0, i8 signext %6)
%10 = load i8, i8* %8
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %5, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
extern uint16_t ntohs(uint16_t x) { return x; }


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

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

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

LLVM IR (-O2):
define i32 @ntohs(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int XUnsetICFocus() {
  printf("XUnsetICFocus called\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [21 x i8] c"XUnsetICFocus called\00"
define i32 @XUnsetICFocus() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int jQualityScaling(int quality) {
  if (quality <= 0)
    quality = 1;
  if (quality > 100)
    quality = 100;
  if (quality < 50)
    quality = 5000 / quality;
  else
    quality = 200 - quality * 2;
  return quality;
}


x86 assembly (clang, -O0):
<jQualityScaling>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jg     1118 <jQualityScaling+0x18>
movl   $0x1,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jle    1129 <jQualityScaling+0x29>
movl   $0x64,-0x4(%rbp)
cmpl   $0x32,-0x4(%rbp)
jge    1144 <jQualityScaling+0x44>
mov    $0x1388,%eax
cltd
idivl  -0x4(%rbp)
mov    %eax,-0x4(%rbp)
jmp    1154 <jQualityScaling+0x54>
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
mov    $0xc8,%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<jQualityScaling>:
test   %edi,%edi
mov    $0x1,%eax
cmovg  %edi,%eax
cmp    $0x64,%eax
mov    $0x64,%ecx
cmovb  %eax,%ecx
cmp    $0x31,%ecx
ja     1127 <jQualityScaling+0x27>
mov    $0x1388,%ax
xor    %edx,%edx
div    %cx
movzwl %ax,%eax
ret
add    %ecx,%ecx
mov    $0xc8,%eax
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @jQualityScaling(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sle i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %1
store i32 1, i32* %2
br label %6
6: ; preds = %5, %1
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 100
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 100, i32* %2
br label %10
10: ; preds = %9, %6
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 50
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i32, i32* %2
%15 = sdiv i32 5000, %14
store i32 %15, i32* %2
br label %20
16: ; preds = %10
%17 = load i32, i32* %2
%18 = mul nsw i32 %17, 2
%19 = sub nsw i32 200, %18
store i32 %19, i32* %2
br label %20
20: ; preds = %16, %13
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
define i32 @jQualityScaling(i32 %0) {
%2 = icmp sgt i32 %0, 1
%3 = select i1 %2, i32 %0, i32 1
%4 = icmp ult i32 %3, 100
%5 = select i1 %4, i32 %3, i32 100
%6 = icmp ult i32 %5, 50
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = trunc i32 %5 to i16
%9 = udiv i16 5000, %8
%10 = zext i16 %9 to i32
br label %14
11: ; preds = %1
%12 = mul nsw i32 %5, -2
%13 = add nsw i32 %12, 200
br label %14
14: ; preds = %11, %7
%15 = phi i32 [ %10, %7 ], [ %13, %11 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ assert(char *);
unsigned int logic_decimal_is_negative(unsigned short to_compare,
                                       char *p_result) {
  assert(p_result);
  unsigned int err_code = 0;
  if (!p_result) {
    err_code = 2;
    goto end;
  }
  *p_result = (to_compare < 0);
end:
  return err_code;
}


x86 assembly (clang, -O0):
<logic_decimal_is_negative>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <assert@plt>
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114a <logic_decimal_is_negative+0x3a>
movl   $0x2,-0x14(%rbp)
jmp    1161 <logic_decimal_is_negative+0x51>
movzwl -0x2(%rbp),%eax
cmp    $0x0,%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logic_decimal_is_negative>:
push   %rbx
mov    %rsi,%rbx
mov    %rsi,%rdi
call   1030 <assert@plt>
test   %rbx,%rbx
je     1128 <logic_decimal_is_negative+0x18>
movb   $0x0,(%rbx)
xor    %eax,%eax
pop    %rbx
ret
mov    $0x2,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @logic_decimal_is_negative(i16 zeroext %0, i8* %1) {
%3 = alloca i16
%4 = alloca i8*
%5 = alloca i32
store i16 %0, i16* %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i32 @assert(i8* %6)
store i32 0, i32* %5
%8 = load i8*, i8** %4
%9 = icmp ne i8* %8, null
br i1 %9, label %11, label %10
10: ; preds = %2
store i32 2, i32* %5
br label %18
11: ; preds = %2
%12 = load i16, i16* %3
%13 = zext i16 %12 to i32
%14 = icmp slt i32 %13, 0
%15 = zext i1 %14 to i32
%16 = trunc i32 %15 to i8
%17 = load i8*, i8** %4
store i8 %16, i8* %17
br label %18
18: ; preds = %11, %10
%19 = load i32, i32* %5
ret i32 %19
}

LLVM IR (-O2):
define i32 @logic_decimal_is_negative(i16 zeroext %0, i8* %1) {
%3 = tail call i32 @assert(i8* %1)
%4 = icmp eq i8* %1, null
br i1 %4, label %6, label %5
5: ; preds = %2
store i8 0, i8* %1
br label %6
6: ; preds = %2, %5
%7 = phi i32 [ 0, %5 ], [ 2, %2 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void usage(const char *progname) {
  fprintf(stderr,
          "RC4 stream generator\n"
          "Usage: %s [options] -L length\n"
          "\t-i   Input from file, default is /dev/stdin\n"
          "\t-l   Input lenght (byte), default is 256\n"
          "\t-o   Output to file, default is /dev/stdout\n"
          "\t-L   Output lenght (byte), not null\n"
          "\t-b   Block size (byte), default is 8192\n"
          "\t-q   Output other information\n"
          "\t-h   Show this message\n"
          "\n",
          progname);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [318 x i8] c"RC4 stream generator\0AUsage: %s [options] -L length\0A\09-i Input from file, default is /dev/stdin\0A\09-l Input lenght (byte), default is 256\0A\09-o Output to file, default is /dev/stdout\0A\09-L Output lenght (byte), not null\0A\09-b Block size (byte), default is 8192\0A\09-q Output other information\0A\09-h Show this message\0A\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([318 x i8], [318 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [318 x i8] c"RC4 stream generator\0AUsage: %s [options] -L length\0A\09-i Input from file, default is /dev/stdin\0A\09-l Input lenght (byte), default is 256\0A\09-o Output to file, default is /dev/stdout\0A\09-L Output lenght (byte), not null\0A\09-b Block size (byte), default is 8192\0A\09-q Output other information\0A\09-h Show this message\0A\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([318 x i8], [318 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int minCut(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  if (!(minCut("aab") == 1)) {
    printf("assert fail: %s\n", "aab");
    exit(-1);
  };
  printf("everything is fine!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
call   1040 <minCut@plt>
cmp    $0x1,%eax
je     117a <main+0x4a>
lea    0xea2(%rip),%rdi
lea    0xe97(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1050 <minCut@plt>
cmp    $0x1,%eax
jne    1162 <main+0x22>
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xe9b(%rip),%rdi
lea    0xe90(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"aab\00"
@.str.1 = [17 x i8] c"assert fail: %s\0A\00"
@.str.2 = [21 x i8] c"everything is fine!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @minCut(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i32 %6, 1
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 -1)
unreachable
11: ; preds = %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"aab\00"
@.str.1 = [17 x i8] c"assert fail: %s\0A\00"
@str = [20 x i8] c"everything is fine!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @minCut(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 1
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 -1)
unreachable
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
ret i32 0
}