xunge/DecIR huggingface dataset:
/* Variables and functions */
int randInt(int);
int getRandomChromosomeOutput(int numInputs, int numNodes,
                              int shortcutConnections) {
  int output;
  if (shortcutConnections == 1)
    output = randInt(numInputs + numNodes);
  else
    output = randInt(numNodes) + numInputs;
  return output;
}


x86 assembly (clang, -O0):
<getRandomChromosomeOutput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    113e <getRandomChromosomeOutput+0x2e>
mov    -0x4(%rbp),%edi
add    -0x8(%rbp),%edi
call   1030 <randInt@plt>
mov    %eax,-0x10(%rbp)
jmp    114c <getRandomChromosomeOutput+0x3c>
mov    -0x8(%rbp),%edi
call   1030 <randInt@plt>
add    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getRandomChromosomeOutput>:
push   %rbx
mov    %edi,%ebx
cmp    $0x1,%edx
jne    1122 <getRandomChromosomeOutput+0x12>
add    %ebx,%esi
mov    %esi,%edi
pop    %rbx
jmp    1030 <randInt@plt>
mov    %esi,%edi
call   1030 <randInt@plt>
add    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @getRandomChromosomeOutput(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, 1
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = add nsw i32 %1, %0
%7 = tail call i32 @randInt(i32 %6)
br label %11
8: ; preds = %3
%9 = tail call i32 @randInt(i32 %1)
%10 = add nsw i32 %9, %0
br label %11
11: ; preds = %8, %5
%12 = phi i32 [ %7, %5 ], [ %10, %8 ]
ret i32 %12
}
/* Variables and functions */
int height(int);
float length_sum(int num) {
  if (1 == num)
    return 100;
  else
    return length_sum(num - 1) + 2 * height(num - 1);
}


