xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void put_byte(unsigned char *x, int n) {
  int i;
  for (i = 0; i < n; ++i) {
    int haha = *x;
    printf("%02x ", haha);
    ++x;
  }
}


x86 assembly (clang, -O0):
<put_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1165 <put_byte+0x55>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <put_byte+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_byte>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1146 <put_byte+0x36>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
movzbl (%r15,%rbx,1),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %ebx,%r12d
jne    1130 <put_byte+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%02x \00"
define void @put_byte(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %7
7: ; preds = %19, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %22
11: ; preds = %7
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
store i32 %14, i32* %6
%15 = load i32, i32* %6
%16 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = load i8*, i8** %3
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %3
br label %19
19: ; preds = %11
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %7
22: ; preds = %7
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%02x \00"
define void @put_byte(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2, %4
%5 = phi i8* [ %10, %4 ], [ %0, %2 ]
%6 = phi i32 [ %11, %4 ], [ 0, %2 ]
%7 = load i8, i8* %5
%8 = zext i8 %7 to i32
%9 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds i8, i8* %5, i64 1
%11 = add nuw nsw i32 %6, 1
%12 = icmp eq i32 %11, %1
br i1 %12, label %13, label %4
13: ; preds = %4, %2
ret void
}
long get_my_task_id() { return *(long *)((0x100000120)); }


x86 assembly (clang, -O0):
<get_my_task_id>:
push   %rbp
mov    %rsp,%rbp
movabs $0x100000120,%rax
mov    (%rax),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_my_task_id>:
movabs $0x100000120,%rax
mov    (%rax),%rax
ret

LLVM IR (-O0):
define i64 @get_my_task_id() {
%1 = load i64, i64* inttoptr (i64 4294967584 to i64*)
ret i64 %1
}

LLVM IR (-O2):
define i64 @get_my_task_id() {
%1 = load i64, i64* inttoptr (i64 4294967584 to i64*)
ret i64 %1
}
void rtv_EnableFicInterrupt(unsigned int nOpenedSubChNum) {}


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

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

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

LLVM IR (-O2):
define void @rtv_EnableFicInterrupt(i32 %0) {
ret void
}
void intel_gvt_sanitize_options(struct drm_i915_private *dev_priv) {}


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

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

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

LLVM IR (-O2):
%struct.drm_i915_private = type opaque
define void @intel_gvt_sanitize_options(%struct.drm_i915_private* nocapture %0) {
ret void
}
void __attribute__((visibility("internal"))) lib3_internal(void) {}


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

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

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

LLVM IR (-O2):
define hidden void @lib3_internal() {
ret void
}
char *langRomTypeExtRam() { return "External RAM"; }


x86 assembly (clang, -O0):
<langRomTypeExtRam>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<langRomTypeExtRam>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [13 x i8] c"External RAM\00"
define i8* @langRomTypeExtRam() {
ret i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [13 x i8] c"External RAM\00"
define i8* @langRomTypeExtRam() {
ret i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
pid_t fork(void) {
  fprintf(stderr, "\nAccess to dangerous function %s() denied.\n", "fork");
  assert(0);
  ;
}


x86 assembly (clang, -O0):
<fork>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
lea    0xec8(%rip),%rsi
lea    0xeed(%rip),%rdx
call   1040 <fprintf@plt>
xor    %edi,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fork>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
lea    0xef4(%rip),%rdx
call   1040 <fprintf@plt>
xor    %edi,%edi
pop    %rax
jmp    1030 <assert@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [44 x i8] c"\0AAccess to dangerous function %s() denied.\0A\00"
@.str.1 = [5 x i8] c"fork\00"
define i32 @fork() {
%1 = alloca i32
%2 = load i32, i32* @stderr
%3 = call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @assert(i32 0)
%5 = load i32, i32* %1
ret i32 %5
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [44 x i8] c"\0AAccess to dangerous function %s() denied.\0A\00"
@.str.1 = [5 x i8] c"fork\00"
define i32 @fork() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @assert(i32 0)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ fun(char *, char);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ puts(char *);
int main() {
  char a[] = "this is a book.";
  fun(a, 'i');
  puts(a);
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x69,%esi
call   1040 <fun@plt>
lea    -0x20(%rbp),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movaps 0xec4(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x69,%esi
call   1040 <fun@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.a = [16 x i8] c"this is a book.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [16 x i8]
store i32 0, i32* %1
%3 = bitcast [16 x i8]* %2 to i8*
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%5 = call i32 @fun(i8* %4, i8 signext 105)
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%7 = call i32 @puts(i8* %6)
%8 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [16 x i8] c"this is a book.\00"
define i32 @main() {
%1 = alloca [16 x i8]
%2 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%3 = call i32 @fun(i8* %2, i8 signext 105)
%4 = call i32 @puts(i8* %2)
%5 = call i32 (...) @getchar()
ret i32 0
}
int test_imm_CEint16_reg(short val) {
  return ((val) & (0xCE << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_CEint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0xce,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_CEint16_reg>:
test   $0xce,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_CEint16_reg(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, 206
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_CEint16_reg(i16 signext %0) {
%2 = and i16 %0, 206
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int numa_max_node(void) { return 1; }


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

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

LLVM IR (-O0):
define i32 @numa_max_node() {
ret i32 1
}

LLVM IR (-O2):
define i32 @numa_max_node() {
ret i32 1
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
void h265hvcc_set_num_of_arrays(uint8_t *p, uint8_t val) { p[22] = val; }


x86 assembly (clang, -O0):
<h265hvcc_set_num_of_arrays>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x58(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<h265hvcc_set_num_of_arrays>:
mov    %esi,0x58(%rdi)
ret

LLVM IR (-O0):
define void @h265hvcc_set_num_of_arrays(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32*, i32** %3
%7 = getelementptr inbounds i32, i32* %6, i64 22
store i32 %5, i32* %7
ret void
}

LLVM IR (-O2):
define void @h265hvcc_set_num_of_arrays(i32* nocapture writeonly %0, i32 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 22
store i32 %1, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void print_array(int *array, size_t len) {
  size_t i;
  for (i = 0; i < len; i++)
    printf("%d,", array[i]);
}


x86 assembly (clang, -O0):
<print_array>:
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    115e <print_array+0x4e>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <print_array+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_array>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rsi,%rsi
je     1145 <print_array+0x35>
mov    %rsi,%r12
mov    %rdi,%r14
xor    %ebx,%ebx
lea    0xed4(%rip),%r15
nopl   0x0(%rax)
mov    (%r14,%rbx,4),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <print_array+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d,\00"
define void @print_array(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
%5 = alloca i64
store i32* %0, i32** %3
store i64 %1, i64* %4
store i64 0, i64* %5
br label %6
6: ; preds = %16, %2
%7 = load i64, i64* %5
%8 = load i64, i64* %4
%9 = icmp ult i64 %7, %8
br i1 %9, label %10, label %19
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = load i64, i64* %5
%13 = getelementptr inbounds i32, i32* %11, i64 %12
%14 = load i32, i32* %13
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
br label %16
16: ; preds = %10
%17 = load i64, i64* %5
%18 = add i64 %17, 1
store i64 %18, i64* %5
br label %6
19: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d,\00"
define void @print_array(i32* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %11, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %9, %4 ], [ 0, %2 ]
%6 = getelementptr inbounds i32, i32* %0, i64 %5
%7 = load i32, i32* %6
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = add nuw i64 %5, 1
%10 = icmp eq i64 %9, %1
br i1 %10, label %11, label %4
11: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __assert_fail(char const *, char const *, int, char const *);
void __assert(const char *assertion, const char *file, int line) {
  __assert_fail(assertion, file, line, (const char *)0);
}


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

x86 assembly (clang, -O2):
<__assert>:
xor    %ecx,%ecx
jmp    1030 <__assert_fail@plt>

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

LLVM IR (-O2):
define void @__assert(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @__assert_fail(i8* %0, i8* %1, i32 %2, i8* null)
ret void
}
void transitionBeep() {}


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

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

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

LLVM IR (-O2):
define void @transitionBeep() {
ret void
}
XActivateScreenSaver() {}


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

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

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

LLVM IR (-O2):
define i32 @XActivateScreenSaver() {
ret i32 undef
}
unsigned long ffz(unsigned long word) {
  asm("rep; bsf %1,%0" : "=r"(word) : "r"(~word));
  return word;
}


x86 assembly (clang, -O0):
<ffz>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
xor    $0xffffffffffffffff,%rax
tzcnt  %rax,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ffz>:
not    %rdi
tzcnt  %rdi,%rax
ret

LLVM IR (-O0):
define i64 @ffz(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = xor i64 %3, -1
%5 = call i64 asm "rep; bsf $1,$0", "=r,r,~{dirflag},~{fpsr},~{flags}"(i64 %4)
store i64 %5, i64* %2
%6 = load i64, i64* %2
ret i64 %6
}

LLVM IR (-O2):
define i64 @ffz(i64 %0) {
%2 = xor i64 %0, -1
%3 = tail call i64 asm "rep; bsf $1,$0", "=r,r,~{dirflag},~{fpsr},~{flags}"(i64 %2)
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, int *, int *);
int getNext(int *a, int *b) {
  scanf("%d %d", a, b);
  return *a || *b;
}


x86 assembly (clang, -O0):
<getNext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xed1(%rip),%rdi
call   1030 <scanf@plt>
mov    -0x8(%rbp),%rcx
mov    $0x1,%al
cmpl   $0x0,(%rcx)
mov    %al,-0x11(%rbp)
jne    1153 <getNext+0x43>
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getNext>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xedf(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <scanf@plt>
mov    $0x1,%eax
cmpl   $0x0,(%rbx)
jne    113f <getNext+0x2f>
xor    %eax,%eax
cmpl   $0x0,(%r14)
setne  %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
define i32 @getNext(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 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %5, i32* %6)
%8 = load i32*, i32** %3
%9 = load i32, i32* %8
%10 = icmp ne i32 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %2
%12 = load i32*, i32** %4
%13 = load i32, i32* %12
%14 = icmp ne i32 %13, 0
br label %15
15: ; preds = %11, %2
%16 = phi i1 [ true, %2 ], [ %14, %11 ]
%17 = zext i1 %16 to i32
ret i32 %17
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
define i32 @getNext(i32* %0, i32* %1) {
%3 = tail call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %0, i32* %1)
%4 = load i32, i32* %0
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = load i32, i32* %1
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %2
%11 = phi i32 [ 1, %2 ], [ %9, %6 ]
ret i32 %11
}
void SystemTick_SaveConfig(void) {}


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

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

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

LLVM IR (-O2):
define void @SystemTick_SaveConfig() {
ret void
}
int PDC_fix_cursor(flag)
int flag;
{}


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

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

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

LLVM IR (-O2):
define i32 @PDC_fix_cursor(i32 %0) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ report_count(int);
int /*<<< orphan*/ report_error(char *);
int check_arg_count(int nargs, int expected) {
  if (nargs != expected) {
    report_count(1);
    report_error("INCORRECT_ARGUMENT_NUMBER");
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<check_arg_count>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     115c <check_arg_count+0x3c>
mov    $0x1,%edi
call   1030 <report_count@plt>
lea    0xeb5(%rip),%rdi
call   1040 <report_error@plt>
movl   $0x1,-0x4(%rbp)
jmp    1163 <check_arg_count+0x43>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_arg_count>:
push   %rbx
xor    %ebx,%ebx
cmp    %esi,%edi
je     1142 <check_arg_count+0x22>
mov    $0x1,%ebx
mov    $0x1,%edi
call   1030 <report_count@plt>
lea    0xec3(%rip),%rdi
call   1040 <report_error@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"INCORRECT_ARGUMENT_NUMBER\00"
define i32 @check_arg_count(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 = icmp ne i32 %6, %7
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = call i32 @report_count(i32 1)
%11 = call i32 @report_error(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %13
12: ; preds = %2
store i32 0, i32* %3
br label %13
13: ; preds = %12, %9
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
@.str = [26 x i8] c"INCORRECT_ARGUMENT_NUMBER\00"
define i32 @check_arg_count(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, %1
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = tail call i32 @report_count(i32 1)
%6 = tail call i32 @report_error(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %2, %4
%8 = phi i32 [ 1, %4 ], [ 0, %2 ]
ret i32 %8
}
int foo2(unsigned i) {
  static const void *addrs[] = {&&L1, &&L2, &&L3, &&L4, &&L5};
  int res = 1;
  goto *addrs[i];
L5:
  res *= 11;
L4:
  res *= 7;
L3:
  res *= 5;
L2:
  res *= 3;
L1:
  res *= 2;
  return res;
}


x86 assembly (clang, -O0):
<foo2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
lea    0x2f16(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x10(%rbp)
jmp    1151 <foo2+0x51>
imul   $0xb,-0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
imul   $0x7,-0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
imul   $0x5,-0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
imul   $0x3,-0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret
mov    -0x10(%rbp),%rax
jmp    *%rax

x86 assembly (clang, -O2):
<foo2>:
mov    %edi,%eax
lea    0x2d17(%rip),%rcx
jmp    *(%rcx,%rax,8)
mov    $0x1,%eax
add    %eax,%eax
ret
mov    $0x3,%eax
add    %eax,%eax
ret
mov    $0x1,%eax
jmp    112f <foo2+0x2f>
mov    $0x7,%eax
jmp    112f <foo2+0x2f>
mov    $0x4d,%eax
lea    (%rax,%rax,4),%eax
lea    (%rax,%rax,2),%eax
add    %eax,%eax
ret

LLVM IR (-O0):
@foo2.addrs = internal global [5 x i8*] [i8* blockaddress(@foo2, %20), i8* blockaddress(@foo2, %17), i8* blockaddress(@foo2, %14), i8* blockaddress(@foo2, %11), i8* blockaddress(@foo2, %8)]
define i32 @foo2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
%4 = load i32, i32* %2
%5 = zext i32 %4 to i64
%6 = getelementptr inbounds [5 x i8*], [5 x i8*]* @foo2.addrs, i64 0, i64 %5
%7 = load i8*, i8** %6
br label %24
8: ; preds = %24
%9 = load i32, i32* %3
%10 = mul nsw i32 %9, 11
store i32 %10, i32* %3
br label %11
11: ; preds = %8, %24
%12 = load i32, i32* %3
%13 = mul nsw i32 %12, 7
store i32 %13, i32* %3
br label %14
14: ; preds = %11, %24
%15 = load i32, i32* %3
%16 = mul nsw i32 %15, 5
store i32 %16, i32* %3
br label %17
17: ; preds = %14, %24
%18 = load i32, i32* %3
%19 = mul nsw i32 %18, 3
store i32 %19, i32* %3
br label %20
20: ; preds = %17, %24
%21 = load i32, i32* %3
%22 = mul nsw i32 %21, 2
store i32 %22, i32* %3
%23 = load i32, i32* %3
ret i32 %23
24: ; preds = %1
%25 = phi i8* [ %7, %1 ]
indirectbr i8* %25, [label %20, label %17, label %14, label %11, label %8]
}

LLVM IR (-O2):
@foo2.addrs = internal unnamed_addr constant [5 x i8*] [i8* blockaddress(@foo2, %13), i8* blockaddress(@foo2, %11), i8* blockaddress(@foo2, %8), i8* blockaddress(@foo2, %6), i8* blockaddress(@foo2, %5)]
define i32 @foo2(i32 %0) {
%2 = zext i32 %0 to i64
%3 = getelementptr inbounds [5 x i8*], [5 x i8*]* @foo2.addrs, i64 0, i64 %2
%4 = load i8*, i8** %3
indirectbr i8* %4, [label %13, label %11, label %8, label %6, label %5]
5: ; preds = %1
br label %6
6: ; preds = %5, %1
%7 = phi i32 [ 77, %5 ], [ 7, %1 ]
br label %8
8: ; preds = %6, %1
%9 = phi i32 [ %7, %6 ], [ 1, %1 ]
%10 = mul nuw nsw i32 %9, 15
br label %11
11: ; preds = %8, %1
%12 = phi i32 [ %10, %8 ], [ 3, %1 ]
br label %13
13: ; preds = %11, %1
%14 = phi i32 [ 1, %1 ], [ %12, %11 ]
%15 = shl nuw nsw i32 %14, 1
ret i32 %15
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint32_t;

/* Variables and functions */
void LCDRasterConfigSet(uint32_t ui32Base, uint32_t ui32Config,
                        uint8_t ui8PalLoadDelay) {
  ;

  ;
  (*((volatile unsigned long *)(ui32Base + 0x00000028))) =
      (ui32Config | ((uint32_t)ui8PalLoadDelay << 12));
}


x86 assembly (clang, -O0):
<LCDRasterConfigSet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%rcx
shl    $0xc,%ecx
or     %ecx,%eax
movslq %eax,%rcx
mov    -0x4(%rbp),%eax
add    $0x28,%eax
cltq
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<LCDRasterConfigSet>:
shl    $0xc,%edx
or     %esi,%edx
movslq %edx,%rax
movslq %edi,%rcx
mov    %rax,0x28(%rcx)
ret

LLVM IR (-O0):
define void @LCDRasterConfigSet(i32 %0, i32 %1, i64 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64
store i32 %0, i32* %4
store i32 %1, i32* %5
store i64 %2, i64* %6
%7 = load i32, i32* %5
%8 = load i64, i64* %6
%9 = trunc i64 %8 to i32
%10 = shl i32 %9, 12
%11 = or i32 %7, %10
%12 = sext i32 %11 to i64
%13 = load i32, i32* %4
%14 = add nsw i32 %13, 40
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i64*
store volatile i64 %12, i64* %16
ret void
}

LLVM IR (-O2):
define void @LCDRasterConfigSet(i32 %0, i32 %1, i64 %2) {
%4 = trunc i64 %2 to i32
%5 = shl i32 %4, 12
%6 = or i32 %5, %1
%7 = sext i32 %6 to i64
%8 = add nsw i32 %0, 40
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i64*
store volatile i64 %7, i64* %10
ret void
}
unsigned int atomic_get_bit(unsigned int pos, volatile unsigned int *addr) {
  volatile unsigned int *m = addr + (pos >> (3 + 2));
  unsigned short bit = pos & ((8 * sizeof(int)) - 1);
  return !!((*m) & (1 << bit));
}


x86 assembly (clang, -O0):
<atomic_get_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
shr    $0x5,%ecx
mov    %ecx,%ecx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1f,%rax
mov    %ax,-0x1a(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
movzwl -0x1a(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<atomic_get_bit>:
mov    %edi,%ecx
mov    %edi,%eax
shr    $0x5,%eax
mov    (%rsi,%rax,4),%eax
shr    %cl,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @atomic_get_bit(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i16
store i32 %0, i32* %3
store i32* %1, i32** %4
%7 = load i32*, i32** %4
%8 = load i32, i32* %3
%9 = lshr i32 %8, 5
%10 = zext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %7, i64 %10
store i32* %11, i32** %5
%12 = load i32, i32* %3
%13 = zext i32 %12 to i64
%14 = and i64 %13, 31
%15 = trunc i64 %14 to i16
store i16 %15, i16* %6
%16 = load i32*, i32** %5
%17 = load volatile i32, i32* %16
%18 = load i16, i16* %6
%19 = zext i16 %18 to i32
%20 = shl i32 1, %19
%21 = and i32 %17, %20
%22 = icmp ne i32 %21, 0
%23 = xor i1 %22, true
%24 = xor i1 %23, true
%25 = zext i1 %24 to i32
ret i32 %25
}

LLVM IR (-O2):
define i32 @atomic_get_bit(i32 %0, i32* %1) {
%3 = lshr i32 %0, 5
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds i32, i32* %1, i64 %4
%6 = and i32 %0, 31
%7 = load volatile i32, i32* %5
%8 = lshr i32 %7, %6
%9 = and i32 %8, 1
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ decode_line(char *, scalar_t__);
scalar_t__ strlen(char *);
int main() {
  char t[] = "TMP01:200001:1";
  decode_line(t, strlen(t) + 1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0xf(%rbp)
mov    0xecf(%rip),%eax
mov    %eax,-0x7(%rbp)
mov    0xec9(%rip),%ax
mov    %ax,-0x3(%rbp)
mov    0xec1(%rip),%al
mov    %al,-0x1(%rbp)
lea    -0xf(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0xf(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x18(%rbp),%rdi
mov    %rax,%rsi
add    $0x1,%rsi
call   1040 <decode_line@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movabs $0x313a3130303030,%rax
mov    %rax,0x7(%rsp)
movabs $0x30323a3130504d54,%rax
3a 32 30
mov    %rax,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0x1(%rax),%rsi
mov    %rbx,%rdi
call   1040 <decode_line@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.t = [15 x i8] c"TMP01:200001:1\00"
define i32 @main() {
%1 = alloca [15 x i8]
%2 = bitcast [15 x i8]* %1 to i8*
%3 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i32 @decode_line(i8* %3, i64 %6)
ret i32 0
}

LLVM IR (-O2):
@__const.main.t = [15 x i8] c"TMP01:200001:1\00"
define i32 @main() {
%1 = alloca [15 x i8]
%2 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%3 = call i64 @strlen(i8* %2)
%4 = add nsw i64 %3, 1
%5 = call i32 @decode_line(i8* %2, i64 %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ DiagnosticX(int /*<<< orphan*/, char *, char const *);
void WarningX(const char *s) { DiagnosticX(0, "%s", s); }


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

x86 assembly (clang, -O2):
<WarningX>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rsi
xor    %edi,%edi
jmp    1030 <DiagnosticX@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @WarningX(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @DiagnosticX(i32 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @WarningX(i8* %0) {
%2 = tail call i32 @DiagnosticX(i32 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
char *strrchr(char *, char);
char *x_strdup(char *);
char *dirname(char *s) {
  char *p;
  s = x_strdup(s);
  p = strrchr(s, '/');
  if (p) {
    *p = 0;
  }
  return s;
}


x86 assembly (clang, -O0):
<dirname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <x_strdup@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     115d <dirname+0x3d>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dirname>:
push   %rbx
call   1040 <x_strdup@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     113e <dirname+0x1e>
movb   $0x0,(%rax)
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @dirname(i8* %0) {
%2 = tail call i8* @x_strdup(i8* %0)
%3 = tail call i8* @strrchr(i8* dereferenceable(1) %2, i8 signext 47)
%4 = icmp eq i8* %3, null
br i1 %4, label %6, label %5
5: ; preds = %1
store i8 0, i8* %3
br label %6
6: ; preds = %5, %1
ret i8* %2
}
int ff_load_geometry(struct ff *ff, const char *path) {
  (void)ff;
  (void)path;
  return (0);
}


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

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

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

LLVM IR (-O2):
%struct.ff = type opaque
define i32 @ff_load_geometry(%struct.ff* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
size_t strcspn(char *, char *);
char *chop(char *s) {
  s[strcspn(s, "\n")] = '\0';
  return s;
}


x86 assembly (clang, -O0):
<chop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed1(%rip),%rsi
call   1030 <strcspn@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chop>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
call   1030 <strcspn@plt>
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define i8* @chop(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strcspn(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds i8, i8* %3, i64 %5
store i8 0, i8* %6
%7 = load i8*, i8** %2
ret i8* %7
}

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
define i8* @chop(i8* returned %0) {
%2 = tail call i64 @strcspn(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = getelementptr inbounds i8, i8* %0, i64 %2
store i8 0, i8* %3
ret i8* %0
}
void irafswap2(string, nbytes) char *string;
int nbytes;
{
  char *sbyte, temp, *slast;
  slast = string + nbytes;
  sbyte = string;
  while (sbyte < slast) {
    temp = sbyte[0];
    sbyte[0] = sbyte[1];
    sbyte[1] = temp;
    sbyte = sbyte + 2;
  }
  return;
}


x86 assembly (clang, -O0):
<irafswap2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    1161 <irafswap2+0x61>
mov    -0x18(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
mov    -0x18(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x19(%rbp),%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x18(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x18(%rbp)
jmp    1122 <irafswap2+0x22>
pop    %rbp
ret

x86 assembly (clang, -O2):
<irafswap2>:
test   %esi,%esi
jle    111d <irafswap2+0x1d>
movslq %esi,%rax
add    %rdi,%rax
nopw   0x0(%rax,%rax,1)
rolw   $0x8,(%rdi)
add    $0x2,%rdi
cmp    %rax,%rdi
jb     1110 <irafswap2+0x10>
ret

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

LLVM IR (-O2):
define void @irafswap2(i8* %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %13
6: ; preds = %2, %6
%7 = phi i8* [ %11, %6 ], [ %0, %2 ]
%8 = load i8, i8* %7
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = load i8, i8* %9
store i8 %10, i8* %7
store i8 %8, i8* %9
%11 = getelementptr inbounds i8, i8* %7, i64 2
%12 = icmp ult i8* %11, %4
br i1 %12, label %6, label %13
13: ; preds = %6, %2
ret void
}
/* Variables and functions */
unsigned int floor(float);
unsigned int numeroArrotondatoAIntero(float x) { return floor(x + .5); }


x86 assembly (clang, -O0):
<numeroArrotondatoAIntero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xed2(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1030 <floor@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<numeroArrotondatoAIntero>:
addss  0xee8(%rip),%xmm0
jmp    1030 <floor@plt>

LLVM IR (-O0):
define i32 @numeroArrotondatoAIntero(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = fadd double %4, 5.000000e-01
%6 = fptrunc double %5 to float
%7 = call i32 @floor(float %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @numeroArrotondatoAIntero(float %0) {
%2 = fadd float %0, 5.000000e-01
%3 = tail call i32 @floor(float %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ teste(char *);
char *teste2();
int main() {
  char texto[10];
  teste(texto);
  printf("\nRESULTADO: %s\n", texto);
  char *texto2 = teste2();
  if (texto2 != NULL) {
    printf("\nRESULTADO: %s\n", texto2);
    free(texto2);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xe(%rbp),%rdi
call   1060 <teste@plt>
lea    -0xe(%rbp),%rsi
lea    0xe9d(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <teste2@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1197 <main+0x57>
mov    -0x18(%rbp),%rsi
lea    0xe77(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0x6(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <teste@plt>
lea    0xea7(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <teste2@plt>
test   %rax,%rax
je     1187 <main+0x47>
mov    %rax,%rbx
lea    0xe89(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"\0ARESULTADO: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = alloca i8*
store i32 0, i32* %1
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%5 = call i32 @teste(i8* %4)
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%7 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = call i8* (...) @teste2()
store i8* %8, i8** %3
%9 = load i8*, i8** %3
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %16
11: ; preds = %0
%12 = load i8*, i8** %3
%13 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = load i8*, i8** %3
%15 = call i32 @free(i8* %14)
br label %16
16: ; preds = %11, %0
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
@.str = [16 x i8] c"\0ARESULTADO: %s\0A\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 @teste(i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = call i8* (...) @teste2()
%6 = icmp eq i8* %5, null
br i1 %6, label %10, label %7
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %5)
%9 = call i32 @free(i8* %5)
br label %10
10: ; preds = %7, %0
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char fgetc(int /*<<< orphan*/ *);
void __psh_seek_one_line(FILE *file) {
  while (fgetc(file) != '\n')
    ;
}


x86 assembly (clang, -O0):
<__psh_seek_one_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     1136 <__psh_seek_one_line+0x26>
jmp    111c <__psh_seek_one_line+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__psh_seek_one_line>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
call   1030 <fgetc@plt>
cmp    $0xa,%al
jne    1120 <__psh_seek_one_line+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @__psh_seek_one_line(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
br label %3
3: ; preds = %8, %1
%4 = load i32*, i32** %2
%5 = call signext i8 @fgetc(i32* %4)
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 10
br i1 %7, label %8, label %9
8: ; preds = %3
br label %3
9: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @__psh_seek_one_line(i32* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call signext i8 @fgetc(i32* %0)
%4 = icmp eq i8 %3, 10
br i1 %4, label %5, label %2
5: ; preds = %2
ret void
}
void X509_CRL_verify(void) {}


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

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

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

LLVM IR (-O2):
define void @X509_CRL_verify() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ nTabShift(int);
void IF_NTShiftR(void) { nTabShift(1); }


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

x86 assembly (clang, -O2):
<IF_NTShiftR>:
mov    $0x1,%edi
jmp    1030 <nTabShift@plt>

LLVM IR (-O0):
define void @IF_NTShiftR() {
%1 = call i32 @nTabShift(i32 1)
ret void
}

LLVM IR (-O2):
define void @IF_NTShiftR() {
%1 = tail call i32 @nTabShift(i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ putback(char);
size_t strlen(char *);
void unreads(register char *s) {
  register char *t;
  t = &s[strlen(s)];
  while (t > s)
    putback(*--t);
}


x86 assembly (clang, -O0):
<unreads>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
jbe    1176 <unreads+0x56>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
movsbl -0x1(%rax),%edi
call   1040 <putback@plt>
jmp    114b <unreads+0x2b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unreads>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strlen@plt>
test   %rax,%rax
jle    1152 <unreads+0x32>
mov    %rax,%rbx
add    %r14,%rbx
nopw   0x0(%rax,%rax,1)
movsbl -0x1(%rbx),%edi
add    $0xffffffffffffffff,%rbx
call   1040 <putback@plt>
cmp    %r14,%rbx
ja     1140 <unreads+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @unreads(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = icmp sgt i64 %2, 0
br i1 %3, label %4, label %12
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 %2
br label %6
6: ; preds = %4, %6
%7 = phi i8* [ %8, %6 ], [ %5, %4 ]
%8 = getelementptr inbounds i8, i8* %7, i64 -1
%9 = load i8, i8* %8
%10 = tail call i32 @putback(i8 signext %9)
%11 = icmp ugt i8* %8, %0
br i1 %11, label %6, label %12
12: ; preds = %6, %1
ret void
}
void l2_symbolic_overrun_Bad(int *n) {
  int a[*n];
  a[*n] = 0;
}


x86 assembly (clang, -O0):
<l2_symbolic_overrun_Bad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,%ecx
mov    %rsp,%rax
mov    %rax,-0x10(%rbp)
lea    0xf(,%rcx,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rax
sub    %rdx,%rax
mov    %rax,%rsp
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%rcx
movslq (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @l2_symbolic_overrun_Bad(i32* %0) {
%2 = alloca i32*
%3 = alloca i8*
%4 = alloca i64
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = load i32, i32* %5
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
store i8* %8, i8** %3
%9 = alloca i32, i64 %7
store i64 %7, i64* %4
%10 = load i32*, i32** %2
%11 = load i32, i32* %10
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %9, i64 %12
store i32 0, i32* %13
%14 = load i8*, i8** %3
ret void
}

LLVM IR (-O2):
define void @l2_symbolic_overrun_Bad(i32* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clean_socks();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void error(const char *reason) {
  fprintf(stderr,
          "\033[31m"
          "[-] Error: %s\n"
          "\033[0m",
          reason);
  fprintf(stderr, "netsed: exiting.\n");
  clean_socks();
  exit(2);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xeb0(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
lea    0xeb1(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <clean_socks@plt>
mov    $0x2,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rbx
mov    %rdi,%rdx
mov    0x2ea5(%rip),%rbx
mov    (%rbx),%edi
lea    0xebc(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xec4(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <clean_socks@plt>
mov    $0x2,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"\1B[31m[-] Error: %s\0A\1B[0m\00"
@.str.1 = [18 x i8] c"netsed: exiting.\0A\00"
define void @error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @stderr
%7 = call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (...) @clean_socks()
%9 = call i32 @exit(i32 2)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"\1B[31m[-] Error: %s\0A\1B[0m\00"
@.str.1 = [18 x i8] c"netsed: exiting.\0A\00"
define void @error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 (...) @clean_socks()
%7 = tail call i32 @exit(i32 2)
unreachable
}