xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ FNM_NOESCAPE;
scalar_t__ fnmatch(char const *const, char const *, int /*<<< orphan*/);
int check_path(const char *file_name, const char *const *parms, int parm_pos) {
  if (fnmatch(parms[parm_pos + 1], file_name, FNM_NOESCAPE) == 0) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<check_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x10(%rbp),%rsi
mov    0x2eb9(%rip),%rax
mov    (%rax),%edx
call   1030 <fnmatch@plt>
cmp    $0x0,%rax
jne    115c <check_path+0x4c>
movl   $0x1,-0x4(%rbp)
jmp    1163 <check_path+0x53>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_path>:
push   %rax
mov    %rdi,%rax
movslq %edx,%rcx
mov    0x8(%rsi,%rcx,8),%rdi
mov    0x2ed5(%rip),%rcx
mov    (%rcx),%edx
mov    %rax,%rsi
call   1030 <fnmatch@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@FNM_NOESCAPE = global i32 0
define i32 @check_path(i8* %0, i8** nocapture %1, i32 %2) {
%4 = add nsw i32 %2, 1
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8*, i8** %1, i64 %5
%7 = load i8*, i8** %6
%8 = load i32, i32* @FNM_NOESCAPE
%9 = tail call i64 @fnmatch(i8* %7, i8* %0, i32 %8)
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
ret i32 %11
}
/* Variables and functions */
scalar_t__ space(int);
int /*<<< orphan*/ strcat(char *, char const *);
int strlen(char const *);
char *add_root(const char *structure) {
  char *xS;
  xS = (char *)space(sizeof(char) * (strlen(structure) + 4));
  xS[0] = '(';
  strcat(xS, structure);
  strcat(xS, "R)");
  return xS;
}


x86 assembly (clang, -O0):
<add_root>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x4,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1030 <space@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x28,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1050 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    0xe88(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_root>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x4(%rax),%edi
call   1030 <space@plt>
mov    %rax,%rbx
movb   $0x28,(%rax)
mov    %rax,%rdi
mov    %r14,%rsi
call   1050 <strcat@plt>
lea    0xea4(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"R)\00"
define i8* @add_root(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = add nsw i32 %5, 4
%7 = sext i32 %6 to i64
%8 = mul i64 1, %7
%9 = trunc i64 %8 to i32
%10 = call i64 @space(i32 %9)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %3
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i64 0
store i8 40, i8* %13
%14 = load i8*, i8** %3
%15 = load i8*, i8** %2
%16 = call i32 @strcat(i8* %14, i8* %15)
%17 = load i8*, i8** %3
%18 = call i32 @strcat(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%19 = load i8*, i8** %3
ret i8* %19
}

LLVM IR (-O2):
@.str = [3 x i8] c"R)\00"
define i8* @add_root(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 4
%4 = tail call i64 @space(i32 %3)
%5 = inttoptr i64 %4 to i8*
store i8 40, i8* %5
%6 = tail call i32 @strcat(i8* %5, i8* %0)
%7 = tail call i32 @strcat(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_replace() {
  printf("NOT IMPLEMENTED:"
         "pa_replace"
         "\n");
}


x86 assembly (clang, -O0):
<pa_replace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [28 x i8] c"NOT IMPLEMENTED:pa_replace\0A\00"
define i32 @pa_replace() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [27 x i8] c"NOT IMPLEMENTED:pa_replace\00"
define i32 @pa_replace() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
double __ocml_round_f64(double);
double round(double x) { return __ocml_round_f64(x); }


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

x86 assembly (clang, -O2):
<round>:
jmp    1030 <__ocml_round_f64@plt>

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

LLVM IR (-O2):
define double @round(double %0) {
%2 = tail call double @__ocml_round_f64(double %0)
ret double %2
}
short ctos(unsigned char *buffer) {
  short temp = 0;
  temp += buffer[0];
  temp += buffer[1] << 8;
  return temp;
}


x86 assembly (clang, -O0):
<ctos>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movw   $0x0,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%ecx
movswl -0xa(%rbp),%eax
add    %ecx,%eax
mov    %ax,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%ecx
shl    $0x8,%ecx
movswl -0xa(%rbp),%eax
add    %ecx,%eax
mov    %ax,-0xa(%rbp)
movswl -0xa(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ctos>:
movzwl (%rdi),%eax
ret

LLVM IR (-O0):
define signext i16 @ctos(i8* %0) {
%2 = alloca i8*
%3 = alloca i16
store i8* %0, i8** %2
store i16 0, i16* %3
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = load i16, i16* %3
%9 = sext i16 %8 to i32
%10 = add nsw i32 %9, %7
%11 = trunc i32 %10 to i16
store i16 %11, i16* %3
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i64 1
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = shl i32 %15, 8
%17 = load i16, i16* %3
%18 = sext i16 %17 to i32
%19 = add nsw i32 %18, %16
%20 = trunc i32 %19 to i16
store i16 %20, i16* %3
%21 = load i16, i16* %3
ret i16 %21
}

LLVM IR (-O2):
define signext i16 @ctos(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = getelementptr inbounds i8, i8* %0, i64 1
%4 = load i8, i8* %3
%5 = zext i8 %4 to i16
%6 = shl nuw i16 %5, 8
%7 = zext i8 %2 to i16
%8 = or i16 %6, %7
ret i16 %8
}
void UI_get0_action_string(void) {}


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

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

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

LLVM IR (-O2):
define void @UI_get0_action_string() {
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int bit_gravity;
};
typedef TYPE_1__ XSetWindowAttributes;

/* Variables and functions */
void set_XSetWindowAttributes_bit_gravity(void *_p, int _v) {
  ((XSetWindowAttributes *)_p)->bit_gravity = (int)_v;
}


x86 assembly (clang, -O0):
<set_XSetWindowAttributes_bit_gravity>:
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_XSetWindowAttributes_bit_gravity>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define void @set_XSetWindowAttributes_bit_gravity(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_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @set_XSetWindowAttributes_bit_gravity(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
/* Variables and functions */
int check_arg_count(int, int /*<<< orphan*/);
int /*<<< orphan*/ def_prog_mode();
int /*<<< orphan*/ report_count(int);
int /*<<< orphan*/ report_return(int /*<<< orphan*/);
void cmd_def_prog_mode(int nargs, char **args) {
  if (check_arg_count(nargs, 0) == 1)
    return;
  report_count(1);
  report_return(def_prog_mode());
}


x86 assembly (clang, -O0):
<cmd_def_prog_mode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1040 <check_arg_count@plt>
cmp    $0x1,%eax
jne    1167 <cmd_def_prog_mode+0x27>
jmp    117f <cmd_def_prog_mode+0x3f>
mov    $0x1,%edi
call   1050 <report_count@plt>
mov    $0x0,%al
call   1060 <def_prog_mode@plt>
mov    %eax,%edi
call   1030 <report_return@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_def_prog_mode>:
push   %rax
xor    %esi,%esi
call   1040 <check_arg_count@plt>
cmp    $0x1,%eax
jne    114f <cmd_def_prog_mode+0xf>
pop    %rax
ret
mov    $0x1,%edi
call   1050 <report_count@plt>
xor    %eax,%eax
call   1060 <def_prog_mode@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <report_return@plt>

LLVM IR (-O0):
define void @cmd_def_prog_mode(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = call i32 @check_arg_count(i32 %5, i32 0)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %9
8: ; preds = %2
br label %13
9: ; preds = %2
%10 = call i32 @report_count(i32 1)
%11 = call i32 (...) @def_prog_mode()
%12 = call i32 @report_return(i32 %11)
br label %13
13: ; preds = %9, %8
ret void
}

LLVM IR (-O2):
define void @cmd_def_prog_mode(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @check_arg_count(i32 %0, i32 0)
%4 = icmp eq i32 %3, 1
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = tail call i32 @report_count(i32 1)
%7 = tail call i32 (...) @def_prog_mode()
%8 = tail call i32 @report_return(i32 %7)
br label %9
9: ; preds = %2, %5
ret void
}
int mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) {
  return 0;
}


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

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

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

LLVM IR (-O2):
%struct.mpc_table = type opaque
define i32 @mps_oem_check(%struct.mpc_table* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ key_t;

/* Variables and functions */
int syscall(int, int, int /*<<< orphan*/, int, int);
int semget(key_t key, int n, int fl) { return syscall(117, 2, key, n, fl); }


x86 assembly (clang, -O0):
<semget>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%r8d
mov    $0x75,%edi
mov    $0x2,%esi
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<semget>:
mov    %edx,%r8d
mov    %esi,%ecx
mov    %edi,%edx
mov    $0x75,%edi
mov    $0x2,%esi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
define i32 @semget(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 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @syscall(i32 117, i32 2, i32 %7, i32 %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @semget(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @syscall(i32 117, i32 2, i32 %0, i32 %1, i32 %2)
ret i32 %4
}
int isalpha(int c) {
  return ((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z');
}


x86 assembly (clang, -O0):
<isalpha>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x61,-0x4(%rbp)
jl     1120 <isalpha+0x20>
mov    $0x1,%al
cmpl   $0x7a,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jle    113f <isalpha+0x3f>
xor    %eax,%eax
cmpl   $0x41,-0x4(%rbp)
mov    %al,-0x6(%rbp)
jl     1139 <isalpha+0x39>
cmpl   $0x5a,-0x4(%rbp)
setle  %al
mov    %al,-0x6(%rbp)
mov    -0x6(%rbp),%al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isalpha>:
and    $0xffffffdf,%edi
add    $0xffffffbf,%edi
xor    %eax,%eax
cmp    $0x1a,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @isalpha(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 97
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 122
br i1 %7, label %16, label %8
8: ; preds = %5, %1
%9 = load i32, i32* %2
%10 = icmp sge i32 %9, 65
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* %2
%13 = icmp sle i32 %12, 90
br label %14
14: ; preds = %11, %8
%15 = phi i1 [ false, %8 ], [ %13, %11 ]
br label %16
16: ; preds = %14, %5
%17 = phi i1 [ true, %5 ], [ %15, %14 ]
%18 = zext i1 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @isalpha(i32 %0) {
%2 = and i32 %0, -33
%3 = add i32 %2, -65
%4 = icmp ult i32 %3, 26
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sync();
int main(int argc, char **argv, char **envp) {
  printf("Synchronizing filesystems...");
  sync();
  printf("OK\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <sync@plt>
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <sync@plt>
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Synchronizing filesystems...\00"
@.str.1 = [4 x i8] c"OK\0A\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8**
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8** %2, i8*** %6
%7 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (...) @sync()
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"Synchronizing filesystems...\00"
@str = [3 x i8] c"OK\00"
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 (...) @sync()
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ putchar(int);
void out_char(int ch) { putchar(ch); }


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

x86 assembly (clang, -O2):
<out_char>:
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @out_char(i32 %0) {
%2 = tail call i32 @putchar(i32 %0)
ret void
}
void av_shrink_packet() {}


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

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

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

LLVM IR (-O2):
define void @av_shrink_packet() {
ret void
}
void cpu_relax(void) { __asm volatile("" : : : "memory"); }


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

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

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

LLVM IR (-O2):
define void @cpu_relax() {
tail call void asm sideeffect "", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Type definitions */
struct resman {
  int dummy;
};

/* Variables and functions */
int resman_add(struct resman *, char const *, void *);
int resman_lookup(struct resman *rman, const char *fname, void *data) {
  return resman_add(rman, fname, data);
}


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

x86 assembly (clang, -O2):
<resman_lookup>:
jmp    1030 <resman_add@plt>

LLVM IR (-O0):
%struct.resman = type { i32 }
define i32 @resman_lookup(%struct.resman* %0, i8* %1, i8* %2) {
%4 = alloca %struct.resman*
%5 = alloca i8*
%6 = alloca i8*
store %struct.resman* %0, %struct.resman** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load %struct.resman*, %struct.resman** %4
%8 = load i8*, i8** %5
%9 = load i8*, i8** %6
%10 = call i32 @resman_add(%struct.resman* %7, i8* %8, i8* %9)
ret i32 %10
}

LLVM IR (-O2):
%struct.resman = type { i32 }
define i32 @resman_lookup(%struct.resman* %0, i8* %1, i8* %2) {
%4 = tail call i32 @resman_add(%struct.resman* %0, i8* %1, i8* %2)
ret i32 %4
}
/* Variables and functions */
scalar_t__ malloc(int);
char *CuStrAlloc(size_t size) {
  char *newStr = (char *)malloc(sizeof(char) * (size));
  return newStr;
}


x86 assembly (clang, -O0):
<CuStrAlloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CuStrAlloc>:
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @CuStrAlloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = mul i64 1, %4
%6 = trunc i64 %5 to i32
%7 = call i64 @malloc(i32 %6)
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %3
%9 = load i8*, i8** %3
ret i8* %9
}

LLVM IR (-O2):
define i8* @CuStrAlloc(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = tail call i64 @malloc(i32 %2)
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
char *ctime(int /*<<< orphan*/ *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
char *get_curr_ctime(void) {
  time_t now;
  char *text;
  time(&now);
  text = ctime(&now);
  text[24] = 0;
  return text;
}


x86 assembly (clang, -O0):
<get_curr_ctime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
call   1040 <time@plt>
lea    -0x4(%rbp),%rdi
call   1030 <ctime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,0x18(%rax)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_curr_ctime>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <time@plt>
mov    %rbx,%rdi
call   1030 <ctime@plt>
movb   $0x0,0x18(%rax)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i8* @get_curr_ctime() {
%1 = alloca i32
%2 = alloca i8*
%3 = call i32 @time(i32* %1)
%4 = call i8* @ctime(i32* %1)
store i8* %4, i8** %2
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8, i8* %5, i64 24
store i8 0, i8* %6
%7 = load i8*, i8** %2
ret i8* %7
}

LLVM IR (-O2):
define i8* @get_curr_ctime() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @time(i32* %1)
%4 = call i8* @ctime(i32* %1)
%5 = getelementptr inbounds i8, i8* %4, i64 24
store i8 0, i8* %5
ret i8* %4
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t grid_gets(const uint8_t *buf) {
  return (((uint16_t)buf[0]) << 8) | ((uint16_t)buf[1]);
}


x86 assembly (clang, -O0):
<grid_gets>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
mov    0x8(%rcx),%rcx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<grid_gets>:
mov    (%rdi),%eax
shl    $0x8,%eax
or     0x8(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @grid_gets(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = getelementptr inbounds i64, i64* %3, i64 0
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = shl i32 %6, 8
%8 = load i64*, i64** %2
%9 = getelementptr inbounds i64, i64* %8, i64 1
%10 = load i64, i64* %9
%11 = trunc i64 %10 to i32
%12 = or i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @grid_gets(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = trunc i64 %2 to i32
%4 = shl i32 %3, 8
%5 = getelementptr inbounds i64, i64* %0, i64 1
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i32
%8 = or i32 %4, %7
ret i32 %8
}
/* Variables and functions */
scalar_t__ isnan(float);
unsigned int value_as_int(float value) {
  union {
    float f;
    unsigned int i;
  } u = {.f = value};
  if (isnan(value))
    return 0x7fffffff;
  return u.i;
}


x86 assembly (clang, -O0):
<value_as_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <isnan@plt>
cmp    $0x0,%rax
je     1147 <value_as_int+0x37>
movl   $0x7fffffff,-0x4(%rbp)
jmp    114d <value_as_int+0x3d>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<value_as_int>:
push   %rax
movss  %xmm0,0x4(%rsp)
call   1030 <isnan@plt>
test   %rax,%rax
movd   0x4(%rsp),%xmm0
movd   %xmm0,%ecx
mov    $0x7fffffff,%eax
cmove  %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%union.anon = type { float }
define i32 @value_as_int(float %0) {
%2 = alloca i32
%3 = alloca float
%4 = alloca %union.anon
store float %0, float* %3
%5 = bitcast %union.anon* %4 to float*
%6 = load float, float* %3
store float %6, float* %5
%7 = load float, float* %3
%8 = call i64 @isnan(float %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 2147483647, i32* %2
br label %14
11: ; preds = %1
%12 = bitcast %union.anon* %4 to i32*
%13 = load i32, i32* %12
store i32 %13, i32* %2
br label %14
14: ; preds = %11, %10
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @value_as_int(float %0) {
%2 = tail call i64 @isnan(float %0)
%3 = icmp eq i64 %2, 0
%4 = bitcast float %0 to i32
%5 = select i1 %3, i32 %4, i32 2147483647
ret i32 %5
}
unsigned long djb2_hash(unsigned char *str) {
  unsigned long hash = ((unsigned long)5381);
  char c;
  while ((c = *str++))
    hash = ((hash << 5) + hash) + c;
  return hash;
}


x86 assembly (clang, -O0):
<djb2_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x1505,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    %al,-0x11(%rbp)
cmp    $0x0,%al
je     1149 <djb2_hash+0x49>
mov    -0x10(%rbp),%rax
shl    $0x5,%rax
add    -0x10(%rbp),%rax
movsbq -0x11(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <djb2_hash+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<djb2_hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     112d <djb2_hash+0x2d>
add    $0x1,%rdi
mov    $0x1505,%eax
nop
mov    %rax,%rdx
shl    $0x5,%rdx
add    %rax,%rdx
movsbq %cl,%rax
add    %rdx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <djb2_hash+0x10>
ret
mov    $0x1505,%eax
ret

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

LLVM IR (-O2):
define i64 @djb2_hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = phi i64 [ %11, %4 ], [ 5381, %1 ]
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = mul i64 %7, 33
%10 = sext i8 %5 to i64
%11 = add i64 %9, %10
%12 = load i8, i8* %8
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i64 [ 5381, %1 ], [ %11, %4 ]
ret i64 %15
}
/* Type definitions */
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int STDERR_FILENO;
int STDIN_FILENO;
int STDOUT_FILENO;
off_t lseek(int fd, off_t offset, int _whence) {
  if ((STDIN_FILENO == fd) || (STDOUT_FILENO == fd) || (STDERR_FILENO == fd)) {
    return ((off_t)-1);
  }
  return ((off_t)-1);
}


x86 assembly (clang, -O0):
<lseek>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    0x2ebc(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
je     1143 <lseek+0x43>
mov    0x2eca(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
je     1143 <lseek+0x43>
mov    0x2ea0(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jne    114f <lseek+0x4f>
movl   $0xffffffff,-0x4(%rbp)
jmp    1156 <lseek+0x56>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
@STDIN_FILENO = global i32 0
@STDOUT_FILENO = global i32 0
@STDERR_FILENO = global i32 0
define i32 @lseek(i32 %0, i32 %1, i32 %2) {
ret i32 -1
}
/* Variables and functions */
int bloco(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, const char *argv[]) {
  int valor;
  printf("Informe N números:\n");
  scanf("%d", &valor);
  printf("\n\n%d\n\n", bloco(valor));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
lea    0xeac(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1060 <bloco@plt>
lea    0xe95(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Informe N n\C3\BAmeros:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [7 x i8] c"\0A\0A%d\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%9 = load i32, i32* %6
%10 = call i32 @bloco(i32 %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [7 x i8] c"\0A\0A%d\0A\0A\00"
@str = [20 x i8] c"Informe N n\C3\BAmeros:\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = call i32 @bloco(i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %8)
ret i32 0
}
/* Variables and functions */
char *date_now_hhmmss(int);
char *date_get_now_hhmmss(int utc_offset) {
  return date_now_hhmmss(utc_offset);
}


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

x86 assembly (clang, -O2):
<date_get_now_hhmmss>:
jmp    1030 <date_now_hhmmss@plt>

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

LLVM IR (-O2):
define i8* @date_get_now_hhmmss(i32 %0) {
%2 = tail call i8* @date_now_hhmmss(i32 %0)
ret i8* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ EOF;
scalar_t__ putc(unsigned int, int /*<<< orphan*/ *);
int writeint(FILE *fp, unsigned int l) {
  putc(l, fp);
  putc(l >> 8, fp);
  putc(l >> 16, fp);
  return putc(l >> 24, fp) != EOF;
}


x86 assembly (clang, -O0):
<writeint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1030 <putc@plt>
mov    -0xc(%rbp),%edi
shr    $0x8,%edi
mov    -0x8(%rbp),%rsi
call   1030 <putc@plt>
mov    -0xc(%rbp),%edi
shr    $0x10,%edi
mov    -0x8(%rbp),%rsi
call   1030 <putc@plt>
mov    -0xc(%rbp),%edi
shr    $0x18,%edi
mov    -0x8(%rbp),%rsi
call   1030 <putc@plt>
mov    0x2e89(%rip),%rcx
cmp    (%rcx),%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeint>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
mov    %esi,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
mov    %ebx,%edi
shr    $0x8,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
mov    %ebx,%edi
shr    $0x10,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
shr    $0x18,%ebx
mov    %ebx,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
mov    0x2e97(%rip),%rdx
xor    %ecx,%ecx
cmp    (%rdx),%rax
setne  %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EOF = global i64 0
define i32 @writeint(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 = call i64 @putc(i32 %5, i32* %6)
%8 = load i32, i32* %4
%9 = lshr i32 %8, 8
%10 = load i32*, i32** %3
%11 = call i64 @putc(i32 %9, i32* %10)
%12 = load i32, i32* %4
%13 = lshr i32 %12, 16
%14 = load i32*, i32** %3
%15 = call i64 @putc(i32 %13, i32* %14)
%16 = load i32, i32* %4
%17 = lshr i32 %16, 24
%18 = load i32*, i32** %3
%19 = call i64 @putc(i32 %17, i32* %18)
%20 = load i64, i64* @EOF
%21 = icmp ne i64 %19, %20
%22 = zext i1 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
@EOF = global i64 0
define i32 @writeint(i32* nocapture %0, i32 %1) {
%3 = tail call i64 @putc(i32 %1, i32* %0)
%4 = lshr i32 %1, 8
%5 = tail call i64 @putc(i32 %4, i32* %0)
%6 = lshr i32 %1, 16
%7 = tail call i64 @putc(i32 %6, i32* %0)
%8 = lshr i32 %1, 24
%9 = tail call i64 @putc(i32 %8, i32* %0)
%10 = load i64, i64* @EOF
%11 = icmp ne i64 %9, %10
%12 = zext i1 %11 to i32
ret i32 %12
}
unsigned int f34(unsigned int x, long int y) {
  return (x >> y) | (x << (8 * 4 - y));
}


x86 assembly (clang, -O0):
<f34>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x10(%rbp),%rcx
shr    %cl,%eax
mov    -0x4(%rbp),%edx
mov    $0x20,%ecx
sub    -0x10(%rbp),%rcx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f34>:
mov    %rsi,%rcx
mov    %edi,%eax
ror    %cl,%eax
ret

LLVM IR (-O0):
define i32 @f34(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
store i32 %0, i32* %3
store i64 %1, i64* %4
%5 = load i32, i32* %3
%6 = load i64, i64* %4
%7 = trunc i64 %6 to i32
%8 = lshr i32 %5, %7
%9 = load i32, i32* %3
%10 = load i64, i64* %4
%11 = sub nsw i64 32, %10
%12 = trunc i64 %11 to i32
%13 = shl i32 %9, %12
%14 = or i32 %8, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @f34(i32 %0, i64 %1) {
%3 = trunc i64 %1 to i32
%4 = lshr i32 %0, %3
%5 = sub i32 32, %3
%6 = shl i32 %0, %5
%7 = or i32 %6, %4
ret i32 %7
}
/* Variables and functions */
bool nrf_drv_usbd_errata_166(void) { return true; }


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

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

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

LLVM IR (-O2):
define i32 @nrf_drv_usbd_errata_166() {
ret i32 1
}
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
struct TYPE_3__ {
  int /*<<< orphan*/ r_info;
};
typedef TYPE_1__ Elf32_Rel;

/* Variables and functions */
int /*<<< orphan*/ ELF32_R_SYM(int /*<<< orphan*/);
int /*<<< orphan*/ w(int /*<<< orphan*/);
uint32_t fn_ELF32_R_SYM(Elf32_Rel const *rp) {
  return ELF32_R_SYM(w(rp->r_info));
}


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

x86 assembly (clang, -O2):
<fn_ELF32_R_SYM>:
push   %rax
mov    (%rdi),%edi
call   1040 <w@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <ELF32_R_SYM@plt>

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32 }
define i32 @fn_ELF32_R_SYM(%struct.TYPE_3__* %0) {
%2 = alloca %struct.TYPE_3__*
store %struct.TYPE_3__* %0, %struct.TYPE_3__** %2
%3 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%4 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 0
%5 = load i32, i32* %4
%6 = call i32 @w(i32 %5)
%7 = call i32 @ELF32_R_SYM(i32 %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32 }
define i32 @fn_ELF32_R_SYM(%struct.TYPE_3__* nocapture %0) {
%2 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = tail call i32 @w(i32 %3)
%5 = tail call i32 @ELF32_R_SYM(i32 %4)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ __quick_sort(int *, int /*<<< orphan*/, int);
void quick_sort(int *arr, int size) { __quick_sort(arr, 0, size - 1); }


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

x86 assembly (clang, -O2):
<quick_sort>:
lea    -0x1(%rsi),%edx
xor    %esi,%esi
jmp    1030 <__quick_sort@plt>

LLVM IR (-O0):
define void @quick_sort(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %4
%7 = sub nsw i32 %6, 1
%8 = call i32 @__quick_sort(i32* %5, i32 0, i32 %7)
ret void
}

LLVM IR (-O2):
define void @quick_sort(i32* %0, i32 %1) {
%3 = add nsw i32 %1, -1
%4 = tail call i32 @__quick_sort(i32* %0, i32 0, i32 %3)
ret void
}
int test_imm_53int64_midword_reg(long long val) {
  return ((val >> 16) & (0x53 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_53int64_midword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
sar    $0x10,%rdx
and    $0x53,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_53int64_midword_reg>:
test   $0x530000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_53int64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 16
%5 = and i64 %4, 83
%6 = icmp ne i64 %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_53int64_midword_reg(i64 %0) {
%2 = and i64 %0, 5439488
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int SecMain();
int /*<<< orphan*/ printf(char *, int);
int main() {
  int ReturnValue;
  ReturnValue = SecMain();
  printf("ReturnValue = 0x%x\n", ReturnValue);
  return ReturnValue;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <SecMain@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <SecMain@plt>
mov    %eax,%ebx
lea    0xecf(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [20 x i8] c"ReturnValue = 0x%x\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @SecMain()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 %1
}
/* Variables and functions */
scalar_t__ strcmp(char const *, char *);
int isFDIV(const char *comm) { return strcmp(comm, "fdiv") == 0; }


x86 assembly (clang, -O0):
<isFDIV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isFDIV>:
push   %rax
lea    0xee8(%rip),%rsi
call   1030 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"fdiv\00"
define i32 @isFDIV(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
@.str = [5 x i8] c"fdiv\00"
define i32 @isFDIV(i8* %0) {
%2 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
void yystart(void) {}


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

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

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

LLVM IR (-O2):
define void @yystart() {
ret void
}
cmd_unaction(arg) char *arg;
{ remove_robot_action(arg); }


x86 assembly (clang, -O0):
<cmd_unaction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <remove_robot_action@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @cmd_unaction(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @remove_robot_action to i32 (i8*, ...)*)(i8* %4)
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
define i32 @cmd_unaction(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @remove_robot_action to i32 (i8*, ...)*)(i8* %0)
ret i32 undef
}
unsigned rec_allocation_lc(unsigned lc) {
  if (lc == 0)
    return (0);
  else
    return (((lc - 1) / 8 + 1) * 8);
}


x86 assembly (clang, -O0):
<rec_allocation_lc>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    111d <rec_allocation_lc+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    112f <rec_allocation_lc+0x2f>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
shr    $0x3,%eax
add    $0x1,%eax
shl    $0x3,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rec_allocation_lc>:
lea    0x7(%rdi),%eax
and    $0xfffffff8,%eax
test   %edi,%edi
cmove  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @rec_allocation_lc(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = add i32 %0, 7
%4 = and i32 %3, -8
%5 = select i1 %2, i32 0, i32 %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ assert(double *);
void xt_core_note_maximum_double(double *maximum, double candidate) {
  assert(maximum);
  if (candidate > *maximum) {
    *maximum = candidate;
  }
}


x86 assembly (clang, -O0):
<xt_core_note_maximum_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <assert@plt>
movsd  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    114a <xt_core_note_maximum_double+0x3a>
movsd  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xt_core_note_maximum_double>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,0x8(%rsp)
mov    %rdi,%rbx
call   1030 <assert@plt>
movsd  0x8(%rsp),%xmm0
ucomisd (%rbx),%xmm0
jbe    1133 <xt_core_note_maximum_double+0x23>
movsd  %xmm0,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @xt_core_note_maximum_double(double* %0, double %1) {
%3 = alloca double*
%4 = alloca double
store double* %0, double** %3
store double %1, double* %4
%5 = load double*, double** %3
%6 = call i32 @assert(double* %5)
%7 = load double, double* %4
%8 = load double*, double** %3
%9 = load double, double* %8
%10 = fcmp ogt double %7, %9
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = load double, double* %4
%13 = load double*, double** %3
store double %12, double* %13
br label %14
14: ; preds = %11, %2
ret void
}

LLVM IR (-O2):
define void @xt_core_note_maximum_double(double* %0, double %1) {
%3 = tail call i32 @assert(double* %0)
%4 = load double, double* %0
%5 = fcmp olt double %4, %1
br i1 %5, label %6, label %7
6: ; preds = %2
store double %1, double* %0
br label %7
7: ; preds = %6, %2
ret void
}
int foo(int len, char arr[][len], int X) { return arr[X][0]; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%edx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   %rdx,%rcx
movsbl (%rax,%rcx,1),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    %edi,%eax
movslq %edx,%rcx
imul   %rax,%rcx
movsbl (%rsi,%rcx,1),%eax
ret

LLVM IR (-O0):
define i32 @foo(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
%7 = load i32, i32* %4
%8 = zext i32 %7 to i64
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = sext i32 %10 to i64
%12 = mul nsw i64 %11, %8
%13 = getelementptr inbounds i8, i8* %9, i64 %12
%14 = getelementptr inbounds i8, i8* %13, i64 0
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @foo(i32 %0, i8* nocapture %1, i32 %2) {
%4 = zext i32 %0 to i64
%5 = sext i32 %2 to i64
%6 = mul nsw i64 %5, %4
%7 = getelementptr inbounds i8, i8* %1, i64 %6
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
ret i32 %9
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t vchartoi(char c) {
  switch (c) {
  case 'A':
    return 0;
  case 'B':
    return 1;
  case 'C':
    return 2;
  case 'D':
    return 3;
  case 'E':
    return 4;
  case 'F':
    return 5;
  case 'G':
    return 6;
  case 'H':
    return 7;
  case 'I':
    return 8;
  case 'J':
    return 9;
  default:
    return 255;
  }
}


x86 assembly (clang, -O0):
<vchartoi>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x9,%eax
ja     11ac <vchartoi+0xac>
mov    -0x10(%rbp),%rax
lea    0xed5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x0,-0x4(%rbp)
jmp    11b3 <vchartoi+0xb3>
movl   $0x1,-0x4(%rbp)
jmp    11b3 <vchartoi+0xb3>
movl   $0x2,-0x4(%rbp)
jmp    11b3 <vchartoi+0xb3>
movl   $0x3,-0x4(%rbp)
jmp    11b3 <vchartoi+0xb3>
movl   $0x4,-0x4(%rbp)
jmp    11b3 <vchartoi+0xb3>
movl   $0x5,-0x4(%rbp)
jmp    11b3 <vchartoi+0xb3>
movl   $0x6,-0x4(%rbp)
jmp    11b3 <vchartoi+0xb3>
movl   $0x7,-0x4(%rbp)
jmp    11b3 <vchartoi+0xb3>
movl   $0x8,-0x4(%rbp)
jmp    11b3 <vchartoi+0xb3>
movl   $0x9,-0x4(%rbp)
jmp    11b3 <vchartoi+0xb3>
movl   $0xff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<vchartoi>:
lea    -0x41(%rdi),%ecx
cmp    $0xa,%ecx
mov    $0xff,%eax
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @vchartoi(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %16 [
i32 65, label %6
i32 66, label %7
i32 67, label %8
i32 68, label %9
i32 69, label %10
i32 70, label %11
i32 71, label %12
i32 72, label %13
i32 73, label %14
i32 74, label %15
]
6: ; preds = %1
store i32 0, i32* %2
br label %17
7: ; preds = %1
store i32 1, i32* %2
br label %17
8: ; preds = %1
store i32 2, i32* %2
br label %17
9: ; preds = %1
store i32 3, i32* %2
br label %17
10: ; preds = %1
store i32 4, i32* %2
br label %17
11: ; preds = %1
store i32 5, i32* %2
br label %17
12: ; preds = %1
store i32 6, i32* %2
br label %17
13: ; preds = %1
store i32 7, i32* %2
br label %17
14: ; preds = %1
store i32 8, i32* %2
br label %17
15: ; preds = %1
store i32 9, i32* %2
br label %17
16: ; preds = %1
store i32 255, i32* %2
br label %17
17: ; preds = %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @vchartoi(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, -65
%4 = icmp ult i32 %3, 10
%5 = select i1 %4, i32 %3, i32 255
ret i32 %5
}