xunge/DecIR huggingface dataset:
int avi_stream_id(unsigned int id) {
  unsigned char *p = (unsigned char *)&id;
  unsigned char a, b;
  a = p[0] - '0';
  b = p[1] - '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)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
sub    $0x30,%eax
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
movzbl 0x1(%rax),%eax
sub    $0x30,%eax
mov    %al,-0x12(%rbp)
movzbl -0x11(%rbp),%eax
cmp    $0x9,%eax
jg     1144 <avi_stream_id+0x44>
movzbl -0x12(%rbp),%eax
cmp    $0x9,%eax
jle    1150 <avi_stream_id+0x50>
movl   $0x64,-0x4(%rbp)
jmp    1160 <avi_stream_id+0x60>
movzbl -0x11(%rbp),%eax
imul   $0xa,%eax,%eax
movzbl -0x12(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<avi_stream_id>:
mov    %edi,%eax
shr    $0x8,%eax
add    $0xd0,%edi
add    $0xd0,%eax
movzbl %dil,%ecx
movzbl %al,%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
%6 = alloca i8
store i32 %0, i32* %3
%7 = bitcast i32* %3 to i8*
store i8* %7, i8** %4
%8 = load i8*, i8** %4
%9 = getelementptr inbounds i8, i8* %8, i64 0
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = sub nsw i32 %11, 48
%13 = trunc i32 %12 to i8
store i8 %13, i8* %5
%14 = load i8*, i8** %4
%15 = getelementptr inbounds i8, i8* %14, i64 1
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = sub nsw i32 %17, 48
%19 = trunc i32 %18 to i8
store i8 %19, i8* %6
%20 = load i8, i8* %5
%21 = zext i8 %20 to i32
%22 = icmp sgt i32 %21, 9
br i1 %22, label %27, label %23
23: ; preds = %1
%24 = load i8, i8* %6
%25 = zext i8 %24 to i32
%26 = icmp sgt i32 %25, 9
br i1 %26, label %27, label %28
27: ; preds = %23, %1
store i32 100, i32* %2
br label %35
28: ; preds = %23
%29 = load i8, i8* %5
%30 = zext i8 %29 to i32
%31 = mul nsw i32 %30, 10
%32 = load i8, i8* %6
%33 = zext i8 %32 to i32
%34 = add nsw i32 %31, %33
store i32 %34, i32* %2
br label %35
35: ; preds = %28, %27
%36 = load i32, i32* %2
ret i32 %36
}

LLVM IR (-O2):
define i32 @avi_stream_id(i32 %0) {
%2 = lshr i32 %0, 8
%3 = add i32 %0, 208
%4 = add nuw nsw i32 %2, 208
%5 = and i32 %3, 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*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
void my_error(char *string) {
  printf("***** Auton software error:\n***** %s\n", string);
  exit(-1);
}


x86 assembly (clang, -O0):
<my_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<my_error>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"***** Auton software error:\0A***** %s\0A\00"
define void @my_error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@.str = [38 x i8] c"***** Auton software error:\0A***** %s\0A\00"
define void @my_error(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 -1)
unreachable
}
int PDC_get_columns() {}


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

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

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

LLVM IR (-O2):
define i32 @PDC_get_columns() {
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ __m64;

/* Variables and functions */
int /*<<< orphan*/ _mm_sub_pi32(int /*<<< orphan*/, int /*<<< orphan*/);
__m64 test_mm_sub_pi32(__m64 a, __m64 b) { return _mm_sub_pi32(a, b); }


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

x86 assembly (clang, -O2):
<test_mm_sub_pi32>:
jmp    1030 <_mm_sub_pi32@plt>

LLVM IR (-O0):
define i32 @test_mm_sub_pi32(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 = call i32 @_mm_sub_pi32(i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @test_mm_sub_pi32(i32 %0, i32 %1) {
%3 = tail call i32 @_mm_sub_pi32(i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ bson_free_func(void *);
void bson_free(void *ptr) { bson_free_func(ptr); }


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

x86 assembly (clang, -O2):
<bson_free>:
jmp    1030 <bson_free_func@plt>

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

LLVM IR (-O2):
define void @bson_free(i8* %0) {
%2 = tail call i32 @bson_free_func(i8* %0)
ret void
}
/* Type definitions */
struct sched_param {
  int __sched_priority;
};
typedef int /*<<< orphan*/ pthread_attr_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ printf(char *, int);
int pthread_attr_getschedparam(int /*<<< orphan*/ *, struct sched_param *);
int get_thread_priority(pthread_attr_t *attr) {
  struct sched_param param;
  int rs = pthread_attr_getschedparam(attr, &param);
  assert(rs == 0);
  printf("priority=%d\n", param.__sched_priority);
  return param.__sched_priority;
}


x86 assembly (clang, -O0):
<get_thread_priority>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <pthread_attr_getschedparam@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x10(%rbp),%esi
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_thread_priority>:
push   %rax
mov    %rsp,%rsi
call   1040 <pthread_attr_getschedparam@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    (%rsp),%esi
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
mov    (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.sched_param = type { i32 }
@.str = [13 x i8] c"priority=%d\0A\00"
define i32 @get_thread_priority(i32* %0) {
%2 = alloca i32*
%3 = alloca %struct.sched_param
%4 = alloca i32
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = call i32 @pthread_attr_getschedparam(i32* %5, %struct.sched_param* %3)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %3, i32 0, i32 0
%12 = load i32, i32* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %3, i32 0, i32 0
%15 = load i32, i32* %14
ret i32 %15
}

LLVM IR (-O2):
%struct.sched_param = type { i32 }
@.str = [13 x i8] c"priority=%d\0A\00"
define i32 @get_thread_priority(i32* %0) {
%2 = alloca %struct.sched_param
%3 = bitcast %struct.sched_param* %2 to i8*
%4 = call i32 @pthread_attr_getschedparam(i32* %0, %struct.sched_param* %2)
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %2, i64 0, i32 0
%9 = load i32, i32* %8
%10 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %8
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
char *jump(char *string) {
  assert(string != NULL);
  while (*string > ' ')
    string++;
  return string;
}


x86 assembly (clang, -O0):
<jump>:
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   1030 <assert@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jle    114f <jump+0x3f>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    112e <jump+0x1e>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jump>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
add    $0xffffffffffffffff,%rbx
cs nopw 0x0(%rax,%rax,1)
cmpb   $0x20,0x1(%rbx)
lea    0x1(%rbx),%rbx
jg     1130 <jump+0x20>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @jump(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)
br label %7
7: ; preds = %12, %1
%8 = load i8*, i8** %2
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp sgt i32 %10, 32
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %2
br label %7
15: ; preds = %7
%16 = load i8*, i8** %2
ret i8* %16
}

LLVM IR (-O2):
define i8* @jump(i8* %0) {
%2 = icmp ne i8* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
br label %5
5: ; preds = %5, %1
%6 = phi i8* [ %0, %1 ], [ %9, %5 ]
%7 = load i8, i8* %6
%8 = icmp sgt i8 %7, 32
%9 = getelementptr inbounds i8, i8* %6, i64 1
br i1 %8, label %5, label %10
10: ; preds = %5
ret i8* %6
}
/* Variables and functions */
int japi_getmousex(int);
int j_getmousex(int arg0) { return (japi_getmousex(arg0)); }


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

x86 assembly (clang, -O2):
<j_getmousex>:
jmp    1030 <japi_getmousex@plt>

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

LLVM IR (-O2):
define i32 @j_getmousex(i32 %0) {
%2 = tail call i32 @japi_getmousex(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ InitKing();
int /*<<< orphan*/ InitKnight();
int /*<<< orphan*/ InitMagics();
int /*<<< orphan*/ InitPawn();
int /*<<< orphan*/ InitRays();
int /*<<< orphan*/ InitTrans();
int /*<<< orphan*/ InitZobrist();
int /*<<< orphan*/ initArrays();
void InitEngine() {
  InitTrans();
  InitZobrist();
  InitKing();
  InitKnight();
  InitPawn();
  InitRays();
  InitMagics();
  initArrays();
}


x86 assembly (clang, -O0):
<InitEngine>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <InitTrans@plt>
mov    $0x0,%al
call   1090 <InitZobrist@plt>
mov    $0x0,%al
call   1050 <InitKing@plt>
mov    $0x0,%al
call   1070 <InitKnight@plt>
mov    $0x0,%al
call   1030 <InitPawn@plt>
mov    $0x0,%al
call   1060 <InitRays@plt>
mov    $0x0,%al
call   10a0 <InitMagics@plt>
mov    $0x0,%al
call   1080 <initArrays@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<InitEngine>:
push   %rax
xor    %eax,%eax
call   1040 <InitTrans@plt>
xor    %eax,%eax
call   1090 <InitZobrist@plt>
xor    %eax,%eax
call   1050 <InitKing@plt>
xor    %eax,%eax
call   1070 <InitKnight@plt>
xor    %eax,%eax
call   1030 <InitPawn@plt>
xor    %eax,%eax
call   1060 <InitRays@plt>
xor    %eax,%eax
call   10a0 <InitMagics@plt>
xor    %eax,%eax
pop    %rcx
jmp    1080 <initArrays@plt>

LLVM IR (-O0):
define void @InitEngine() {
%1 = call i32 (...) @InitTrans()
%2 = call i32 (...) @InitZobrist()
%3 = call i32 (...) @InitKing()
%4 = call i32 (...) @InitKnight()
%5 = call i32 (...) @InitPawn()
%6 = call i32 (...) @InitRays()
%7 = call i32 (...) @InitMagics()
%8 = call i32 (...) @initArrays()
ret void
}

LLVM IR (-O2):
define void @InitEngine() {
%1 = tail call i32 (...) @InitTrans()
%2 = tail call i32 (...) @InitZobrist()
%3 = tail call i32 (...) @InitKing()
%4 = tail call i32 (...) @InitKnight()
%5 = tail call i32 (...) @InitPawn()
%6 = tail call i32 (...) @InitRays()
%7 = tail call i32 (...) @InitMagics()
%8 = tail call i32 (...) @initArrays()
ret void
}
void show_test(struct tracecmd_input *handle) {}


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

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

LLVM IR (-O0):
%struct.tracecmd_input = type opaque
define void @show_test(%struct.tracecmd_input* %0) {
%2 = alloca %struct.tracecmd_input*
store %struct.tracecmd_input* %0, %struct.tracecmd_input** %2
ret void
}

LLVM IR (-O2):
%struct.tracecmd_input = type opaque
define void @show_test(%struct.tracecmd_input* nocapture %0) {
ret void
}
int f9(int x, int y) { return x % -(y & ~4); }


x86 assembly (clang, -O0):
<f9>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%edx
and    $0xfffffffb,%edx
xor    %ecx,%ecx
sub    %edx,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f9>:
mov    %edi,%eax
and    $0xfffffffb,%esi
neg    %esi
cltd
idiv   %esi
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @f9(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, -5
%8 = sub nsw i32 0, %7
%9 = srem i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @f9(i32 %0, i32 %1) {
%3 = and i32 %1, -5
%4 = sub nsw i32 0, %3
%5 = srem i32 %0, %4
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
struct inv_icm30xxx {
  int dummy;
};

/* Variables and functions */
int inv_icm30xxx_read_reg(struct inv_icm30xxx *, int /*<<< orphan*/,
                          int /*<<< orphan*/, int /*<<< orphan*/ *, int);
int inv_icm30xxx_read_reg_one(struct inv_icm30xxx *s, uint8_t bank, uint8_t reg,
                              uint8_t *reg_value) {
  return inv_icm30xxx_read_reg(s, bank, reg, reg_value, 1);
}


x86 assembly (clang, -O0):
<inv_icm30xxx_read_reg_one>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    $0x1,%r8d
call   1030 <inv_icm30xxx_read_reg@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inv_icm30xxx_read_reg_one>:
mov    $0x1,%r8d
jmp    1030 <inv_icm30xxx_read_reg@plt>

LLVM IR (-O0):
%struct.inv_icm30xxx = type { i32 }
define i32 @inv_icm30xxx_read_reg_one(%struct.inv_icm30xxx* %0, i32 %1, i32 %2, i32* %3) {
%5 = alloca %struct.inv_icm30xxx*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
store %struct.inv_icm30xxx* %0, %struct.inv_icm30xxx** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32* %3, i32** %8
%9 = load %struct.inv_icm30xxx*, %struct.inv_icm30xxx** %5
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = load i32*, i32** %8
%13 = call i32 @inv_icm30xxx_read_reg(%struct.inv_icm30xxx* %9, i32 %10, i32 %11, i32* %12, i32 1)
ret i32 %13
}

LLVM IR (-O2):
%struct.inv_icm30xxx = type { i32 }
define i32 @inv_icm30xxx_read_reg_one(%struct.inv_icm30xxx* %0, i32 %1, i32 %2, i32* %3) {
%5 = tail call i32 @inv_icm30xxx_read_reg(%struct.inv_icm30xxx* %0, i32 %1, i32 %2, i32* %3, i32 1)
ret i32 %5
}
void myStrCpy(char *src, char *dest, char append) {
  char *p = src, *q = dest;
  while (*q++ = *p++)
    ;
  *(q - 1) = append;
  *q = 0;
}


x86 assembly (clang, -O0):
<myStrCpy>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%al
mov    -0x28(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     1150 <myStrCpy+0x50>
jmp    1121 <myStrCpy+0x21>
mov    -0x11(%rbp),%cl
mov    -0x28(%rbp),%rax
mov    %cl,-0x1(%rax)
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<myStrCpy>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rdi,%rax,1),%ecx
mov    %cl,(%rsi,%rax,1)
add    $0x1,%rax
test   %cl,%cl
jne    1110 <myStrCpy+0x10>
mov    %dl,-0x1(%rsi,%rax,1)
movb   $0x0,(%rsi,%rax,1)
ret

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

LLVM IR (-O2):
define void @myStrCpy(i8* nocapture %0, i8* nocapture writeonly %1, i8 signext %2) {
br label %4
4: ; preds = %4, %3
%5 = phi i8* [ %0, %3 ], [ %7, %4 ]
%6 = phi i8* [ %1, %3 ], [ %9, %4 ]
%7 = getelementptr inbounds i8, i8* %5, i64 1
%8 = load i8, i8* %5
%9 = getelementptr inbounds i8, i8* %6, i64 1
store i8 %8, i8* %6
%10 = icmp eq i8 %8, 0
br i1 %10, label %11, label %4
11: ; preds = %4
store i8 %2, i8* %6
store i8 0, i8* %9
ret void
}
int abs(int number) {
  if (number < 0)
    return -number;
  else
    return number;
}


x86 assembly (clang, -O0):
<abs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    111e <abs+0x1e>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1124 <abs+0x24>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
void test3(x, atype) int x, atype;
{}


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

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

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

LLVM IR (-O2):
define void @test3(i32 %0, i32 %1) {
ret void
}
int filho_esq(int i) { return 2 * i; }


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

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

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

LLVM IR (-O2):
define i32 @filho_esq(i32 %0) {
%2 = shl nsw i32 %0, 1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ errx(int, int /*<<< orphan*/ *);
void *malloc(size_t);
void *xmalloc(size_t size) {
  void *ptr;
  if (size == 0)
    errx(2, NULL);
  ptr = malloc(size);
  if (ptr == NULL)
    errx(2, NULL);
  return ptr;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1145 <xmalloc+0x25>
mov    $0x2,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <errx@plt>
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116b <xmalloc+0x4b>
mov    $0x2,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <errx@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rbx
mov    %rdi,%rbx
test   %rdi,%rdi
jne    1135 <xmalloc+0x15>
mov    $0x2,%edi
xor    %esi,%esi
call   1030 <errx@plt>
mov    %rbx,%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1151 <xmalloc+0x31>
mov    $0x2,%edi
xor    %esi,%esi
call   1030 <errx@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define noalias i8* @xmalloc(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @errx(i32 2, i32* null)
br label %5
5: ; preds = %3, %1
%6 = tail call i8* @malloc(i64 %0)
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @errx(i32 2, i32* null)
br label %10
10: ; preds = %8, %5
ret i8* %6
}
/* Variables and functions */
void *alloc(unsigned long);
void *newarray(unsigned long m, unsigned long n, unsigned a) {
  return alloc(m * n);
}


x86 assembly (clang, -O0):
<newarray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
imul   -0x10(%rbp),%rdi
call   1030 <alloc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<newarray>:
imul   %rsi,%rdi
jmp    1030 <alloc@plt>

LLVM IR (-O0):
define i8* @newarray(i64 %0, i64 %1, i32 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i32
store i64 %0, i64* %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%7 = load i64, i64* %4
%8 = load i64, i64* %5
%9 = mul i64 %7, %8
%10 = call i8* @alloc(i64 %9)
ret i8* %10
}

LLVM IR (-O2):
define i8* @newarray(i64 %0, i64 %1, i32 %2) {
%4 = mul i64 %1, %0
%5 = tail call i8* @alloc(i64 %4)
ret i8* %5
}
double MIN(double a, double b) { return a < b ? a : b; }


x86 assembly (clang, -O0):
<MIN>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1131 <MIN+0x31>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    113b <MIN+0x3b>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<MIN>:
minsd  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @MIN(double %0, double %1) {
%3 = fcmp olt double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
int cbp72_init_modemctl_device(struct modem_ctl *mc, struct modem_data *pdata) {
  return 0;
}


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

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

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

LLVM IR (-O2):
%struct.modem_ctl = type opaque
%struct.modem_data = type opaque
define i32 @cbp72_init_modemctl_device(%struct.modem_ctl* nocapture readnone %0, %struct.modem_data* nocapture readnone %1) {
ret i32 0
}
void free_float(float *net) {}


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

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

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

LLVM IR (-O2):
define void @free_float(float* nocapture %0) {
ret void
}
int getdword(unsigned char buf[4]) {
  return (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | (buf[3] << 0);
}


x86 assembly (clang, -O0):
<getdword>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
shl    $0x18,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x3(%rcx),%ecx
shl    $0x0,%ecx
or     %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @getdword(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = shl nuw i32 %3, 24
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = shl nuw nsw i32 %7, 16
%9 = or i32 %8, %4
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = shl nuw nsw i32 %12, 8
%14 = or i32 %9, %13
%15 = getelementptr inbounds i8, i8* %0, i64 3
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = or i32 %14, %17
ret i32 %18
}
int ConsumirDato(int dato, int *total) { *total += dato; }


x86 assembly (clang, -O0):
<ConsumirDato>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%ecx
mov    -0x10(%rbp),%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ConsumirDato>:
add    %edi,(%rsi)
ret

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

LLVM IR (-O2):
define i32 @ConsumirDato(i32 %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = add nsw i32 %3, %0
store i32 %4, i32* %1
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void usage(const char *cmd) {
  printf("usage: %s [-f a10|a20] nand-device\n", cmd);
  printf("       %s nand-device 'name2 len2 [usertype2]' ['name3 len3 "
         "[usertype3]'] ...\n",
         cmd);
  printf("       %s [-f a10|a20] nand-device start1 'name1 len1 [usertype1]' "
         "['name2 len2 [usertype2]'] ...\n",
         cmd);
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0xefa(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0xf3a(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"usage: %s [-f a10|a20] nand-device\0A\00"
@.str.1 = [79 x i8] c" %s nand-device 'name2 len2 [usertype2]' ['name3 len3 [usertype3]'] ...\0A\00"
@.str.2 = [99 x i8] c" %s [-f a10|a20] nand-device start1 'name1 len1 [usertype1]' ['name2 len2 [usertype2]'] ...\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = load i8*, i8** %2
%6 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = load i8*, i8** %2
%8 = call i32 @printf(i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str.2, i64 0, i64 0), i8* %7)
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"usage: %s [-f a10|a20] nand-device\0A\00"
@.str.1 = [79 x i8] c" %s nand-device 'name2 len2 [usertype2]' ['name3 len3 [usertype3]'] ...\0A\00"
@.str.2 = [99 x i8] c" %s [-f a10|a20] nand-device start1 'name1 len1 [usertype1]' ['name2 len2 [usertype2]'] ...\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str.2, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _SC_NPROCESSORS_ONLN;
scalar_t__ sysconf(int /*<<< orphan*/);
int cpuNum() { return (int)sysconf(_SC_NPROCESSORS_ONLN); }


x86 assembly (clang, -O0):
<cpuNum>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <sysconf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpuNum>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <sysconf@plt>

LLVM IR (-O0):
@_SC_NPROCESSORS_ONLN = global i32 0
define i32 @cpuNum() {
%1 = load i32, i32* @_SC_NPROCESSORS_ONLN
%2 = call i64 @sysconf(i32 %1)
%3 = trunc i64 %2 to i32
ret i32 %3
}

LLVM IR (-O2):
@_SC_NPROCESSORS_ONLN = global i32 0
define i32 @cpuNum() {
%1 = load i32, i32* @_SC_NPROCESSORS_ONLN
%2 = tail call i64 @sysconf(i32 %1)
%3 = trunc i64 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ DefineIluminacao();
int GL_COLOR_BUFFER_BIT;
int GL_DEPTH_BUFFER_BIT;
int /*<<< orphan*/ glClear(int);
int /*<<< orphan*/ glColor3f(float, float, float);
int /*<<< orphan*/ glutSolidTorus(double, double, int, int);
int /*<<< orphan*/ glutSwapBuffers();
void Desenha(void) {
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  DefineIluminacao();
  glColor3f(0.0f, 0.0f, 1.0f);
  glutSolidTorus(20.0, 35.0, 20, 40);
  glutSwapBuffers();
}


x86 assembly (clang, -O0):
<Desenha>:
push   %rbp
mov    %rsp,%rbp
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
mov    0x2e84(%rip),%rax
or     (%rax),%edi
call   1030 <glClear@plt>
mov    $0x0,%al
call   1060 <DefineIluminacao@plt>
xorps  %xmm1,%xmm1
movss  0xe93(%rip),%xmm2
movaps %xmm1,%xmm0
call   1050 <glColor3f@plt>
movsd  0xe73(%rip),%xmm0
movsd  0xe73(%rip),%xmm1
mov    $0x14,%edi
mov    $0x28,%esi
call   1070 <glutSolidTorus@plt>
mov    $0x0,%al
call   1040 <glutSwapBuffers@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Desenha>:
push   %rax
mov    0x2e80(%rip),%rax
mov    0x2e89(%rip),%rcx
mov    (%rcx),%edi
or     (%rax),%edi
call   1030 <glClear@plt>
xor    %eax,%eax
call   1060 <DefineIluminacao@plt>
movss  0xe89(%rip),%xmm2
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
call   1050 <glColor3f@plt>
movsd  0xe7e(%rip),%xmm0
movsd  0xe7e(%rip),%xmm1
mov    $0x14,%edi
mov    $0x28,%esi
call   1070 <glutSolidTorus@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <glutSwapBuffers@plt>

LLVM IR (-O0):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_DEPTH_BUFFER_BIT = global i32 0
define void @Desenha() {
%1 = load i32, i32* @GL_COLOR_BUFFER_BIT
%2 = load i32, i32* @GL_DEPTH_BUFFER_BIT
%3 = or i32 %1, %2
%4 = call i32 @glClear(i32 %3)
%5 = call i32 (...) @DefineIluminacao()
%6 = call i32 @glColor3f(float 0.000000e+00, float 0.000000e+00, float 1.000000e+00)
%7 = call i32 @glutSolidTorus(double 2.000000e+01, double 3.500000e+01, i32 20, i32 40)
%8 = call i32 (...) @glutSwapBuffers()
ret void
}

LLVM IR (-O2):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_DEPTH_BUFFER_BIT = global i32 0
define void @Desenha() {
%1 = load i32, i32* @GL_COLOR_BUFFER_BIT
%2 = load i32, i32* @GL_DEPTH_BUFFER_BIT
%3 = or i32 %2, %1
%4 = tail call i32 @glClear(i32 %3)
%5 = tail call i32 (...) @DefineIluminacao()
%6 = tail call i32 @glColor3f(float 0.000000e+00, float 0.000000e+00, float 1.000000e+00)
%7 = tail call i32 @glutSolidTorus(double 2.000000e+01, double 3.500000e+01, i32 20, i32 40)
%8 = tail call i32 (...) @glutSwapBuffers()
ret void
}
int mutedlevel(int orig, int mutelevel) {
  int l = orig >> 8;
  int r = orig & 0xff;
  l = (float)(mutelevel) * (float)(l) / 100.0;
  r = (float)(mutelevel) * (float)(r) / 100.0;
  return (l << 8) | r;
}


x86 assembly (clang, -O0):
<mutedlevel>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x10(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
cvtsi2ssl -0xc(%rbp),%xmm1
mulss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xec8(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0xc(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
cvtsi2ssl -0x10(%rbp),%xmm1
mulss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xea3(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x8,%eax
or     -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mutedlevel>:
mov    %edi,%eax
cvtsi2ss %esi,%xmm0
sar    $0x8,%eax
cvtsi2ss %eax,%xmm1
mulss  %xmm0,%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xee3(%rip),%xmm2
divsd  %xmm2,%xmm1
cvttsd2si %xmm1,%eax
movzbl %dil,%ecx
xorps  %xmm1,%xmm1
cvtsi2ss %ecx,%xmm1
mulss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
divsd  %xmm2,%xmm0
cvttsd2si %xmm0,%ecx
shl    $0x8,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @mutedlevel(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = ashr i32 %7, 8
store i32 %8, i32* %5
%9 = load i32, i32* %3
%10 = and i32 %9, 255
store i32 %10, i32* %6
%11 = load i32, i32* %4
%12 = sitofp i32 %11 to float
%13 = load i32, i32* %5
%14 = sitofp i32 %13 to float
%15 = fmul float %12, %14
%16 = fpext float %15 to double
%17 = fdiv double %16, 1.000000e+02
%18 = fptosi double %17 to i32
store i32 %18, i32* %5
%19 = load i32, i32* %4
%20 = sitofp i32 %19 to float
%21 = load i32, i32* %6
%22 = sitofp i32 %21 to float
%23 = fmul float %20, %22
%24 = fpext float %23 to double
%25 = fdiv double %24, 1.000000e+02
%26 = fptosi double %25 to i32
store i32 %26, i32* %6
%27 = load i32, i32* %5
%28 = shl i32 %27, 8
%29 = load i32, i32* %6
%30 = or i32 %28, %29
ret i32 %30
}

LLVM IR (-O2):
define i32 @mutedlevel(i32 %0, i32 %1) {
%3 = ashr i32 %0, 8
%4 = and i32 %0, 255
%5 = sitofp i32 %1 to float
%6 = sitofp i32 %3 to float
%7 = fmul float %5, %6
%8 = fpext float %7 to double
%9 = fdiv double %8, 1.000000e+02
%10 = fptosi double %9 to i32
%11 = sitofp i32 %4 to float
%12 = fmul float %5, %11
%13 = fpext float %12 to double
%14 = fdiv double %13, 1.000000e+02
%15 = fptosi double %14 to i32
%16 = shl i32 %10, 8
%17 = or i32 %16, %15
ret i32 %17
}
int isalnum(int c) {
  return ((unsigned)c - '0' < 10) | (((unsigned)c | 32) - 'a' < 26);
}


x86 assembly (clang, -O0):
<isalnum>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x30,%eax
cmp    $0xa,%eax
setb   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x4(%rbp),%ecx
or     $0x20,%ecx
sub    $0x61,%ecx
cmp    $0x1a,%ecx
setb   %cl
and    $0x1,%cl
movzbl %cl,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isalnum>:
lea    -0x30(%rdi),%eax
cmp    $0xa,%eax
setb   %al
or     $0x20,%edi
add    $0xffffff9f,%edi
cmp    $0x1a,%edi
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @isalnum(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub i32 %3, 48
%5 = icmp ult i32 %4, 10
%6 = zext i1 %5 to i32
%7 = load i32, i32* %2
%8 = or i32 %7, 32
%9 = sub i32 %8, 97
%10 = icmp ult i32 %9, 26
%11 = zext i1 %10 to i32
%12 = or i32 %6, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @isalnum(i32 %0) {
%2 = add i32 %0, -48
%3 = icmp ult i32 %2, 10
%4 = or i32 %0, 32
%5 = add i32 %4, -97
%6 = icmp ult i32 %5, 26
%7 = or i1 %3, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ kill(int /*<<< orphan*/, int);
int /*<<< orphan*/ waitpid(int /*<<< orphan*/, int /*<<< orphan*/ *,
                           int /*<<< orphan*/);
void rw_socket_close(FILE *res, pid_t pid) {
  fclose(res);
  kill(pid, 9);
  waitpid(pid, NULL, 0);
}


x86 assembly (clang, -O0):
<rw_socket_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0xc(%rbp),%edi
mov    $0x9,%esi
call   1040 <kill@plt>
mov    -0xc(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1050 <waitpid@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rw_socket_close>:
push   %rbx
mov    %esi,%ebx
call   1030 <fclose@plt>
mov    %ebx,%edi
mov    $0x9,%esi
call   1040 <kill@plt>
mov    %ebx,%edi
xor    %esi,%esi
xor    %edx,%edx
pop    %rbx
jmp    1050 <waitpid@plt>

LLVM IR (-O0):
define void @rw_socket_close(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 = call i32 @fclose(i32* %5)
%7 = load i32, i32* %4
%8 = call i32 @kill(i32 %7, i32 9)
%9 = load i32, i32* %4
%10 = call i32 @waitpid(i32 %9, i32* null, i32 0)
ret void
}

LLVM IR (-O2):
define void @rw_socket_close(i32* nocapture %0, i32 %1) {
%3 = tail call i32 @fclose(i32* %0)
%4 = tail call i32 @kill(i32 %1, i32 9)
%5 = tail call i32 @waitpid(i32 %1, i32* null, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ emit_u(int);
void emit_loadhi(unsigned c22, unsigned rd, unsigned cond) {
  assert((c22 & ~0x3FFFFF) == 0);
  emit_u(0x80000000U | (c22 << 8) | (rd << 4) | cond);
}


x86 assembly (clang, -O0):
<emit_loadhi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffc00000,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%edi
shl    $0x8,%edi
or     $0x80000000,%edi
mov    -0x8(%rbp),%eax
shl    $0x4,%eax
or     %eax,%edi
or     -0xc(%rbp),%edi
call   1040 <emit_u@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_loadhi>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
xor    %edi,%edi
cmp    $0x400000,%ebx
setb   %dil
call   1030 <assert@plt>
shl    $0x8,%ebx
shl    $0x4,%ebp
or     %ebx,%ebp
or     %r14d,%ebp
or     $0x80000000,%ebp
mov    %ebp,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <emit_u@plt>

LLVM IR (-O0):
define void @emit_loadhi(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = and i32 %7, -4194304
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = load i32, i32* %4
%13 = shl i32 %12, 8
%14 = or i32 -2147483648, %13
%15 = load i32, i32* %5
%16 = shl i32 %15, 4
%17 = or i32 %14, %16
%18 = load i32, i32* %6
%19 = or i32 %17, %18
%20 = call i32 @emit_u(i32 %19)
ret void
}

LLVM IR (-O2):
define void @emit_loadhi(i32 %0, i32 %1, i32 %2) {
%4 = icmp ult i32 %0, 4194304
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = shl i32 %0, 8
%8 = shl i32 %1, 4
%9 = or i32 %7, %8
%10 = or i32 %9, %2
%11 = or i32 %10, -2147483648
%12 = tail call i32 @emit_u(i32 %11)
ret void
}
/* Variables and functions */
int __ffs(unsigned long);
int __ffz(unsigned long x) { return __ffs(~x); }


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

x86 assembly (clang, -O2):
<__ffz>:
not    %rdi
jmp    1030 <__ffs@plt>

LLVM IR (-O0):
define i32 @__ffz(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = xor i64 %3, -1
%5 = call i32 @__ffs(i64 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @__ffz(i64 %0) {
%2 = xor i64 %0, -1
%3 = tail call i32 @__ffs(i64 %2)
ret i32 %3
}
/* Variables and functions */
int palindromer(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int palindrome(char *str) { return palindromer(str, 0, strlen(str)); }


x86 assembly (clang, -O0):
<palindrome>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%edx
xor    %esi,%esi
call   1040 <palindromer@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<palindrome>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
pop    %rbx
jmp    1040 <palindromer@plt>

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

LLVM IR (-O2):
define i32 @palindrome(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i32 @palindromer(i8* %0, i32 0, i32 %2)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ internal_fiat_poly1305_carry_mul(uintptr_t, uintptr_t,
                                                    uintptr_t);
void fiat_poly1305_carry_mul(uint64_t out1[3], const uint64_t arg1[3],
                             const uint64_t arg2[3]) {
  internal_fiat_poly1305_carry_mul((uintptr_t)out1, (uintptr_t)arg1,
                                   (uintptr_t)arg2);
}


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

x86 assembly (clang, -O2):
<fiat_poly1305_carry_mul>:
jmp    1030 <internal_fiat_poly1305_carry_mul@plt>

LLVM IR (-O0):
define void @fiat_poly1305_carry_mul(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i32*, i32** %4
%8 = ptrtoint i32* %7 to i64
%9 = load i32*, i32** %5
%10 = ptrtoint i32* %9 to i64
%11 = load i32*, i32** %6
%12 = ptrtoint i32* %11 to i64
%13 = call i32 @internal_fiat_poly1305_carry_mul(i64 %8, i64 %10, i64 %12)
ret void
}

LLVM IR (-O2):
define void @fiat_poly1305_carry_mul(i32* %0, i32* %1, i32* %2) {
%4 = ptrtoint i32* %0 to i64
%5 = ptrtoint i32* %1 to i64
%6 = ptrtoint i32* %2 to i64
%7 = tail call i32 @internal_fiat_poly1305_carry_mul(i64 %4, i64 %5, i64 %6)
ret void
}
/* Variables and functions */
char tolower(char);
void forceLower(char *s) {
  while (*s) {
    *s = tolower(*s);
    s++;
  }
}


x86 assembly (clang, -O0):
<forceLower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     114e <forceLower+0x3e>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <tolower@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <forceLower+0xc>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @forceLower(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 signext i8 @tolower(i8 signext %5)
store i8 %7, i8* %6
%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
}
int main(int argc, char **argv) {
  extern int fakemain(int, char **);
  return fakemain(argc, argv);
}


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

x86 assembly (clang, -O2):
<main>:
jmp    1030 <fakemain@plt>

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @fakemain(i32 %0, i8** %1)
ret i32 %3
}