x86 assembly (clang, -O0):
<length_sum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x1,%eax
cmp    -0x8(%rbp),%eax
jne    114b <length_sum+0x2b>
movss  0xebf(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    117b <length_sum+0x5b>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1040 <length_sum@plt>
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <height@plt>
movss  -0xc(%rbp),%xmm0
shl    $0x1,%eax
cvtsi2ss %eax,%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<length_sum>:
push   %rbx
sub    $0x10,%rsp
cmp    $0x1,%edi
jne    1134 <length_sum+0x14>
movss  0xece(%rip),%xmm0
jmp    115c <length_sum+0x3c>
mov    %edi,%ebx
add    $0xffffffff,%ebx
mov    %ebx,%edi
call   1040 <length_sum@plt>
movss  %xmm0,0xc(%rsp)
mov    %ebx,%edi
call   1030 <height@plt>
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
addss  0xc(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define float @length_sum(i32 %0) {
%2 = alloca float
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 1, %4
br i1 %5, label %6, label %7
6: ; preds = %1
store float 1.000000e+02, float* %2
br label %17
7: ; preds = %1
%8 = load i32, i32* %3
%9 = sub nsw i32 %8, 1
%10 = call float @length_sum(i32 %9)
%11 = load i32, i32* %3
%12 = sub nsw i32 %11, 1
%13 = call i32 @height(i32 %12)
%14 = mul nsw i32 2, %13
%15 = sitofp i32 %14 to float
%16 = fadd float %10, %15
store float %16, float* %2
br label %17
17: ; preds = %7, %6
%18 = load float, float* %2
ret float %18
}

LLVM IR (-O2):
define float @length_sum(i32 %0) {
%2 = icmp eq i32 %0, 1
br i1 %2, label %3, label %5
3: ; preds = %1, %5
%4 = phi float [ %11, %5 ], [ 1.000000e+02, %1 ]
ret float %4
5: ; preds = %1
%6 = add nsw i32 %0, -1
%7 = tail call float @length_sum(i32 %6)
%8 = tail call i32 @height(i32 %6)
%9 = shl nsw i32 %8, 1
%10 = sitofp i32 %9 to float
%11 = fadd float %7, %10
br label %3
}
int bar(int x, int y) { return (x * 2) | y; }


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
or     -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
lea    (%rdi,%rdi,1),%eax
or     %esi,%eax
ret

LLVM IR (-O0):
define i32 @bar(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 = mul nsw i32 %5, 2
%7 = load i32, i32* %4
%8 = or i32 %6, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @bar(i32 %0, i32 %1) {
%3 = shl nsw i32 %0, 1
%4 = or i32 %3, %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ PrintHelloFile2();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void PrintHelloWorldSubDir(void) {
  fprintf(stderr, "HELLO WORLD FROM A SUBDIR!\n");
  PrintHelloFile2();
}


x86 assembly (clang, -O0):
<PrintHelloWorldSubDir>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <PrintHelloFile2@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintHelloWorldSubDir>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <PrintHelloFile2@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"HELLO WORLD FROM A SUBDIR!\0A\00"
define void @PrintHelloWorldSubDir() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @PrintHelloFile2()
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"HELLO WORLD FROM A SUBDIR!\0A\00"
define void @PrintHelloWorldSubDir() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @PrintHelloFile2()
ret void
}
int iwe_stream_event_len_adjust(struct iw_request_info *info, int event_len) {
  return event_len;
}


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

x86 assembly (clang, -O2):
<iwe_stream_event_len_adjust>:
mov    %esi,%eax
ret

LLVM IR (-O0):
%struct.iw_request_info = type opaque
define i32 @iwe_stream_event_len_adjust(%struct.iw_request_info* %0, i32 %1) {
%3 = alloca %struct.iw_request_info*
%4 = alloca i32
store %struct.iw_request_info* %0, %struct.iw_request_info** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
%struct.iw_request_info = type opaque
define i32 @iwe_stream_event_len_adjust(%struct.iw_request_info* nocapture readnone %0, i32 returned %1) {
ret i32 %1
}
char *grecs_grecs_stpcpy(char *grecs_grecs_dest, const char *grecs_grecs_src) {
  char *grecs_grecs_d = grecs_grecs_dest;
  const char *grecs_grecs_s = grecs_grecs_src;
  while ((*grecs_grecs_d++ = *grecs_grecs_s++) != '\0')
    continue;
  return grecs_grecs_d - 1;
}


x86 assembly (clang, -O0):
<grecs_grecs_stpcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%al
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
je     114f <grecs_grecs_stpcpy+0x4f>
jmp    111c <grecs_grecs_stpcpy+0x1c>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<grecs_grecs_stpcpy>:
mov    %rdi,%rax
add    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
movzbl (%rsi),%ecx
add    $0x1,%rsi
mov    %cl,0x1(%rax)
add    $0x1,%rax
test   %cl,%cl
jne    1110 <grecs_grecs_stpcpy+0x10>
ret

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

LLVM IR (-O2):
define i8* @grecs_grecs_stpcpy(i8* writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %8, %3 ]
%5 = phi i8* [ %1, %2 ], [ %6, %3 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = load i8, i8* %5
%8 = getelementptr inbounds i8, i8* %4, i64 1
store i8 %7, i8* %4
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret i8* %4
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ prg8setBank0(int);
void m48setParams8XX0(uint16_t addr, uint8_t val) {
  (void)addr;
  prg8setBank0((val & 0x3F) << 13);
}


x86 assembly (clang, -O0):
<m48setParams8XX0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
and    $0x3f,%edi
shl    $0xd,%edi
call   1030 <prg8setBank0@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m48setParams8XX0>:
mov    %esi,%edi
and    $0x3f,%edi
shl    $0xd,%edi
jmp    1030 <prg8setBank0@plt>

LLVM IR (-O0):
define void @m48setParams8XX0(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 = and i32 %6, 63
%8 = shl i32 %7, 13
%9 = call i32 @prg8setBank0(i32 %8)
ret void
}

LLVM IR (-O2):
define void @m48setParams8XX0(i32 %0, i32 %1) {
%3 = shl i32 %1, 13
%4 = and i32 %3, 516096
%5 = tail call i32 @prg8setBank0(i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printGraphic(char *);
int main(void) {
  char str[10] = "123456";
  printGraphic(str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0xe(%rbp)
mov    0xed7(%rip),%ax
mov    %ax,-0x6(%rbp)
lea    -0xe(%rbp),%rdi
call   1030 <printGraphic@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movabs $0x363534333231,%rax
mov    %rax,0x8(%rsp)
movw   $0x0,0x10(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <printGraphic@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.str = [10 x i8] c"123456\00\00\00\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
store i32 0, i32* %1
%3 = bitcast [10 x i8]* %2 to i8*
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%5 = call i32 @printGraphic(i8* %4)
ret i32 0
}

LLVM IR (-O2):
@__const.main.str = [10 x i8] c"123456\00\00\00\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = call i32 @printGraphic(i8* %2)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int32_t ev3_motor_config(int32_t port, int32_t type) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @ev3_motor_config(i32 %0, i32 %1) {
ret i32 0
}
/* Type definitions */
struct opaque_auth {
  int dummy;
};
typedef int /*<<< orphan*/ AUTH;

/* Variables and functions */
int TRUE;
int authnone_validate(AUTH *client, struct opaque_auth *opaque) {
  return (TRUE);
}


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

x86 assembly (clang, -O2):
<authnone_validate>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
%struct.opaque_auth = type { i32 }
@TRUE = global i32 0
define i32 @authnone_validate(i32* %0, %struct.opaque_auth* %1) {
%3 = alloca i32*
%4 = alloca %struct.opaque_auth*
store i32* %0, i32** %3
store %struct.opaque_auth* %1, %struct.opaque_auth** %4
%5 = load i32, i32* @TRUE
ret i32 %5
}

LLVM IR (-O2):
%struct.opaque_auth = type { i32 }
@TRUE = global i32 0
define i32 @authnone_validate(i32* nocapture readnone %0, %struct.opaque_auth* nocapture readnone %1) {
%3 = load i32, i32* @TRUE
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;
struct ns_connection {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ns_send_mqtt_short_command(struct ns_connection *, int,
                                              int /*<<< orphan*/);
void ns_mqtt_pubrel(struct ns_connection *nc, uint16_t message_id) {
  ns_send_mqtt_short_command(nc, 6, message_id);
}


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

x86 assembly (clang, -O2):
<ns_mqtt_pubrel>:
mov    %esi,%edx
mov    $0x6,%esi
jmp    1030 <ns_send_mqtt_short_command@plt>

LLVM IR (-O0):
%struct.ns_connection = type { i32 }
define void @ns_mqtt_pubrel(%struct.ns_connection* %0, i32 %1) {
%3 = alloca %struct.ns_connection*
%4 = alloca i32
store %struct.ns_connection* %0, %struct.ns_connection** %3
store i32 %1, i32* %4
%5 = load %struct.ns_connection*, %struct.ns_connection** %3
%6 = load i32, i32* %4
%7 = call i32 @ns_send_mqtt_short_command(%struct.ns_connection* %5, i32 6, i32 %6)
ret void
}

LLVM IR (-O2):
%struct.ns_connection = type { i32 }
define void @ns_mqtt_pubrel(%struct.ns_connection* %0, i32 %1) {
%3 = tail call i32 @ns_send_mqtt_short_command(%struct.ns_connection* %0, i32 6, i32 %1)
ret void
}
int INT_OP(int x) { return x++; }


x86 assembly (clang, -O0):
<INT_OP>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x4(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @INT_OP(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 1
store i32 %4, i32* %2
ret i32 %3
}

LLVM IR (-O2):
define i32 @INT_OP(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int CHAR_BIT;
size_t utf8len(char const *s) {
  size_t len = 0;
  char const *c;
  for (c = s; *c; ++c) {
    if ((((unsigned char)(*c)) >> (CHAR_BIT - 2) != 2)) {
      len += 1;
    }
  }
  return len;
}


x86 assembly (clang, -O0):
<utf8len>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1165 <utf8len+0x65>
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
mov    0x2ead(%rip),%rcx
mov    (%rcx),%ecx
sub    $0x2,%ecx
sar    %cl,%eax
cmp    $0x2,%eax
je     114f <utf8len+0x4f>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1154 <utf8len+0x54>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1118 <utf8len+0x18>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<utf8len>:
mov    (%rdi),%dl
test   %dl,%dl
je     113d <utf8len+0x3d>
mov    0x2ed3(%rip),%rax
mov    (%rax),%ecx
add    $0xfffffffe,%ecx
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
movzbl %dl,%edx
shr    %cl,%edx
xor    %esi,%esi
cmp    $0x2,%edx
setne  %sil
add    %rsi,%rax
movzbl (%rdi),%edx
add    $0x1,%rdi
test   %dl,%dl
jne    1120 <utf8len+0x20>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
@CHAR_BIT = global i32 0
define i64 @utf8len(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %19, label %4
4: ; preds = %1
%5 = load i32, i32* @CHAR_BIT
%6 = add nsw i32 %5, -2
br label %7
7: ; preds = %4, %7
%8 = phi i8 [ %2, %4 ], [ %17, %7 ]
%9 = phi i8* [ %0, %4 ], [ %16, %7 ]
%10 = phi i64 [ 0, %4 ], [ %15, %7 ]
%11 = zext i8 %8 to i32
%12 = lshr i32 %11, %6
%13 = icmp ne i32 %12, 2
%14 = zext i1 %13 to i64
%15 = add i64 %10, %14
%16 = getelementptr inbounds i8, i8* %9, i64 1
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %7
19: ; preds = %7, %1
%20 = phi i64 [ 0, %1 ], [ %15, %7 ]
ret i64 %20
}
/* Variables and functions */
int atoi(char *);
int read(int, char *, int);
int read_int(int fd) {
  char buff[21];
  int len = read(fd, buff, 20);
  buff[len] = 0;
  return atoi(buff);
}


x86 assembly (clang, -O0):
<read_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0x14,%edx
call   1030 <read@plt>
mov    %eax,-0x24(%rbp)
movslq -0x24(%rbp),%rax
movb   $0x0,-0x20(%rbp,%rax,1)
lea    -0x20(%rbp),%rdi
call   1040 <atoi@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_int>:
push   %rbx
sub    $0x20,%rsp
mov    %rsp,%rbx
mov    %rbx,%rsi
mov    $0x14,%edx
call   1030 <read@plt>
cltq
movb   $0x0,(%rsp,%rax,1)
mov    %rbx,%rdi
call   1040 <atoi@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @read_int(i32 %0) {
%2 = alloca i32
%3 = alloca [21 x i8]
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%7 = call i32 @read(i32 %5, i8* %6, i32 20)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 %9
store i8 0, i8* %10
%11 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%12 = call i32 @atoi(i8* %11)
ret i32 %12
}

LLVM IR (-O2):
define i32 @read_int(i32 %0) {
%2 = alloca [21 x i8]
%3 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%4 = call i32 @read(i32 %0, i8* %3, i32 20)
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 %5
store i8 0, i8* %6
%7 = call i32 @atoi(i8* %3)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void printhelp() {
  printf("Usage:\n"
         "  traceroute [-t timeout ] [ -m maxttl ] [ -r requests ] addr\n"
         "Options:\n"
         "  -t timeout  | --timeout timeout\n"
         "    Set maximum waiting time for responses in miliseconds (default: "
         "1000).\n"
         "  -m maxttl   | --maxttl maxttl\n"
         "    Set maximum TTL value (default: 30).\n"
         "  -r requests | --requests requests\n"
         "    Set number of requests for each TTL value (default: 3).\n");
}


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

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

LLVM IR (-O0):
@.str = [357 x i8] c"Usage:\0A traceroute [-t timeout ] [ -m maxttl ] [ -r requests ] addr\0AOptions:\0A -t timeout | --timeout timeout\0A Set maximum waiting time for responses in miliseconds (default: 1000).\0A -m maxttl | --maxttl maxttl\0A Set maximum TTL value (default: 30).\0A -r requests | --requests requests\0A Set number of requests for each TTL value (default: 3).\0A\00"
define void @printhelp() {
%1 = call i32 @printf(i8* getelementptr inbounds ([357 x i8], [357 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [356 x i8] c"Usage:\0A traceroute [-t timeout ] [ -m maxttl ] [ -r requests ] addr\0AOptions:\0A -t timeout | --timeout timeout\0A Set maximum waiting time for responses in miliseconds (default: 1000).\0A -m maxttl | --maxttl maxttl\0A Set maximum TTL value (default: 30).\0A -r requests | --requests requests\0A Set number of requests for each TTL value (default: 3).\00"
define void @printhelp() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([356 x i8], [356 x i8]* @str, i64 0, i64 0))
ret void
}
int isValid(int i, int idx1, int idx2, int n) {
  if (idx1 > n) {
    if (idx2 < n) {
      return 1;
    } else {
      return 0;
    }
  }
  if (idx2 > n) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<isValid>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    1140 <isValid+0x40>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1134 <isValid+0x34>
movl   $0x1,-0x4(%rbp)
jmp    115f <isValid+0x5f>
movl   $0x0,-0x4(%rbp)
jmp    115f <isValid+0x5f>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    1158 <isValid+0x58>
movl   $0x1,-0x4(%rbp)
jmp    115f <isValid+0x5f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isValid>:
xor    %eax,%eax
xor    %edi,%edi
cmp    %ecx,%edx
setl   %al
setg   %dil
cmp    %ecx,%esi
cmovg  %eax,%edi
movzbl %dil,%eax
ret

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

LLVM IR (-O2):
define i32 @isValid(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %1, %3
%6 = icmp slt i32 %2, %3
%7 = icmp sgt i32 %2, %3
%8 = select i1 %5, i1 %6, i1 %7
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Variables and functions */
int connHUP();
int connRESETbypeer();
int poll_error(int fd) {
  if (connRESETbypeer() == fd)
    return -1;
  if (connHUP() == fd)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<poll_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <connRESETbypeer@plt>
cmp    -0x8(%rbp),%eax
jne    1147 <poll_error+0x27>
movl   $0xffffffff,-0x4(%rbp)
jmp    116a <poll_error+0x4a>
mov    $0x0,%al
call   1030 <connHUP@plt>
cmp    -0x8(%rbp),%eax
jne    1163 <poll_error+0x43>
movl   $0xffffffff,-0x4(%rbp)
jmp    116a <poll_error+0x4a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<poll_error>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <connRESETbypeer@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ebx,%ecx
je     1147 <poll_error+0x27>
xor    %eax,%eax
call   1030 <connHUP@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ebx,%ecx
sete   %al
neg    %eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @poll_error(i32 %0) {
%2 = tail call i32 (...) @connRESETbypeer()
%3 = icmp eq i32 %2, %0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 (...) @connHUP()
%6 = icmp eq i32 %5, %0
%7 = sext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ -1, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *);
scalar_t__ strlen(char *);
void cmdline_parser_print_version(void) {
  printf("%s %s\n",
         (strlen("Fractal NonGUI") ? "Fractal NonGUI" : "Fractal NonGUI"),
         "1.0");
}


x86 assembly (clang, -O0):
<cmdline_parser_print_version>:
push   %rbp
mov    %rsp,%rbp
lea    0xedc(%rip),%rdi
call   1030 <strlen@plt>
lea    0xed0(%rip),%rsi
cmp    $0x0,%rax
cmovne %rsi,%rsi
lea    0xeba(%rip),%rdi
lea    0xec9(%rip),%rdx
call   1040 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmdline_parser_print_version>:
lea    0xee9(%rip),%rdi
lea    0xee9(%rip),%rsi
lea    0xef1(%rip),%rdx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"%s %s\0A\00"
@.str.1 = [15 x i8] c"Fractal NonGUI\00"
@.str.2 = [4 x i8] c"1.0\00"
define void @cmdline_parser_print_version() {
%1 = call i64 @strlen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i64
%4 = select i1 %2, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0)
%5 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s %s\0A\00"
@.str.1 = [15 x i8] c"Fractal NonGUI\00"
@.str.2 = [4 x i8] c"1.0\00"
define void @cmdline_parser_print_version() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
int rightrot(int, int);
int main() {
  printf("%d\n%d\n%d\n", 0b101111001, rightrot(0b101111001, 0b11), 0b001101111);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x179,%edi
mov    $0x3,%esi
call   1040 <rightrot@plt>
mov    %eax,%edx
lea    0xec4(%rip),%rdi
mov    $0x179,%esi
mov    $0x6f,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x179,%edi
mov    $0x3,%esi
call   1040 <rightrot@plt>
lea    0xec9(%rip),%rdi
mov    $0x179,%esi
mov    %eax,%edx
mov    $0x6f,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%d\0A%d\0A%d\0A\00"
define i32 @main() {
%1 = call i32 @rightrot(i32 377, i32 3)
%2 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 377, i32 %1, i32 111)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"%d\0A%d\0A%d\0A\00"
define i32 @main() {
%1 = tail call i32 @rightrot(i32 377, i32 3)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 377, i32 %1, i32 111)
ret i32 0
}
/* Variables and functions */
scalar_t__ realloc(char *, int);
char *reallocMemory(char *string, int *maxMemory) {
  *maxMemory += (*maxMemory < 100) ? 10 : *maxMemory / 2;
  string = (char *)realloc(string, *maxMemory * sizeof(char));
  return string;
}


x86 assembly (clang, -O0):
<reallocMemory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x64,(%rax)
jge    113a <reallocMemory+0x2a>
mov    $0xa,%eax
mov    %eax,-0x14(%rbp)
jmp    114b <reallocMemory+0x3b>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq (%rax),%rax
shl    $0x0,%rax
mov    %eax,%esi
call   1030 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reallocMemory>:
mov    (%rsi),%ecx
mov    $0xa,%eax
cmp    $0x64,%ecx
jl     1125 <reallocMemory+0x15>
mov    %ecx,%eax
shr    $0x1f,%eax
add    %ecx,%eax
sar    %eax
add    %ecx,%eax
mov    %eax,(%rsi)
mov    %eax,%esi
jmp    1030 <realloc@plt>

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

LLVM IR (-O2):
define i8* @reallocMemory(i8* %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 100
%5 = sdiv i32 %3, 2
%6 = select i1 %4, i32 10, i32 %5
%7 = add nsw i32 %6, %3
store i32 %7, i32* %1
%8 = tail call i64 @realloc(i8* %0, i32 %7)
%9 = inttoptr i64 %8 to i8*
ret i8* %9
}
/* Variables and functions */
int /*<<< orphan*/ COLOR_PAIR(int);
scalar_t__ LINES;
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ attroff(int /*<<< orphan*/);
int /*<<< orphan*/ attron(int /*<<< orphan*/);
int /*<<< orphan*/ mvaddstr(scalar_t__, int /*<<< orphan*/, char *);
void drawmessage(char *msg) {
  assert(msg != NULL);
  attron(COLOR_PAIR(1));
  mvaddstr(LINES - 1, 0, msg);
  attroff(COLOR_PAIR(1));
}


x86 assembly (clang, -O0):
<drawmessage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x1,%edi
call   1060 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1040 <attron@plt>
mov    0x2e62(%rip),%rax
mov    (%rax),%rdi
sub    $0x1,%rdi
mov    -0x8(%rbp),%rdx
xor    %esi,%esi
call   1070 <mvaddstr@plt>
mov    $0x1,%edi
call   1060 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawmessage>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1050 <assert@plt>
mov    $0x1,%edi
call   1060 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1040 <attron@plt>
mov    0x2e6e(%rip),%rax
mov    (%rax),%rdi
add    $0xffffffffffffffff,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1070 <mvaddstr@plt>
mov    $0x1,%edi
call   1060 <COLOR_PAIR@plt>
mov    %eax,%edi
pop    %rbx
jmp    1030 <attroff@plt>

LLVM IR (-O0):
@LINES = global i64 0
define void @drawmessage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = call i32 @COLOR_PAIR(i32 1)
%8 = call i32 @attron(i32 %7)
%9 = load i64, i64* @LINES
%10 = sub nsw i64 %9, 1
%11 = load i8*, i8** %2
%12 = call i32 @mvaddstr(i64 %10, i32 0, i8* %11)
%13 = call i32 @COLOR_PAIR(i32 1)
%14 = call i32 @attroff(i32 %13)
ret void
}

LLVM IR (-O2):
@LINES = global i64 0
define void @drawmessage(i8* %0) {
%2 = icmp ne i8* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @COLOR_PAIR(i32 1)
%6 = tail call i32 @attron(i32 %5)
%7 = load i64, i64* @LINES
%8 = add nsw i64 %7, -1
%9 = tail call i32 @mvaddstr(i64 %8, i32 0, i8* %0)
%10 = tail call i32 @COLOR_PAIR(i32 1)
%11 = tail call i32 @attroff(i32 %10)
ret void
}
float power_level() {}


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

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

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

LLVM IR (-O2):
define float @power_level() {
ret float undef
}
int goal_state_resume(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @goal_state_resume() {
ret i32 0
}

LLVM IR (-O2):
define i32 @goal_state_resume() {
ret i32 0
}
/* Type definitions */
typedef size_t uint32_t;

/* Variables and functions */
int rand();
void generate_random(unsigned char *buf, uint32_t sz) {
  uint32_t i;
  for (i = 0; i < sz; ++i)
    buf[i] = (unsigned char)(rand() % 255);
  buf[(sz - 1)] = 0;
}


x86 assembly (clang, -O0):
<generate_random>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1161 <generate_random+0x51>
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0xff,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <generate_random+0x18>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_random>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
test   %rsi,%rsi
je     115f <generate_random+0x4f>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0xffffffff80808081,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
shr    $0x7,%ecx
add    %edx,%ecx
add    %eax,%ecx
mov    %cl,(%r14,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <generate_random+0x20>
movb   $0x0,-0x1(%r15,%r14,1)
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @generate_random(i8* nocapture writeonly %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %12, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %10, %4 ], [ 0, %2 ]
%6 = tail call i32 (...) @rand()
%7 = srem i32 %6, 255
%8 = trunc i32 %7 to i8
%9 = getelementptr inbounds i8, i8* %0, i64 %5
store i8 %8, i8* %9
%10 = add nuw i64 %5, 1
%11 = icmp eq i64 %10, %1
br i1 %11, label %12, label %4
12: ; preds = %4, %2
%13 = add i64 %1, -1
%14 = getelementptr inbounds i8, i8* %0, i64 %13
store i8 0, i8* %14
ret void
}
/* Variables and functions */
int fn_sq_ch_94_ch_94(char const *);
int fn_al_sq_ch_94_ch_94(const char *text) {
  int pos = 0;
  pos = fn_sq_ch_94_ch_94(text);
  if (pos != -1)
    return pos;
  return -1;
}


x86 assembly (clang, -O0):
<fn_al_sq_ch_94_ch_94>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fn_sq_ch_94_ch_94@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
je     1144 <fn_al_sq_ch_94_ch_94+0x34>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114b <fn_al_sq_ch_94_ch_94+0x3b>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn_al_sq_ch_94_ch_94>:
jmp    1030 <fn_sq_ch_94_ch_94@plt>

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

LLVM IR (-O2):
define i32 @fn_al_sq_ch_94_ch_94(i8* %0) {
%2 = tail call i32 @fn_sq_ch_94_ch_94(i8* %0)
ret i32 %2
}
int avi_stream_id(unsigned int id) {
  unsigned char a, b;
  a = id - '0';
  b = (id >> 8) - '0';
  if (a > 9 || b > 9)
    return 100;
  return a * 10 + b;
}


x86 assembly (clang, -O0):
<avi_stream_id>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x30,%eax
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x8,%eax
sub    $0x30,%eax
mov    %al,-0xa(%rbp)
movzbl -0x9(%rbp),%eax
cmp    $0x9,%eax
jg     1136 <avi_stream_id+0x36>
movzbl -0xa(%rbp),%eax
cmp    $0x9,%eax
jle    1142 <avi_stream_id+0x42>
movl   $0x64,-0x4(%rbp)
jmp    1152 <avi_stream_id+0x52>
movzbl -0x9(%rbp),%eax
imul   $0xa,%eax,%eax
movzbl -0xa(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<avi_stream_id>:
lea    0xd0(%rdi),%eax
shr    $0x8,%edi
add    $0xd0,%edi
movzbl %al,%ecx
movzbl %dil,%eax
cmp    $0xa,%eax
lea    (%rcx,%rcx,4),%edx
lea    (%rax,%rdx,2),%eax
mov    $0x64,%edx
cmovae %edx,%eax
cmp    $0xa,%ecx
cmovae %edx,%eax
ret

LLVM IR (-O0):
define i32 @avi_stream_id(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
%5 = alloca i8
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = sub i32 %6, 48
%8 = trunc i32 %7 to i8
store i8 %8, i8* %4
%9 = load i32, i32* %3
%10 = lshr i32 %9, 8
%11 = sub i32 %10, 48
%12 = trunc i32 %11 to i8
store i8 %12, i8* %5
%13 = load i8, i8* %4
%14 = zext i8 %13 to i32
%15 = icmp sgt i32 %14, 9
br i1 %15, label %20, label %16
16: ; preds = %1
%17 = load i8, i8* %5
%18 = zext i8 %17 to i32
%19 = icmp sgt i32 %18, 9
br i1 %19, label %20, label %21
20: ; preds = %16, %1
store i32 100, i32* %2
br label %28
21: ; preds = %16
%22 = load i8, i8* %4
%23 = zext i8 %22 to i32
%24 = mul nsw i32 %23, 10
%25 = load i8, i8* %5
%26 = zext i8 %25 to i32
%27 = add nsw i32 %24, %26
store i32 %27, i32* %2
br label %28
28: ; preds = %21, %20
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
define i32 @avi_stream_id(i32 %0) {
%2 = add i32 %0, 208
%3 = lshr i32 %0, 8
%4 = add nuw nsw i32 %3, 208
%5 = and i32 %2, 255
%6 = icmp ugt i32 %5, 9
%7 = and i32 %4, 255
%8 = icmp ugt i32 %7, 9
%9 = select i1 %6, i1 true, i1 %8
%10 = mul nuw nsw i32 %5, 10
%11 = add nuw nsw i32 %10, %7
%12 = select i1 %9, i32 100, i32 %11
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ USBSTK5515_wait(unsigned long);
void USBSTK5515_waitusec(unsigned long usec) {
  USBSTK5515_wait((unsigned long)usec * 8);
}


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

x86 assembly (clang, -O2):
<USBSTK5515_waitusec>:
shl    $0x3,%rdi
jmp    1030 <USBSTK5515_wait@plt>

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

LLVM IR (-O2):
define void @USBSTK5515_waitusec(i64 %0) {
%2 = shl i64 %0, 3
%3 = tail call i32 @USBSTK5515_wait(i64 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bios_putchar(int);
void putchar(int ch) {
  if (ch == '\n')
    putchar('\r');
  bios_putchar(ch);
}


x86 assembly (clang, -O0):
<putchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jne    113f <putchar+0x1f>
mov    $0xd,%edi
call   1030 <putchar@plt>
mov    -0x4(%rbp),%edi
call   1040 <bios_putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putchar>:
push   %rbx
mov    %edi,%ebx
cmp    $0xa,%edi
jne    1122 <putchar+0x12>
mov    $0xd,%edi
call   1030 <bios_putchar@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <bios_putchar@plt>

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

LLVM IR (-O2):
define void @putchar(i32 %0) {
%2 = icmp eq i32 %0, 10
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @bios_putchar(i32 13)
br label %5
5: ; preds = %3, %1
%6 = tail call i32 @bios_putchar(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ factorial_func(int);
main() {
  factorial_func(6);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x6,%edi
call   1030 <factorial_func@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @factorial_func(i32 6)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @factorial_func(i32 6)
ret i32 0
}
char esc2chr(char c) {
  switch (c) {
  case 'n':
    return '\n';
  default:
    return c;
  }
}


x86 assembly (clang, -O0):
<esc2chr>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
sub    $0x6e,%al
jne    1123 <esc2chr+0x23>
jmp    111a <esc2chr+0x1a>
movb   $0xa,-0x1(%rbp)
jmp    1129 <esc2chr+0x29>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<esc2chr>:
cmp    $0x6e,%dil
mov    $0xa,%eax
cmovne %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @esc2chr(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %7 [
i32 110, label %6
]
6: ; preds = %1
store i8 10, i8* %2
br label %9
7: ; preds = %1
%8 = load i8, i8* %3
store i8 %8, i8* %2
br label %9
9: ; preds = %7, %6
%10 = load i8, i8* %2
ret i8 %10
}

LLVM IR (-O2):
define signext i8 @esc2chr(i8 signext %0) {
%2 = icmp eq i8 %0, 110
%3 = select i1 %2, i8 10, i8 %0
ret i8 %3
}
/* Variables and functions */
int /*<<< orphan*/ db(int);
void fninit() {
  db(0xDB);
  db(0xE3);
}


x86 assembly (clang, -O0):
<fninit>:
push   %rbp
mov    %rsp,%rbp
mov    $0xdb,%edi
call   1030 <db@plt>
mov    $0xe3,%edi
call   1030 <db@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fninit>:
push   %rax
mov    $0xdb,%edi
call   1030 <db@plt>
mov    $0xe3,%edi
pop    %rax
jmp    1030 <db@plt>

LLVM IR (-O0):
define void @fninit() {
%1 = call i32 @db(i32 219)
%2 = call i32 @db(i32 227)
ret void
}

LLVM IR (-O2):
define void @fninit() {
%1 = tail call i32 @db(i32 219)
%2 = tail call i32 @db(i32 227)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void print_str(char *str) {
  char c;
  while ((c = *str)) {
    putchar(c);
    str++;
  }
}


x86 assembly (clang, -O0):
<print_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x9(%rbp)
cmp    $0x0,%al
je     1147 <print_str+0x37>
movsbl -0x9(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <print_str+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_str>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <print_str+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <print_str+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @print_str(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call i32 @putchar(i8 signext %5)
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
long __max_long(long x, long y) { return ((x) > (y) ? (x) : (y)); }


x86 assembly (clang, -O0):
<__max_long>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jle    1127 <__max_long+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <__max_long+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__max_long>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovg  %rdi,%rax
ret

LLVM IR (-O0):
define i64 @__max_long(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp sgt i64 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i64, i64* %3
br label %12
10: ; preds = %2
%11 = load i64, i64* %4
br label %12
12: ; preds = %10, %8
%13 = phi i64 [ %9, %8 ], [ %11, %10 ]
ret i64 %13
}

LLVM IR (-O2):
define i64 @__max_long(i64 %0, i64 %1) {
%3 = icmp sgt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}