xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int Existe(char *nombreFichero) {
  FILE *pf = NULL;
  int exis = 0;
  if ((pf = fopen(nombreFichero, "r")) != NULL) {
    exis = 1;
    fclose(pf);
  }
  return exis;
}


x86 assembly (clang, -O0):
<Existe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeba(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1169 <Existe+0x49>
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Existe>:
push   %rax
lea    0xed8(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     1141 <Existe+0x21>
mov    %rax,%rdi
call   1030 <fclose@plt>
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
define i32 @Existe(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32
store i8* %0, i8** %2
store i32* null, i32** %3
store i32 0, i32* %4
%5 = load i8*, i8** %2
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %6, i32** %3
%7 = icmp ne i32* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
store i32 1, i32* %4
%9 = load i32*, i32** %3
%10 = call i32 @fclose(i32* %9)
br label %11
11: ; preds = %8, %1
%12 = load i32, i32* %4
ret i32 %12
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i32 @Existe(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @fclose(i32* %2)
br label %6
6: ; preds = %4, %1
%7 = phi i32 [ 1, %4 ], [ 0, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ xfree(void *);
void ozi_free_fsdata(void *fsdata) { xfree(fsdata); }


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

x86 assembly (clang, -O2):
<ozi_free_fsdata>:
jmp    1030 <xfree@plt>

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

LLVM IR (-O2):
define void @ozi_free_fsdata(i8* %0) {
%2 = tail call i32 @xfree(i8* %0)
ret void
}
/* Variables and functions */
scalar_t__ IsMPEG2StartCode(unsigned char *, int);
int /*<<< orphan*/ printf(char *);
int CheckProprietaryStream(const char *pData, int Size) {
  if (Size < 4) {
    printf("Too few data to detecte private audio stream type");
    return 0;
  }
  if (IsMPEG2StartCode((unsigned char *)pData, 0x74980312)) {
    return 0xf1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<CheckProprietaryStream>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    1151 <CheckProprietaryStream+0x31>
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    117c <CheckProprietaryStream+0x5c>
mov    -0x10(%rbp),%rdi
mov    $0x74980312,%esi
call   1040 <IsMPEG2StartCode@plt>
cmp    $0x0,%rax
je     1175 <CheckProprietaryStream+0x55>
movl   $0xf1,-0x4(%rbp)
jmp    117c <CheckProprietaryStream+0x5c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CheckProprietaryStream>:
push   %rax
cmp    $0x3,%esi
jg     1136 <CheckProprietaryStream+0x16>
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    $0x74980312,%esi
call   1040 <IsMPEG2StartCode@plt>
xor    %ecx,%ecx
test   %rax,%rax
mov    $0xf1,%eax
cmove  %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [50 x i8] c"Too few data to detecte private audio stream type\00"
define i32 @CheckProprietaryStream(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 i32, i32* %5
%7 = icmp slt i32 %6, 4
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %16
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = call i64 @IsMPEG2StartCode(i8* %11, i32 1956119314)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %10
store i32 241, i32* %3
br label %16
15: ; preds = %10
store i32 0, i32* %3
br label %16
16: ; preds = %15, %14, %8
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@.str = [50 x i8] c"Too few data to detecte private audio stream type\00"
define i32 @CheckProprietaryStream(i8* %0, i32 %1) {
%3 = icmp slt i32 %1, 4
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
br label %10
6: ; preds = %2
%7 = tail call i64 @IsMPEG2StartCode(i8* %0, i32 1956119314)
%8 = icmp eq i64 %7, 0
%9 = select i1 %8, i32 0, i32 241
br label %10
10: ; preds = %6, %4
%11 = phi i32 [ 0, %4 ], [ %9, %6 ]
ret i32 %11
}
int leq2(int a1, int a2, int b1, int b2) {
  return a1 < b1 || a1 == b1 && a2 <= b2;
}


x86 assembly (clang, -O0):
<leq2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0x1,%al
cmp    -0xc(%rbp),%ecx
mov    %al,-0x11(%rbp)
jl     1144 <leq2+0x44>
mov    -0x4(%rbp),%ecx
xor    %eax,%eax
cmp    -0xc(%rbp),%ecx
mov    %al,-0x12(%rbp)
jne    113e <leq2+0x3e>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
setle  %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<leq2>:
cmp    %edx,%edi
setl   %al
sete   %dl
cmp    %ecx,%esi
setle  %cl
and    %dl,%cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @leq2(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %7
%11 = icmp slt i32 %9, %10
br i1 %11, label %22, label %12
12: ; preds = %4
%13 = load i32, i32* %5
%14 = load i32, i32* %7
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %20
16: ; preds = %12
%17 = load i32, i32* %6
%18 = load i32, i32* %8
%19 = icmp sle i32 %17, %18
br label %20
20: ; preds = %16, %12
%21 = phi i1 [ false, %12 ], [ %19, %16 ]
br label %22
22: ; preds = %20, %4
%23 = phi i1 [ true, %4 ], [ %21, %20 ]
%24 = zext i1 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
define i32 @leq2(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp slt i32 %0, %2
%6 = icmp eq i32 %0, %2
%7 = icmp sle i32 %1, %3
%8 = and i1 %6, %7
%9 = or i1 %5, %8
%10 = zext i1 %9 to i32
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ append_face(char *, int);
void append_move(char *p, int mv) {
  append_face(p, mv / 3);
  *p++ = "123"[mv % 3];
  *p = 0;
}


x86 assembly (clang, -O0):
<append_move>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
call   1030 <append_face@plt>
mov    -0xc(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
movslq %edx,%rcx
lea    0xeb6(%rip),%rax
mov    (%rax,%rcx,1),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<append_move>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
movslq %esi,%r15
imul   $0x55555556,%r15,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
shr    $0x20,%rbx
add    %eax,%ebx
mov    %ebx,%esi
call   1030 <append_face@plt>
lea    (%rbx,%rbx,2),%eax
sub    %eax,%r15d
movslq %r15d,%rax
lea    0xeba(%rip),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,(%r14)
movb   $0x0,0x1(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"123\00"
define void @append_move(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = sdiv i32 %6, 3
%8 = call i32 @append_face(i8* %5, i32 %7)
%9 = load i32, i32* %4
%10 = srem i32 %9, 3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [4 x i8], [4 x i8]* @.str, i64 0, i64 %11
%13 = load i8, i8* %12
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %3
store i8 %13, i8* %14
%16 = load i8*, i8** %3
store i8 0, i8* %16
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"123\00"
define void @append_move(i8* %0, i32 %1) {
%3 = sdiv i32 %1, 3
%4 = tail call i32 @append_face(i8* %0, i32 %3)
%5 = srem i32 %1, 3
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [4 x i8], [4 x i8]* @.str, i64 0, i64 %6
%8 = load i8, i8* %7
%9 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %8, i8* %0
store i8 0, i8* %9
ret void
}
/* Variables and functions */
int ArgNum();
scalar_t__ GetFlag(int);
int /*<<< orphan*/ SetFlag(int, scalar_t__);
void Act_Sub(void) {
  int a = ArgNum();
  SetFlag(a, GetFlag(a) - ArgNum());
}


x86 assembly (clang, -O0):
<Act_Sub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <ArgNum@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <GetFlag@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1050 <ArgNum@plt>
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%edi
cltq
sub    %rax,%rsi
call   1030 <SetFlag@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Act_Sub>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <ArgNum@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1040 <GetFlag@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1050 <ArgNum@plt>
cltq
sub    %rax,%rbx
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <SetFlag@plt>

LLVM IR (-O0):
define void @Act_Sub() {
%1 = alloca i32
%2 = call i32 (...) @ArgNum()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = load i32, i32* %1
%5 = call i64 @GetFlag(i32 %4)
%6 = call i32 (...) @ArgNum()
%7 = sext i32 %6 to i64
%8 = sub nsw i64 %5, %7
%9 = call i32 @SetFlag(i32 %3, i64 %8)
ret void
}

LLVM IR (-O2):
define void @Act_Sub() {
%1 = tail call i32 (...) @ArgNum()
%2 = tail call i64 @GetFlag(i32 %1)
%3 = tail call i32 (...) @ArgNum()
%4 = sext i32 %3 to i64
%5 = sub nsw i64 %2, %4
%6 = tail call i32 @SetFlag(i32 %1, i64 %5)
ret void
}
int test_08(int a, int b) { return (a < 0) == (b < 0) ? -20 : -40; }


x86 assembly (clang, -O0):
<test_08>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edx
cmpl   $0x0,-0x8(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%esi
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    %esi,%edx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_08>:
xor    %esi,%edi
mov    $0xffffffec,%ecx
mov    $0xffffffd8,%eax
cmovns %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_08(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 = icmp slt i32 %5, 0
%7 = zext i1 %6 to i32
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 0
%10 = zext i1 %9 to i32
%11 = icmp eq i32 %7, %10
%12 = zext i1 %11 to i64
%13 = select i1 %11, i32 -20, i32 -40
ret i32 %13
}

LLVM IR (-O2):
define i32 @test_08(i32 %0, i32 %1) {
%3 = xor i32 %1, %0
%4 = icmp sgt i32 %3, -1
%5 = select i1 %4, i32 -20, i32 -40
ret i32 %5
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ __uid_t;
struct TYPE_2__ {
  char *pw_shell;
};

/* Variables and functions */
TYPE_1__ *getpwuid(int /*<<< orphan*/);
char *get_pw_shell(__uid_t uid) { return getpwuid(uid)->pw_shell; }


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

x86 assembly (clang, -O2):
<get_pw_shell>:
push   %rax
call   1030 <getpwuid@plt>
mov    (%rax),%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i8* }
define i8* @get_pw_shell(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call %struct.TYPE_2__* @getpwuid(i32 %3)
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i8*, i8** %5
ret i8* %6
}

LLVM IR (-O2):
%struct.TYPE_2__ = type { i8* }
define i8* @get_pw_shell(i32 %0) {
%2 = tail call %struct.TYPE_2__* @getpwuid(i32 %0)
%3 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %2, i64 0, i32 0
%4 = load i8*, i8** %3
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
int strncmp(char const *, char const *, int /*<<< orphan*/);
int strlcmp(const char *str, const char *match) {
  return strncmp(str, match, strlen(match));
}


x86 assembly (clang, -O0):
<strlcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlcmp>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <strncmp@plt>

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

LLVM IR (-O2):
define i32 @strlcmp(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @strncmp(i8* %0, i8* %1, i32 %3)
ret i32 %4
}
void parse_or(void *arg, struct Source *src, struct Result *res) {}


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

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

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

LLVM IR (-O2):
%struct.Source = type opaque
%struct.Result = type opaque
define void @parse_or(i8* nocapture %0, %struct.Source* nocapture %1, %struct.Result* nocapture %2) {
ret void
}
void to_uns_char_store(__float128 a, unsigned char *p) {
  *p = (unsigned char)a;
}


x86 assembly (clang, -O0):
<to_uns_char_store>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movaps %xmm0,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
movaps -0x10(%rbp),%xmm0
call   1130 <__fixtfsi>
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
add    $0x20,%rsp
pop    %rbp
ret
nopw   0x0(%rax,%rax,1)

x86 assembly (clang, -O2):
<to_uns_char_store>:
push   %rbx
mov    %rdi,%rbx
call   1110 <__fixtfsi>
mov    %al,(%rbx)
pop    %rbx
ret
nopl   (%rax)

LLVM IR (-O0):
define void @to_uns_char_store(fp128 %0, i8* %1) {
%3 = alloca fp128
%4 = alloca i8*
store fp128 %0, fp128* %3
store i8* %1, i8** %4
%5 = load fp128, fp128* %3
%6 = fptoui fp128 %5 to i8
%7 = load i8*, i8** %4
store i8 %6, i8* %7
ret void
}

LLVM IR (-O2):
define void @to_uns_char_store(fp128 %0, i8* nocapture writeonly %1) {
%3 = fptoui fp128 %0 to i8
store i8 %3, i8* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int reverse(int);
int main() {
  printf("Reverse and interger %d : %d\n", -12345670, reverse(-1234567));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xffed2979,%edi
call   1030 <reverse@plt>
mov    %eax,%edx
lea    0xebe(%rip),%rdi
mov    $0xff439eba,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xffed2979,%edi
call   1030 <reverse@plt>
lea    0xece(%rip),%rdi
mov    $0xff439eba,%esi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Reverse and interger %d : %d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @reverse(i32 -1234567)
%3 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 -12345670, i32 %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [30 x i8] c"Reverse and interger %d : %d\0A\00"
define i32 @main() {
%1 = tail call i32 @reverse(i32 -1234567)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 -12345670, i32 %1)
ret i32 0
}
int isPrime(long long number) {
  unsigned long long j = 2;
  for (j = 2; j * j <= number; j++) {
    if (number % j == 0)
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<isPrime>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movq   $0x2,-0x18(%rbp)
movq   $0x2,-0x18(%rbp)
mov    -0x18(%rbp),%rax
imul   -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
ja     1163 <isPrime+0x63>
mov    -0x10(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x18(%rbp)
cmp    $0x0,%rdx
jne    114d <isPrime+0x4d>
movl   $0x0,-0x4(%rbp)
jmp    116a <isPrime+0x6a>
jmp    1152 <isPrime+0x52>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1118 <isPrime+0x18>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPrime>:
mov    $0x1,%ecx
cmp    $0x4,%rdi
jb     114b <isPrime+0x4b>
mov    $0x2,%esi
mov    %rdi,%rax
or     %rsi,%rax
shr    $0x20,%rax
je     1130 <isPrime+0x30>
mov    %rdi,%rax
xor    %edx,%edx
div    %rsi
test   %rdx,%rdx
jne    113b <isPrime+0x3b>
jmp    114e <isPrime+0x4e>
nopl   0x0(%rax,%rax,1)
mov    %edi,%eax
xor    %edx,%edx
div    %esi
test   %rdx,%rdx
je     114e <isPrime+0x4e>
add    $0x1,%rsi
mov    %rsi,%rax
imul   %rsi,%rax
cmp    %rdi,%rax
jbe    1110 <isPrime+0x10>
mov    %ecx,%eax
ret
xor    %ecx,%ecx
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @isPrime(i64 %0) {
%2 = icmp ult i64 %0, 4
br i1 %2, label %11, label %6
3: ; preds = %6
%4 = mul i64 %10, %10
%5 = icmp ugt i64 %4, %0
br i1 %5, label %11, label %6
6: ; preds = %1, %3
%7 = phi i64 [ %10, %3 ], [ 2, %1 ]
%8 = urem i64 %0, %7
%9 = icmp eq i64 %8, 0
%10 = add i64 %7, 1
br i1 %9, label %11, label %3
11: ; preds = %6, %3, %1
%12 = phi i32 [ 1, %1 ], [ 1, %3 ], [ 0, %6 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void printmenu() {
  printf("\nSelect an option [1-6]:\n"
         "1) Gift Shop Shipping\n"
         "2) Calorie Counter Application\n"
         "3) Roller Coaster Design\n"
         "4) Printing a Heart T-Shirt\n"
         "5) UCF Idol\n"
         "6) Quit\n"
         "> ");
}


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

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

LLVM IR (-O0):
@.str = [154 x i8] c"\0ASelect an option [1-6]:\0A1) Gift Shop Shipping\0A2) Calorie Counter Application\0A3) Roller Coaster Design\0A4) Printing a Heart T-Shirt\0A5) UCF Idol\0A6) Quit\0A> \00"
define void @printmenu() {
%1 = call i32 @printf(i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [154 x i8] c"\0ASelect an option [1-6]:\0A1) Gift Shop Shipping\0A2) Calorie Counter Application\0A3) Roller Coaster Design\0A4) Printing a Heart T-Shirt\0A5) UCF Idol\0A6) Quit\0A> \00"
define void @printmenu() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([154 x i8], [154 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ U_WMRNOTIMPLEMENTED_swap(char *, int);
void U_WMR8A_swap(char *record, int torev) {
  U_WMRNOTIMPLEMENTED_swap(record, torev);
}


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

x86 assembly (clang, -O2):
<U_WMR8A_swap>:
jmp    1030 <U_WMRNOTIMPLEMENTED_swap@plt>

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

LLVM IR (-O2):
define void @U_WMR8A_swap(i8* %0, i32 %1) {
%3 = tail call i32 @U_WMRNOTIMPLEMENTED_swap(i8* %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ screen_load();
int /*<<< orphan*/ screen_save();
int /*<<< orphan*/ show_file(char *, void *, int /*<<< orphan*/,
                             int /*<<< orphan*/);
void do_cmd_help(void) {
  screen_save();
  (void)show_file("help.hlp", ((void *)0), 0, 0);
  screen_load();
}


x86 assembly (clang, -O0):
<do_cmd_help>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <screen_save@plt>
lea    0xebe(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1040 <show_file@plt>
mov    $0x0,%al
call   1030 <screen_load@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_cmd_help>:
push   %rax
xor    %eax,%eax
call   1050 <screen_save@plt>
lea    0xec1(%rip),%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1040 <show_file@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <screen_load@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"help.hlp\00"
define void @do_cmd_help() {
%1 = call i32 (...) @screen_save()
%2 = call i32 @show_file(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* null, i32 0, i32 0)
%3 = call i32 (...) @screen_load()
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"help.hlp\00"
define void @do_cmd_help() {
%1 = tail call i32 (...) @screen_save()
%2 = tail call i32 @show_file(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* null, i32 0, i32 0)
%3 = tail call i32 (...) @screen_load()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ islower(int);
void t_islower_0x3c() {
  Assert_real((islower(60) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_islower.c",
              305, ("islower should be 0 for <"));
}


x86 assembly (clang, -O0):
<t_islower_0x3c>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3c,%edi
call   1030 <islower@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x131,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_islower_0x3c>:
push   %rax
mov    $0x3c,%edi
call   1030 <islower@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x131,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_islower.c\00"
@.str.1 = [26 x i8] c"islower should be 0 for <\00"
define void @t_islower_0x3c() {
%1 = call i64 @islower(i32 60)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 305, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_islower.c\00"
@.str.1 = [26 x i8] c"islower should be 0 for <\00"
define void @t_islower_0x3c() {
%1 = tail call i64 @islower(i32 60)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 305, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int fromHex(char);
void call_fromHex2_sym_Good_FP(char c) {
  char arr[17];
  int idx = fromHex(c);
  arr[idx + 1] = 'H';
}


x86 assembly (clang, -O0):
<call_fromHex2_sym_Good_FP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <fromHex@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
cltq
movb   $0x48,-0x20(%rbp,%rax,1)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_fromHex2_sym_Good_FP>:
jmp    1030 <fromHex@plt>

LLVM IR (-O0):
define void @call_fromHex2_sym_Good_FP(i8 signext %0) {
%2 = alloca i8
%3 = alloca [17 x i8]
%4 = alloca i32
store i8 %0, i8* %2
%5 = load i8, i8* %2
%6 = call i32 @fromHex(i8 signext %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = add nsw i32 %7, 1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 %9
store i8 72, i8* %10
ret void
}

LLVM IR (-O2):
define void @call_fromHex2_sym_Good_FP(i8 signext %0) {
%2 = tail call i32 @fromHex(i8 signext %0)
ret void
}
int clamp(int min, int val, int max) {
  if (val < min)
    return min;
  if (val > max)
    return max;
  return val;
}


x86 assembly (clang, -O0):
<clamp>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1124 <clamp+0x24>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <clamp+0x41>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    113b <clamp+0x3b>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <clamp+0x41>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clamp>:
mov    %edx,%eax
cmp    %edx,%esi
cmovle %esi,%eax
cmp    %edi,%esi
cmovl  %edi,%eax
ret

LLVM IR (-O0):
define i32 @clamp(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* %6
%9 = load i32, i32* %5
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = load i32, i32* %5
store i32 %12, i32* %4
br label %21
13: ; preds = %3
%14 = load i32, i32* %6
%15 = load i32, i32* %7
%16 = icmp sgt i32 %14, %15
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = load i32, i32* %7
store i32 %18, i32* %4
br label %21
19: ; preds = %13
%20 = load i32, i32* %6
store i32 %20, i32* %4
br label %21
21: ; preds = %19, %17, %11
%22 = load i32, i32* %4
ret i32 %22
}

LLVM IR (-O2):
define i32 @clamp(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %0
%5 = icmp sgt i32 %1, %2
%6 = select i1 %5, i32 %2, i32 %1
%7 = select i1 %4, i32 %0, i32 %6
ret i32 %7
}
/* Variables and functions */
unsigned int choice();
int /*<<< orphan*/ printf(char *);
unsigned int menu() {
  printf("\033[2J\033[1;1H"
         "Hear Ye, Hear Ye, The Ye Old Town Crier Service\n");
  printf("1) Cry Havok\n2) Set my name\n3) Cry my name\n4) Pwn\n\n0) "
         "Quit\n\nCHOICE: ");
  return choice();
}


x86 assembly (clang, -O0):
<menu>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0xf04(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <choice@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu>:
push   %rax
lea    0xf0d(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <choice@plt>

LLVM IR (-O0):
@.str = [59 x i8] c"\1B[2J\1B[1;1HHear Ye, Hear Ye, The Ye Old Town Crier Service\0A\00"
@.str.1 = [69 x i8] c"1) Cry Havok\0A2) Set my name\0A3) Cry my name\0A4) Pwn\0A\0A0) Quit\0A\0ACHOICE: \00"
define i32 @menu() {
%1 = call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 (...) @choice()
ret i32 %3
}

LLVM IR (-O2):
@.str.1 = [69 x i8] c"1) Cry Havok\0A2) Set my name\0A3) Cry my name\0A4) Pwn\0A\0A0) Quit\0A\0ACHOICE: \00"
@str = [58 x i8] c"\1B[2J\1B[1;1HHear Ye, Hear Ye, The Ye Old Town Crier Service\00"
define i32 @menu() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 (...) @choice()
ret i32 %3
}
void __cxa_pure_virtual(void) {
  while (1) {
    ;
  }
}


x86 assembly (clang, -O0):
<__cxa_pure_virtual>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <__cxa_pure_virtual+0x9>
jmp    1109 <__cxa_pure_virtual+0x9>

x86 assembly (clang, -O2):
<__cxa_pure_virtual>:
jmp    1100 <__cxa_pure_virtual>

LLVM IR (-O0):
define void @__cxa_pure_virtual() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @__cxa_pure_virtual() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void suma_resta2(int a, int b, int *s, int *r) {
  *s = a + b;
  *r = a - b;
  printf("suma=%d y resta=%d\n", *s, *r);
}


x86 assembly (clang, -O0):
<suma_resta2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%ecx
add    -0x8(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%ecx
sub    -0x8(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<suma_resta2>:
mov    %edi,%eax
lea    (%rsi,%rax,1),%edi
mov    %edi,(%rdx)
sub    %esi,%eax
mov    %eax,(%rcx)
mov    (%rdx),%esi
lea    0xedc(%rip),%rdi
mov    %eax,%edx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"suma=%d y resta=%d\0A\00"
define void @suma_resta2(i32 %0, i32 %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = add nsw i32 %9, %10
%12 = load i32*, i32** %7
store i32 %11, i32* %12
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = sub nsw i32 %13, %14
%16 = load i32*, i32** %8
store i32 %15, i32* %16
%17 = load i32*, i32** %7
%18 = load i32, i32* %17
%19 = load i32*, i32** %8
%20 = load i32, i32* %19
%21 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %18, i32 %20)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"suma=%d y resta=%d\0A\00"
define void @suma_resta2(i32 %0, i32 %1, i32* nocapture %2, i32* nocapture writeonly %3) {
%5 = add nsw i32 %1, %0
store i32 %5, i32* %2
%6 = sub nsw i32 %0, %1
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %6)
ret void
}
/* Type definitions */
typedef int pid_t;

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
pid_t waitpid(pid_t pid, int *stat_loc, int options) {
  errno = ENOSYS;
  return -1;
}


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

x86 assembly (clang, -O2):
<waitpid>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @waitpid(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* @ENOSYS
store i32 %7, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @waitpid(i32 %0, i32* nocapture readnone %1, i32 %2) {
%4 = load i32, i32* @ENOSYS
store i32 %4, i32* @errno
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void exit_with_error(char *msg) {
  fprintf(stderr, "%s\n", msg);
  exit(1);
}


x86 assembly (clang, -O0):
<exit_with_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<exit_with_error>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @exit_with_error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
int test_imm_D1uint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0xD1 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_D1uint64_lowword_mem>:
testb  $0xd1,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_D1uint64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 209
%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_D1uint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 209
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
char menu();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ przyklad();
int /*<<< orphan*/ wypisanie();
int main(void) {
  char wyb;
  wyb = menu();
  switch (wyb) {
  case 'w':
    wypisanie();
    break;
  case 'p':
    przyklad();
    break;
  case 'k':
    break;
  default:
    printf("Co ty wybrales?\n");
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
call   1050 <menu@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x6b,%eax
je     11a8 <main+0x68>
jmp    116e <main+0x2e>
mov    -0xc(%rbp),%eax
sub    $0x70,%eax
je     119c <main+0x5c>
jmp    117f <main+0x3f>
mov    -0xc(%rbp),%eax
sub    $0x77,%eax
jne    11ad <main+0x6d>
jmp    1190 <main+0x50>
mov    $0x0,%al
call   1040 <wypisanie@plt>
jmp    11b9 <main+0x79>
mov    $0x0,%al
call   1030 <przyklad@plt>
jmp    11b9 <main+0x79>
jmp    11b9 <main+0x79>
lea    0xe4c(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1060 <menu@plt>
movsbl %al,%eax
cmp    $0x6b,%eax
je     1178 <main+0x38>
cmp    $0x70,%eax
je     1163 <main+0x23>
cmp    $0x77,%eax
jne    116c <main+0x2c>
xor    %eax,%eax
call   1050 <wypisanie@plt>
jmp    1178 <main+0x38>
xor    %eax,%eax
call   1030 <przyklad@plt>
jmp    1178 <main+0x38>
lea    0xe8d(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Co ty wybrales?\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call signext i8 (...) @menu()
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
switch i32 %5, label %11 [
i32 119, label %6
i32 112, label %8
i32 107, label %10
]
6: ; preds = %0
%7 = call i32 (...) @wypisanie()
br label %13
8: ; preds = %0
%9 = call i32 (...) @przyklad()
br label %13
10: ; preds = %0
br label %13
11: ; preds = %0
%12 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %10, %8, %6
ret i32 0
}

LLVM IR (-O2):
@str = [16 x i8] c"Co ty wybrales?\00"
define i32 @main() {
%1 = tail call signext i8 (...) @menu()
%2 = sext i8 %1 to i32
switch i32 %2, label %7 [
i32 119, label %3
i32 112, label %5
i32 107, label %9
]
3: ; preds = %0
%4 = tail call i32 (...) @wypisanie()
br label %9
5: ; preds = %0
%6 = tail call i32 (...) @przyklad()
br label %9
7: ; preds = %0
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
br label %9
9: ; preds = %7, %0, %5, %3
ret i32 0
}
int btlza_ar3_ctxindex(int ctx, int mask) {
  int i;
  i = ((ctx >> 16) * 251) >> 8;
  return ((ctx ^ (i << 16)) & mask);
}


x86 assembly (clang, -O0):
<btlza_ar3_ctxindex>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x10,%eax
imul   $0xfb,%eax,%eax
sar    $0x8,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    $0x10,%ecx
xor    %ecx,%eax
and    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<btlza_ar3_ctxindex>:
mov    %edi,%eax
sar    $0x10,%eax
imul   $0xfb00,%eax,%eax
and    $0xffff0000,%eax
xor    %edi,%eax
and    %esi,%eax
ret

LLVM IR (-O0):
define i32 @btlza_ar3_ctxindex(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 = ashr i32 %6, 16
%8 = mul nsw i32 %7, 251
%9 = ashr i32 %8, 8
store i32 %9, i32* %5
%10 = load i32, i32* %3
%11 = load i32, i32* %5
%12 = shl i32 %11, 16
%13 = xor i32 %10, %12
%14 = load i32, i32* %4
%15 = and i32 %13, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @btlza_ar3_ctxindex(i32 %0, i32 %1) {
%3 = ashr i32 %0, 16
%4 = mul nsw i32 %3, 64256
%5 = and i32 %4, -65536
%6 = xor i32 %5, %0
%7 = and i32 %6, %1
ret i32 %7
}
int fun692() { return 692; }


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

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

LLVM IR (-O0):
define i32 @fun692() {
ret i32 692
}

LLVM IR (-O2):
define i32 @fun692() {
ret i32 692
}
/* Variables and functions */
int /*<<< orphan*/ somefunc(char *);
int /*<<< orphan*/ strcpy(char *, char *);
int testfunc() {
  char string2[80];
  strcpy(string2, "hello");
  somefunc(string2);
}


x86 assembly (clang, -O0):
<testfunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    -0x60(%rbp),%rdi
lea    0xecd(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x60(%rbp),%rdi
call   1040 <somefunc@plt>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testfunc>:
push   %rbx
sub    $0x50,%rsp
lea    0xed4(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <somefunc@plt>
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"hello\00"
define i32 @testfunc() {
%1 = alloca i32
%2 = alloca [80 x i8]
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%4 = call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%6 = call i32 @somefunc(i8* %5)
%7 = load i32, i32* %1
ret i32 %7
}

LLVM IR (-O2):
@.str = [6 x i8] c"hello\00"
define i32 @testfunc() {
%1 = alloca [80 x i8]
%2 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @somefunc(i8* %2)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ fexpect(char *, int, char, char);
void t13() {
  struct {
    char c;
  } v = {'a'};
  fexpect("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/struct.c",
          118, 'a', v.c);
  ;
}


x86 assembly (clang, -O0):
<t13>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xee2(%rip),%al
mov    %al,-0x8(%rbp)
lea    0xed9(%rip),%rdi
mov    $0x76,%esi
mov    $0x61,%edx
movsbl -0x8(%rbp),%ecx
call   1030 <fexpect@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t13>:
lea    0xee9(%rip),%rdi
mov    $0x76,%esi
mov    $0x61,%edx
mov    $0x61,%ecx
jmp    1030 <fexpect@plt>

LLVM IR (-O0):
%struct.anon = type { i8 }
@__const.t13.v = %struct.anon { i8 97 }
@.str = [129 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/struct.c\00"
define void @t13() {
%1 = alloca %struct.anon
%2 = bitcast %struct.anon* %1 to i8*
%3 = getelementptr inbounds %struct.anon, %struct.anon* %1, i32 0, i32 0
%4 = load i8, i8* %3
%5 = call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 118, i8 signext 97, i8 signext %4)
ret void
}

LLVM IR (-O2):
@.str = [129 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/struct.c\00"
define void @t13() {
%1 = tail call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 118, i8 signext 97, i8 signext 97)
ret void
}
unsigned int of_hweight32_naive(unsigned int w) {
  int j;
  unsigned int res = 0;
  unsigned int x = w;
  for (j = 0; j < sizeof(unsigned int); j++) {
    res += x & 1;
    x = x >> 1;
  }
  return res;
}


x86 assembly (clang, -O0):
<of_hweight32_naive>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
movslq -0x8(%rbp),%rax
cmp    $0x4,%rax
jae    114c <of_hweight32_naive+0x4c>
mov    -0x10(%rbp),%eax
and    $0x1,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    111b <of_hweight32_naive+0x1b>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<of_hweight32_naive>:
mov    %edi,%eax
and    $0x1,%eax
mov    %edi,%ecx
shr    %ecx
and    $0x1,%ecx
add    %eax,%ecx
mov    %edi,%eax
shr    $0x2,%eax
and    $0x1,%eax
add    %ecx,%eax
shr    $0x3,%edi
and    $0x1,%edi
add    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @of_hweight32_naive(i32 %0) {
%2 = and i32 %0, 1
%3 = lshr i32 %0, 1
%4 = and i32 %3, 1
%5 = add nuw nsw i32 %4, %2
%6 = lshr i32 %0, 2
%7 = and i32 %6, 1
%8 = add nuw nsw i32 %7, %5
%9 = lshr i32 %0, 3
%10 = and i32 %9, 1
%11 = add nuw nsw i32 %10, %8
ret i32 %11
}
void machine_to_virtual() {}


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

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

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

LLVM IR (-O2):
define void @machine_to_virtual() {
ret void
}
ISR(USART_UDRE_vect) {
  0 || (engine_panic_p(PSTR("UDRE")), 1);
  ;
}


x86 assembly (clang, -O0):
<ISR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <PSTR@plt>
mov    %eax,%edi
mov    $0x0,%al
call   1040 <engine_panic_p@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ISR>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <PSTR@plt>
mov    %eax,%edi
xor    %eax,%eax
pop    %rcx
jmp    1040 <engine_panic_p@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"UDRE\00"
define i32 @ISR(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @PSTR to i32 (i8*, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i32, ...) bitcast (i32 (...)* @engine_panic_p to i32 (i32, ...)*)(i32 %4)
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
@.str = [5 x i8] c"UDRE\00"
define i32 @ISR(i32 %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @PSTR to i32 (i8*, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @engine_panic_p to i32 (i32, ...)*)(i32 %2)
ret i32 undef
}
int accept(struct dirent *dir) { return 1; }


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

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

LLVM IR (-O0):
%struct.dirent = type opaque
define i32 @accept(%struct.dirent* %0) {
%2 = alloca %struct.dirent*
store %struct.dirent* %0, %struct.dirent** %2
ret i32 1
}

LLVM IR (-O2):
%struct.dirent = type opaque
define i32 @accept(%struct.dirent* nocapture readnone %0) {
ret i32 1
}
void FDL_Close(void) {}


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

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

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

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