xunge/DecIR huggingface dataset:
int _read(int file, char *ptr, int len) { return -1; }


x86 assembly (clang, -O0):
<_read>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @_read(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
ret i32 -1
}

LLVM IR (-O2):
define i32 @_read(i32 %0, i8* nocapture readnone %1, i32 %2) {
ret i32 -1
}
int isDIGIT(char *request, int *cursor) {
  if ((request[(*cursor)] >= '0') && (request[(*cursor)] <= '9')) {
    (*cursor)++;
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<isDIGIT>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq (%rcx),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x30,%eax
jl     1153 <isDIGIT+0x53>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq (%rcx),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x39,%eax
jg     1153 <isDIGIT+0x53>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    115a <isDIGIT+0x5a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isDIGIT>:
movslq (%rsi),%rcx
mov    (%rdi,%rcx,1),%dl
add    $0xd0,%dl
xor    %eax,%eax
cmp    $0x9,%dl
ja     111a <isDIGIT+0x1a>
add    $0x1,%ecx
mov    %ecx,(%rsi)
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @isDIGIT(i8* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = add i8 %6, -48
%8 = icmp ult i8 %7, 10
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = add nsw i32 %3, 1
store i32 %10, i32* %1
br label %11
11: ; preds = %2, %9
%12 = phi i32 [ 1, %9 ], [ 0, %2 ]
ret i32 %12
}
/* Type definitions */
typedef int *p;

/* Variables and functions */
int /*<<< orphan*/ free(int *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int *p = (int *)malloc(2 * sizeof(int));
  *p = 2;
  *(p + 1) = *(p)-1;
  *p = p[1];
  printf("%d", *p);
  free(p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x2,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xe7f(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
movabs $0x100000001,%rax
mov    %rax,(%rbx)
lea    0xeae(%rip),%rdi
mov    $0x1,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = call i64 @malloc(i32 8)
%4 = inttoptr i64 %3 to i32*
store i32* %4, i32** %2
%5 = load i32*, i32** %2
store i32 2, i32* %5
%6 = load i32*, i32** %2
%7 = load i32, i32* %6
%8 = sub nsw i32 %7, 1
%9 = load i32*, i32** %2
%10 = getelementptr inbounds i32, i32* %9, i64 1
store i32 %8, i32* %10
%11 = load i32*, i32** %2
%12 = getelementptr inbounds i32, i32* %11, i64 1
%13 = load i32, i32* %12
%14 = load i32*, i32** %2
store i32 %13, i32* %14
%15 = load i32*, i32** %2
%16 = load i32, i32* %15
%17 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = load i32*, i32** %2
%19 = call i32 @free(i32* %18)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 8)
%2 = inttoptr i64 %1 to i32*
%3 = getelementptr inbounds i32, i32* %2, i64 1
store i32 1, i32* %3
store i32 1, i32* %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 1)
%5 = tail call i32 @free(i32* %2)
ret i32 0
}
/* Variables and functions */
char *strchr(char *, char);
char *strdup(char const *);
char *ct_extract_cttype(const char *ct_contenttype) {
  char *local_cttype;
  char *cttype_slash;
  if ((local_cttype = strdup(ct_contenttype)) == NULL)
    return (NULL);
  if ((cttype_slash = strchr(local_cttype, '/')) != NULL)
    *cttype_slash = '\0';
  return (local_cttype);
}


x86 assembly (clang, -O0):
<ct_extract_cttype>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1150 <ct_extract_cttype+0x30>
movq   $0x0,-0x8(%rbp)
jmp    117b <ct_extract_cttype+0x5b>
mov    -0x18(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     1173 <ct_extract_cttype+0x53>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ct_extract_cttype>:
push   %rbx
call   1040 <strdup@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1143 <ct_extract_cttype+0x23>
mov    %rbx,%rdi
mov    $0x2f,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1143 <ct_extract_cttype+0x23>
movb   $0x0,(%rax)
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @ct_extract_cttype(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i8* @strdup(i8* %6)
store i8* %7, i8** %4
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %10
9: ; preds = %1
store i8* null, i8** %2
br label %18
10: ; preds = %1
%11 = load i8*, i8** %4
%12 = call i8* @strchr(i8* %11, i8 signext 47)
store i8* %12, i8** %5
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = load i8*, i8** %5
store i8 0, i8* %15
br label %16
16: ; preds = %14, %10
%17 = load i8*, i8** %4
store i8* %17, i8** %2
br label %18
18: ; preds = %16, %9
%19 = load i8*, i8** %2
ret i8* %19
}

LLVM IR (-O2):
define i8* @ct_extract_cttype(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i8* @strchr(i8* %2, i8 signext 47)
%6 = icmp eq i8* %5, null
br i1 %6, label %8, label %7
7: ; preds = %4
store i8 0, i8* %5
br label %8
8: ; preds = %4, %7, %1
ret i8* %2
}
void append_usb_interfaces(void) {}


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

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

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

LLVM IR (-O2):
define void @append_usb_interfaces() {
ret void
}
/* Variables and functions */
char *malloc(int);
void call_malloc() {
  char *buf = malloc(100);
  while (*buf)
    buf++;
}


x86 assembly (clang, -O0):
<call_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x64,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1144 <call_malloc+0x34>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1126 <call_malloc+0x16>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @call_malloc() {
ret void
}
void ARGBToRGB24Row_Any_AVX512VBMI() {}


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

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

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

LLVM IR (-O2):
define void @ARGBToRGB24Row_Any_AVX512VBMI() {
ret void
}
void joystick_close() {}


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

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

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

LLVM IR (-O2):
define void @joystick_close() {
ret void
}
/* Type definitions */
struct lobject {
  int dummy;
};
struct lemon {
  int dummy;
};

/* Variables and functions */
struct lobject *lobject_call(struct lemon *, struct lobject *, int,
                             struct lobject **);
struct lobject *machine_call_getter(struct lemon *lemon, struct lobject *getter,
                                    struct lobject *self, struct lobject *name,
                                    struct lobject *value) {
  return lobject_call(lemon, getter, 1, &value);
}


x86 assembly (clang, -O0):
<machine_call_getter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
lea    -0x28(%rbp),%rcx
call   1030 <lobject_call@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<machine_call_getter>:
push   %rax
mov    %r8,(%rsp)
mov    %rsp,%rcx
mov    $0x1,%edx
call   1030 <lobject_call@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.lemon = type { i32 }
%struct.lobject = type { i32 }
define %struct.lobject* @machine_call_getter(%struct.lemon* %0, %struct.lobject* %1, %struct.lobject* nocapture readnone %2, %struct.lobject* nocapture readnone %3, %struct.lobject* %4) {
%6 = alloca %struct.lobject*
store %struct.lobject* %4, %struct.lobject** %6
%7 = call %struct.lobject* @lobject_call(%struct.lemon* %0, %struct.lobject* %1, i32 1, %struct.lobject** %6)
ret %struct.lobject* %7
}
void dfn_acf(_Complex float f) {}


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

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

LLVM IR (-O0):
define void @dfn_acf(<2 x float> %0) {
%2 = alloca { float, float }
%3 = bitcast { float, float }* %2 to <2 x float>*
store <2 x float> %0, <2 x float>* %3
ret void
}

LLVM IR (-O2):
define void @dfn_acf(<2 x float> %0) {
ret void
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
void TimerCcpCombineEnable(uint32_t ui32Base) {
  ;
  (*((volatile unsigned long *)(ui32Base + 0x00000FB4))) |= 0x00000001;
}


x86 assembly (clang, -O0):
<TimerCcpCombineEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0xfb4(%rax),%rcx
or     $0x1,%rcx
mov    %rcx,0xfb4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerCcpCombineEnable>:
orq    $0x1,0xfb4(%rdi)
01
ret

LLVM IR (-O0):
define void @TimerCcpCombineEnable(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add nsw i64 %3, 4020
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
%7 = or i64 %6, 1
store volatile i64 %7, i64* %5
ret void
}

LLVM IR (-O2):
define void @TimerCcpCombineEnable(i64 %0) {
%2 = add nsw i64 %0, 4020
%3 = inttoptr i64 %2 to i64*
%4 = load volatile i64, i64* %3
%5 = or i64 %4, 1
store volatile i64 %5, i64* %3
ret void
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
size_t is_leap(int);
int32_t days_from_1jan(int32_t year, int32_t month, int32_t day) {
  static const int32_t days[2][12] = {
      {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334},
      {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335}};
  return days[is_leap(year)][month - 1] + day - 1;
}


x86 assembly (clang, -O0):
<days_from_1jan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <is_leap@plt>
mov    %rax,%rcx
lea    0xecd(%rip),%rax
imul   $0x30,%rcx,%rcx
add    %rcx,%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
add    -0xc(%rbp),%eax
sub    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<days_from_1jan>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,%ebp
call   1030 <is_leap@plt>
movslq %ebp,%rcx
lea    (%rax,%rax,2),%rax
shl    $0x4,%rax
lea    0xed2(%rip),%rdx
add    %rax,%rdx
mov    -0x4(%rdx,%rcx,4),%eax
add    %ebx,%eax
add    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@days_from_1jan.days = internal constant [2 x [12 x i32]] [[12 x i32] [i32 0, i32 31, i32 59, i32 90, i32 120, i32 151, i32 181, i32 212, i32 243, i32 273, i32 304, i32 334], [12 x i32] [i32 0, i32 31, i32 60, i32 91, i32 121, i32 152, i32 182, i32 213, i32 244, i32 274, i32 305, i32 335]]
define i32 @days_from_1jan(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 = call i64 @is_leap(i32 %7)
%9 = getelementptr inbounds [2 x [12 x i32]], [2 x [12 x i32]]* @days_from_1jan.days, i64 0, i64 %8
%10 = load i32, i32* %5
%11 = sub nsw i32 %10, 1
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [12 x i32], [12 x i32]* %9, i64 0, i64 %12
%14 = load i32, i32* %13
%15 = load i32, i32* %6
%16 = add nsw i32 %14, %15
%17 = sub nsw i32 %16, 1
ret i32 %17
}

LLVM IR (-O2):
@days_from_1jan.days = internal unnamed_addr constant [2 x [12 x i32]] [[12 x i32] [i32 0, i32 31, i32 59, i32 90, i32 120, i32 151, i32 181, i32 212, i32 243, i32 273, i32 304, i32 334], [12 x i32] [i32 0, i32 31, i32 60, i32 91, i32 121, i32 152, i32 182, i32 213, i32 244, i32 274, i32 305, i32 335]]
define i32 @days_from_1jan(i32 %0, i32 %1, i32 %2) {
%4 = tail call i64 @is_leap(i32 %0)
%5 = add nsw i32 %1, -1
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [2 x [12 x i32]], [2 x [12 x i32]]* @days_from_1jan.days, i64 0, i64 %4, i64 %6
%8 = load i32, i32* %7
%9 = add i32 %2, -1
%10 = add i32 %9, %8
ret i32 %10
}
/* Variables and functions */
int my_strlen(char *);
char *supr_adress(char *str1) {
  int i;
  i = my_strlen(str1);
  while (str1[i] != '/' && i > 0)
    --i;
  str1[i] = '\0';
  return (str1);
}


x86 assembly (clang, -O0):
<supr_adress>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <my_strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x2f,%ecx
mov    %al,-0xd(%rbp)
je     114c <supr_adress+0x3c>
cmpl   $0x0,-0xc(%rbp)
setg   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    115c <supr_adress+0x4c>
jmp    116a <supr_adress+0x5a>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1128 <supr_adress+0x18>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<supr_adress>:
push   %rbx
mov    %rdi,%rbx
call   1030 <my_strlen@plt>
cltq
nopl   0x0(%rax,%rax,1)
lea    -0x1(%rax),%rcx
cmpb   $0x2f,(%rbx,%rax,1)
je     1132 <supr_adress+0x22>
test   %rax,%rax
mov    %rcx,%rax
jg     1120 <supr_adress+0x10>
movb   $0x0,0x1(%rbx,%rcx,1)
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @supr_adress(i8* returned %0) {
%2 = tail call i32 @my_strlen(i8* %0)
%3 = sext i32 %2 to i64
br label %4
4: ; preds = %4, %1
%5 = phi i64 [ %11, %4 ], [ %3, %1 ]
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 47
%9 = icmp sgt i64 %5, 0
%10 = select i1 %8, i1 %9, i1 false
%11 = add nsw i64 %5, -1
br i1 %10, label %4, label %12
12: ; preds = %4
%13 = getelementptr inbounds i8, i8* %0, i64 %5
store i8 0, i8* %13
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ ngen(char *, char *, int /*<<< orphan*/);
void cginc2iw(void) { ngen("%s\t(%%rdx)", "incq", 0); }


x86 assembly (clang, -O0):
<cginc2iw>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xee9(%rip),%rsi
xor    %edx,%edx
call   1030 <ngen@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cginc2iw>:
lea    0xee9(%rip),%rdi
lea    0xeed(%rip),%rsi
xor    %edx,%edx
jmp    1030 <ngen@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"%s\09(%%rdx)\00"
@.str.1 = [5 x i8] c"incq\00"
define void @cginc2iw() {
%1 = call i32 @ngen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 0)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"%s\09(%%rdx)\00"
@.str.1 = [5 x i8] c"incq\00"
define void @cginc2iw() {
%1 = tail call i32 @ngen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_tu_length_add_test();
void test_tu_length_add_test_constructor(void) { test_tu_length_add_test(); }


x86 assembly (clang, -O0):
<test_tu_length_add_test_constructor>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <test_tu_length_add_test@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @test_tu_length_add_test_constructor() {
%1 = call i32 (...) @test_tu_length_add_test()
ret void
}

LLVM IR (-O2):
define void @test_tu_length_add_test_constructor() {
%1 = tail call i32 (...) @test_tu_length_add_test()
ret void
}
/* Variables and functions */
int convert(char *);
int main() {
  int no = 100, val;
  char str[] = "sIMPle";
  char tpr[20];
  val = convert(str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x64,-0x8(%rbp)
mov    0xed4(%rip),%eax
mov    %eax,-0x13(%rbp)
mov    0xece(%rip),%ax
mov    %ax,-0xf(%rbp)
mov    0xec6(%rip),%al
mov    %al,-0xd(%rbp)
lea    -0x13(%rbp),%rdi
call   1030 <convert@plt>
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x656c50,0x3(%rsp)
movl   $0x504d4973,(%rsp)
mov    %rsp,%rdi
call   1030 <convert@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@__const.main.str = [7 x i8] c"sIMPle\00"
define i32 @main() {
%1 = alloca [7 x i8]
%2 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%3 = call i32 @convert(i8* %2)
ret i32 0
}
unsigned int explicit_ununsigned_int_to_ununsigned_int(unsigned int src) {
  return (unsigned int)src;
}


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

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

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

LLVM IR (-O2):
define i32 @explicit_ununsigned_int_to_ununsigned_int(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int generate_snp_sites_generic(char *, int, int, int, char *, int,
                               int /*<<< orphan*/, int /*<<< orphan*/);
int generate_snp_sites_with_ref(char filename[], int output_multi_fasta_file,
                                int output_vcf_file, int output_phylip_file,
                                char output_filename[]) {
  return generate_snp_sites_generic(filename, output_multi_fasta_file,
                                    output_vcf_file, output_phylip_file,
                                    output_filename, 1, 0, 0);
}


x86 assembly (clang, -O0):
<generate_snp_sites_with_ref>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x20(%rbp),%r8
mov    $0x1,%r9d
xor    %eax,%eax
movl   $0x0,(%rsp)
movl   $0x0,0x8(%rsp)
call   1030 <generate_snp_sites_generic@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_snp_sites_with_ref>:
push   %rax
mov    $0x1,%r9d
push   $0x0
push   $0x0
call   1030 <generate_snp_sites_generic@plt>
add    $0x10,%rsp
pop    %rcx
ret

LLVM IR (-O0):
define i32 @generate_snp_sites_with_ref(i8* %0, i32 %1, i32 %2, i32 %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%11 = load i8*, i8** %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = load i32, i32* %9
%15 = load i8*, i8** %10
%16 = call i32 @generate_snp_sites_generic(i8* %11, i32 %12, i32 %13, i32 %14, i8* %15, i32 1, i32 0, i32 0)
ret i32 %16
}

LLVM IR (-O2):
define i32 @generate_snp_sites_with_ref(i8* %0, i32 %1, i32 %2, i32 %3, i8* %4) {
%6 = tail call i32 @generate_snp_sites_generic(i8* %0, i32 %1, i32 %2, i32 %3, i8* %4, i32 1, i32 0, i32 0)
ret i32 %6
}
char *ft_strchrrplc(char *str, int c_a, int c_b) {
  int i;
  i = 0;
  while (str[i]) {
    if (str[i] == c_a)
      str[i] = c_b;
    i++;
  }
  return (str);
}


x86 assembly (clang, -O0):
<ft_strchrrplc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     115a <ft_strchrrplc+0x5a>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    -0xc(%rbp),%eax
jne    114c <ft_strchrrplc+0x4c>
mov    -0x10(%rbp),%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1115 <ft_strchrrplc+0x15>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strchrrplc>:
mov    %rdi,%rax
mov    (%rdi),%dil
test   %dil,%dil
je     1139 <ft_strchrrplc+0x39>
lea    0x1(%rax),%rcx
jmp    112c <ft_strchrrplc+0x2c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl (%rcx),%edi
add    $0x1,%rcx
test   %dil,%dil
je     1139 <ft_strchrrplc+0x39>
movsbl %dil,%edi
cmp    %esi,%edi
jne    1120 <ft_strchrrplc+0x20>
mov    %dl,-0x1(%rcx)
jmp    1120 <ft_strchrrplc+0x20>
ret

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

LLVM IR (-O2):
define i8* @ft_strchrrplc(i8* returned %0, i32 %1, i32 %2) {
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %20, label %6
6: ; preds = %3
%7 = trunc i32 %2 to i8
br label %8
8: ; preds = %6, %15
%9 = phi i64 [ 0, %6 ], [ %16, %15 ]
%10 = phi i8 [ %4, %6 ], [ %18, %15 ]
%11 = phi i8* [ %0, %6 ], [ %17, %15 ]
%12 = sext i8 %10 to i32
%13 = icmp eq i32 %12, %1
br i1 %13, label %14, label %15
14: ; preds = %8
store i8 %7, i8* %11
br label %15
15: ; preds = %14, %8
%16 = add nuw i64 %9, 1
%17 = getelementptr inbounds i8, i8* %0, i64 %16
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %20, label %8
20: ; preds = %15, %3
ret i8* %0
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int width;
};
struct TYPE_4__ {
  TYPE_1__ xexpose;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
void set_XEvent_xexpose_width(void *_p, int _v) {
  ((XEvent *)_p)->xexpose.width = (int)_v;
}


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

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

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i32 }
define void @set_XEvent_xexpose_width(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_4__*
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
store i32 %5, i32* %9
ret void
}

LLVM IR (-O2):
define void @set_XEvent_xexpose_width(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int clear_set_structure(void) {
  int fail, *a, *b;
  double *c;
  fail = _ada_use_c2phc(115, a, b, c);
  return fail;
}


x86 assembly (clang, -O0):
<clear_set_structure>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x73,%edi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_set_structure>:
mov    $0x73,%edi
jmp    1030 <_ada_use_c2phc@plt>

LLVM IR (-O0):
define i32 @clear_set_structure() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca double*
%5 = load i32*, i32** %2
%6 = load i32*, i32** %3
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc(i32 115, i32* %5, i32* %6, double* %7)
store i32 %8, i32* %1
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
define i32 @clear_set_structure() {
%1 = tail call i32 @_ada_use_c2phc(i32 115, i32* undef, i32* undef, double* undef)
ret i32 %1
}
void setup_futex_sems(struct sem_wakeup_info **wi, int num_semids) { return; }


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

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

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

LLVM IR (-O2):
%struct.sem_wakeup_info = type opaque
define void @setup_futex_sems(%struct.sem_wakeup_info** nocapture %0, i32 %1) {
ret void
}
/* Type definitions */
struct ddr_set {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ serial_puts(char *);
void ddr_info_dump(struct ddr_set *timing_set) { serial_puts("\n"); }


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

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

LLVM IR (-O0):
%struct.ddr_set = type { i32 }
@.str = [2 x i8] c"\0A\00"
define void @ddr_info_dump(%struct.ddr_set* %0) {
%2 = alloca %struct.ddr_set*
store %struct.ddr_set* %0, %struct.ddr_set** %2
%3 = call i32 @serial_puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.ddr_set = type { i32 }
@.str = [2 x i8] c"\0A\00"
define void @ddr_info_dump(%struct.ddr_set* nocapture readnone %0) {
%2 = tail call i32 @serial_puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}
equate_tiff_headers(src, dest) struct tiff_header_struct *src, *dest;
{}


x86 assembly (clang, -O0):
<equate_tiff_headers>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
%struct.tiff_header_struct = type opaque
define i32 @equate_tiff_headers(%struct.tiff_header_struct* nocapture readnone %0, %struct.tiff_header_struct* nocapture readnone %1) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ test_getcwd_buf();
void test_getcwd(void) { test_getcwd_buf(); }


x86 assembly (clang, -O0):
<test_getcwd>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <test_getcwd_buf@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @test_getcwd() {
%1 = call i32 (...) @test_getcwd_buf()
ret void
}

LLVM IR (-O2):
define void @test_getcwd() {
%1 = tail call i32 (...) @test_getcwd_buf()
ret void
}
unsigned int getUpperPowerOfTwo(const unsigned int x) {
  unsigned int i = 1;
  while (i < x)
    i += i;
  return i;
}


x86 assembly (clang, -O0):
<getUpperPowerOfTwo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    1128 <getUpperPowerOfTwo+0x28>
mov    -0x8(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    110e <getUpperPowerOfTwo+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getUpperPowerOfTwo>:
mov    $0x1,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ecx,%eax
lea    (%rax,%rax,1),%ecx
cmp    %edi,%eax
jb     1110 <getUpperPowerOfTwo+0x10>
ret

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

LLVM IR (-O2):
define i32 @getUpperPowerOfTwo(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 1, %1 ], [ %5, %2 ]
%4 = icmp ult i32 %3, %0
%5 = shl i32 %3, 1
br i1 %4, label %2, label %6
6: ; preds = %2
ret i32 %3
}
double iteration(double (*f_ptr)(double), double x_i_m1, double x_i_m2) {
  double num = (x_i_m1 - x_i_m2);
  double den = (f_ptr(x_i_m1) - f_ptr(x_i_m2));
  double diff = (f_ptr(x_i_m1) * (num / den));
  return (x_i_m1 - diff);
}


x86 assembly (clang, -O0):
<iteration>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  -0x10(%rbp),%xmm0
call   *%rax
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
movsd  -0x18(%rbp),%xmm0
call   *%rax
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  -0x10(%rbp),%xmm0
call   *%rax
movsd  -0x20(%rbp),%xmm1
divsd  -0x28(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iteration>:
push   %rbx
sub    $0x20,%rsp
movsd  %xmm1,0x18(%rsp)
movsd  %xmm0,0x8(%rsp)
mov    %rdi,%rbx
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
movsd  %xmm2,(%rsp)
call   *%rdi
movsd  %xmm0,0x10(%rsp)
movsd  0x18(%rsp),%xmm0
call   *%rbx
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  (%rsp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
call   *%rbx
mulsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define double @iteration(double (double)* nocapture %0, double %1, double %2) {
%4 = fsub double %1, %2
%5 = tail call double %0(double %1)
%6 = tail call double %0(double %2)
%7 = fsub double %5, %6
%8 = tail call double %0(double %1)
%9 = fdiv double %4, %7
%10 = fmul double %8, %9
%11 = fsub double %1, %10
ret double %11
}
short num_short(unsigned char a, unsigned char b) {
  return ((short)((((short)b) << 8) | a));
}


x86 assembly (clang, -O0):
<num_short>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movzbl -0x2(%rbp),%eax
cwtl
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<num_short>:
shl    $0x8,%esi
lea    (%rsi,%rdi,1),%eax
ret

LLVM IR (-O0):
define signext i16 @num_short(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = zext i8 %5 to i16
%7 = sext i16 %6 to i32
%8 = shl i32 %7, 8
%9 = load i8, i8* %3
%10 = zext i8 %9 to i32
%11 = or i32 %8, %10
%12 = trunc i32 %11 to i16
ret i16 %12
}

LLVM IR (-O2):
define signext i16 @num_short(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %1 to i16
%4 = shl nuw i16 %3, 8
%5 = zext i8 %0 to i16
%6 = or i16 %4, %5
ret i16 %6
}
long factorial(long number) {
  if (number <= 1L)
    return 1L;
  return number * factorial(number - 1L);
}


x86 assembly (clang, -O0):
<factorial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x1,-0x10(%rbp)
jg     1134 <factorial+0x24>
movq   $0x1,-0x8(%rbp)
jmp    1158 <factorial+0x48>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
sub    $0x1,%rdi
call   1030 <factorial@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
imul   %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<factorial>:
mov    $0x1,%eax
cmp    $0x2,%rdi
jl     1121 <factorial+0x21>
mov    $0x1,%eax
imul   %rdi,%rax
lea    -0x1(%rdi),%rcx
cmp    $0x2,%rdi
mov    %rcx,%rdi
ja     1110 <factorial+0x10>
ret

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

LLVM IR (-O2):
define i64 @factorial(i64 %0) {
%2 = icmp slt i64 %0, 2
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %6, %3 ], [ %0, %1 ]
%5 = phi i64 [ %7, %3 ], [ 1, %1 ]
%6 = add nsw i64 %4, -1
%7 = mul nsw i64 %4, %5
%8 = icmp ult i64 %4, 3
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i64 [ 1, %1 ], [ %7, %3 ]
ret i64 %10
}
/* Variables and functions */
int /*<<< orphan*/ vec_saxpy(unsigned int, float *, float const *, int,
                             float const *);
void vec_copy(unsigned N, float dst[N], const float src[N]) {
  vec_saxpy(N, dst, src, 0., src);
}


x86 assembly (clang, -O0):
<vec_copy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x18(%rbp),%r8
xor    %ecx,%ecx
call   1030 <vec_saxpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec_copy>:
xor    %ecx,%ecx
mov    %rdx,%r8
jmp    1030 <vec_saxpy@plt>

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

LLVM IR (-O2):
define void @vec_copy(i32 %0, float* %1, float* %2) {
%4 = tail call i32 @vec_saxpy(i32 %0, float* %1, float* %2, i32 0, float* %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int _fmtinpt(char const *, char const *, int /*<<< orphan*/);
int vsscanf(const char *input, const char *format, va_list list) {
  int inputItems = 0;
  inputItems = _fmtinpt(input, format, list);
  return (inputItems);
}


x86 assembly (clang, -O0):
<vsscanf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <_fmtinpt@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vsscanf>:
jmp    1030 <_fmtinpt@plt>

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

LLVM IR (-O2):
define i32 @vsscanf(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @_fmtinpt(i8* %0, i8* %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void print1DArray(int size, int array[size]) {
  for (int i = 0; i < size; i++) {
    printf("array[%d] = %d\n", i, array[i]);
  }
}


x86 assembly (clang, -O0):
<print1DArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    115a <print1DArray+0x4a>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <print1DArray+0x16>
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [16 x i8] c"array[%d] = %d\0A\00"
define void @print1DArray(i32 %0, i32* nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %7
6: ; preds = %7, %2
ret void
7: ; preds = %4, %7
%8 = phi i64 [ 0, %4 ], [ %13, %7 ]
%9 = getelementptr inbounds i32, i32* %1, i64 %8
%10 = load i32, i32* %9
%11 = trunc i64 %8 to i32
%12 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %10)
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %5
br i1 %14, label %6, label %7
}
/* Variables and functions */
double Section2Area(float);
double Section2Perim(float);
int /*<<< orphan*/ printf(char *, double, double);
int Section2(float radius) {
  printf("\n2.- The perimeter is: %.2f, the area is: %.2f\n",
         Section2Perim(radius), Section2Area(radius));
  return 0;
}


x86 assembly (clang, -O0):
<Section2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1050 <Section2Perim@plt>
movsd  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <Section2Area@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
lea    0xe9b(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Section2>:
sub    $0x18,%rsp
movss  %xmm0,0xc(%rsp)
call   1050 <Section2Perim@plt>
movsd  %xmm0,0x10(%rsp)
movss  0xc(%rsp),%xmm0
call   1030 <Section2Area@plt>
movaps %xmm0,%xmm1
lea    0xea6(%rip),%rdi
movsd  0x10(%rsp),%xmm0
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [48 x i8] c"\0A2.- The perimeter is: %.2f, the area is: %.2f\0A\00"
define i32 @Section2(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call double @Section2Perim(float %3)
%5 = load float, float* %2
%6 = call double @Section2Area(float %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), double %4, double %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [48 x i8] c"\0A2.- The perimeter is: %.2f, the area is: %.2f\0A\00"
define i32 @Section2(float %0) {
%2 = tail call double @Section2Perim(float %0)
%3 = tail call double @Section2Area(float %0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), double %2, double %3)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
struct tm const *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
const struct tm *timeinfo() {
  time_t raw = time(NULL);
  return localtime(&raw);
}


x86 assembly (clang, -O0):
<timeinfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timeinfo>:
push   %rax
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <localtime@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define %struct.tm* @timeinfo() {
%1 = alloca i32
%2 = call i32 @time(i32* null)
store i32 %2, i32* %1
%3 = call %struct.tm* @localtime(i32* %1)
ret %struct.tm* %3
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define %struct.tm* @timeinfo() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @time(i32* null)
store i32 %3, i32* %1
%4 = call %struct.tm* @localtime(i32* %1)
ret %struct.tm* %4
}
extern int multiply(const int num1, const int num2) { return num1 * num2; }


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

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

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

LLVM IR (-O2):
define i32 @multiply(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
ret i32 %3
}