xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, unsigned long, unsigned long);
void afficher_zone(void *adresse, size_t taille, int free) {
  printf("Zone %s, Adresse : %lx, Taille : %lu\n", free ? "libre" : "occupee",
         (unsigned long)adresse, (unsigned long)taille);
}


x86 assembly (clang, -O0):
<afficher_zone>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
lea    0xeff(%rip),%rsi
lea    0xef2(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<afficher_zone>:
mov    %rsi,%rcx
mov    %rdi,%rax
test   %edx,%edx
lea    0xf0d(%rip),%rdx
lea    0xf00(%rip),%rsi
cmove  %rdx,%rsi
lea    0xecf(%rip),%rdi
mov    %rax,%rdx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"Zone %s, Adresse : %lx, Taille : %lu\0A\00"
@.str.1 = [6 x i8] c"libre\00"
@.str.2 = [8 x i8] c"occupee\00"
define void @afficher_zone(i8* %0, i64 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
store i8* %0, i8** %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0)
%11 = load i8*, i8** %4
%12 = ptrtoint i8* %11 to i64
%13 = load i64, i64* %5
%14 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %10, i64 %12, i64 %13)
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c"Zone %s, Adresse : %lx, Taille : %lu\0A\00"
@.str.1 = [6 x i8] c"libre\00"
@.str.2 = [8 x i8] c"occupee\00"
define void @afficher_zone(i8* %0, i64 %1, i32 %2) {
%4 = icmp eq i32 %2, 0
%5 = select i1 %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0)
%6 = ptrtoint i8* %0 to i64
%7 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %5, i64 %6, i64 %1)
ret void
}
/* Variables and functions */
int ec_resume_status_long(long *);
int ec_resume_status(void) {
  long dummy;
  return ec_resume_status_long(&dummy);
}


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

x86 assembly (clang, -O2):
<ec_resume_status>:
push   %rax
mov    %rsp,%rdi
call   1030 <ec_resume_status_long@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @ec_resume_status() {
%1 = alloca i64
%2 = call i32 @ec_resume_status_long(i64* %1)
ret i32 %2
}

LLVM IR (-O2):
define i32 @ec_resume_status() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = call i32 @ec_resume_status_long(i64* %1)
ret i32 %3
}
/* Variables and functions */
int min2(int, int);
int min_val;
int min3(int a, int b, int c) {
  int min_val = min_val = min2(a, b);
  return min2(min_val, c);
}


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

x86 assembly (clang, -O2):
<min3>:
push   %rbx
mov    %edx,%ebx
call   1030 <min2@plt>
mov    %eax,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <min2@plt>

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

LLVM IR (-O2):
@min_val = global i32 0
define i32 @min3(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @min2(i32 %0, i32 %1)
%5 = tail call i32 @min2(i32 %4, i32 %2)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int i;
  for (i = 33; i <= 126; i++) {
    printf("ASCII code for %c is %d\n", i, i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x21,-0x8(%rbp)
cmpl   $0x7e,-0x8(%rbp)
jg     1150 <main+0x40>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x21,%ebx
lea    0xee0(%rip),%r14
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x7f,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [25 x i8] c"ASCII code for %c is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 33, i32* %2
br label %3
3: ; preds = %10, %0
%4 = load i32, i32* %2
%5 = icmp sle i32 %4, 126
br i1 %5, label %6, label %13
6: ; preds = %3
%7 = load i32, i32* %2
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8)
br label %10
10: ; preds = %6
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 1
store i32 %12, i32* %2
br label %3
13: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"ASCII code for %c is %d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 33, %0 ], [ %4, %1 ]
%3 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %2)
%4 = add nuw nsw i32 %2, 1
%5 = icmp eq i32 %4, 127
br i1 %5, label %6, label %1
6: ; preds = %1
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ rul___emit_decr_indent();
int /*<<< orphan*/ rul___emit_incr_indent();
int /*<<< orphan*/ rul___emit_newline();
int /*<<< orphan*/ rul___emit_string(char *);
int /*<<< orphan*/ rul___emit_verify_newline();
void rul__emit_else_condition(void) {
  rul___emit_verify_newline();
  rul___emit_decr_indent();
  rul___emit_string("} else {");
  rul___emit_incr_indent();
  rul___emit_newline();
}


x86 assembly (clang, -O0):
<rul__emit_else_condition>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <rul___emit_verify_newline@plt>
mov    $0x0,%al
call   1050 <rul___emit_decr_indent@plt>
lea    0xe97(%rip),%rdi
call   1030 <rul___emit_string@plt>
mov    $0x0,%al
call   1070 <rul___emit_incr_indent@plt>
mov    $0x0,%al
call   1060 <rul___emit_newline@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<rul__emit_else_condition>:
push   %rax
xor    %eax,%eax
call   1040 <rul___emit_verify_newline@plt>
xor    %eax,%eax
call   1050 <rul___emit_decr_indent@plt>
lea    0xe9a(%rip),%rdi
call   1030 <rul___emit_string@plt>
xor    %eax,%eax
call   1070 <rul___emit_incr_indent@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <rul___emit_newline@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"} else {\00"
define void @rul__emit_else_condition() {
%1 = call i32 (...) @rul___emit_verify_newline()
%2 = call i32 (...) @rul___emit_decr_indent()
%3 = call i32 @rul___emit_string(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @rul___emit_incr_indent()
%5 = call i32 (...) @rul___emit_newline()
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"} else {\00"
define void @rul__emit_else_condition() {
%1 = tail call i32 (...) @rul___emit_verify_newline()
%2 = tail call i32 (...) @rul___emit_decr_indent()
%3 = tail call i32 @rul___emit_string(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (...) @rul___emit_incr_indent()
%5 = tail call i32 (...) @rul___emit_newline()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
int xexec(char *path, char **argv) {
  printf("exec() not implemented\n");
  exit(-1);
}


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

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

LLVM IR (-O0):
@.str = [24 x i8] c"exec() not implemented\0A\00"
define i32 @xexec(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
store i8* %0, i8** %3
store i8** %1, i8*** %4
%5 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@str = [23 x i8] c"exec() not implemented\00"
define i32 @xexec(i8* nocapture readnone %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @exit(i32 -1)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ *opendir(char const *);
int plat_is_dir(const char *path) {
  DIR *dir;
  if ((dir = opendir(path))) {
    closedir(dir);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<plat_is_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <opendir@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1158 <plat_is_dir+0x38>
mov    -0x18(%rbp),%rdi
call   1040 <closedir@plt>
movl   $0x1,-0x4(%rbp)
jmp    115f <plat_is_dir+0x3f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<plat_is_dir>:
push   %rax
call   1030 <opendir@plt>
test   %rax,%rax
je     113a <plat_is_dir+0x1a>
mov    %rax,%rdi
call   1040 <closedir@plt>
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @plat_is_dir(i8* nocapture %0) {
%2 = tail call i32* @opendir(i8* %0)
%3 = icmp eq i32* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @closedir(i32* %2)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ 1, %4 ], [ 0, %1 ]
ret i32 %7
}
/* Type definitions */
struct VectorNumBase {
  int dummy;
};
struct KeywordExtractor {
  int dummy;
};

/* Variables and functions */
struct VectorNumBase *GetKeywordExtractorVectorNum(struct KeywordExtractor *,
                                                   char const *, size_t);
struct VectorNumBase *key_vector_num_result(struct KeywordExtractor *handle,
                                            const char *code, size_t topn) {
  return GetKeywordExtractorVectorNum(handle, code, topn);
}


x86 assembly (clang, -O0):
<key_vector_num_result>:
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 <GetKeywordExtractorVectorNum@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<key_vector_num_result>:
jmp    1030 <GetKeywordExtractorVectorNum@plt>

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

LLVM IR (-O2):
%struct.VectorNumBase = type { i32 }
%struct.KeywordExtractor = type { i32 }
define %struct.VectorNumBase* @key_vector_num_result(%struct.KeywordExtractor* %0, i8* %1, i64 %2) {
%4 = tail call %struct.VectorNumBase* @GetKeywordExtractorVectorNum(%struct.KeywordExtractor* %0, i8* %1, i64 %2)
ret %struct.VectorNumBase* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ off_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ ftello(int /*<<< orphan*/ *);
off_t octave_ftello_wrapper(FILE *fp) { return ftello(fp); }


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

x86 assembly (clang, -O2):
<octave_ftello_wrapper>:
jmp    1030 <ftello@plt>

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

LLVM IR (-O2):
define i32 @octave_ftello_wrapper(i32* nocapture %0) {
%2 = tail call i32 @ftello(i32* %0)
ret i32 %2
}
/* Type definitions */
typedef scalar_t__ uint64_t;

/* Variables and functions */
uint64_t mp_sqr_384(uint64_t c[12], uint64_t a[6]) {
  c[0] = a[1] + a[2];
  return 0;
}


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

x86 assembly (clang, -O2):
<mp_sqr_384>:
mov    0x10(%rsi),%rax
add    0x8(%rsi),%rax
mov    %rax,(%rdi)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i64 @mp_sqr_384(i64* %0, i64* %1) {
%3 = alloca i64*
%4 = alloca i64*
store i64* %0, i64** %3
store i64* %1, i64** %4
%5 = load i64*, i64** %4
%6 = getelementptr inbounds i64, i64* %5, i64 1
%7 = load i64, i64* %6
%8 = load i64*, i64** %4
%9 = getelementptr inbounds i64, i64* %8, i64 2
%10 = load i64, i64* %9
%11 = add nsw i64 %7, %10
%12 = load i64*, i64** %3
%13 = getelementptr inbounds i64, i64* %12, i64 0
store i64 %11, i64* %13
ret i64 0
}

LLVM IR (-O2):
define i64 @mp_sqr_384(i64* nocapture writeonly %0, i64* nocapture %1) {
%3 = getelementptr inbounds i64, i64* %1, i64 1
%4 = load i64, i64* %3
%5 = getelementptr inbounds i64, i64* %1, i64 2
%6 = load i64, i64* %5
%7 = add nsw i64 %6, %4
store i64 %7, i64* %0
ret i64 0
}
/* Variables and functions */
bool u_is_continuation_byte(unsigned char u) { return (u & 0xc0) == 0x80; }


x86 assembly (clang, -O0):
<u_is_continuation_byte>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0xc0,%eax
cmp    $0x80,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<u_is_continuation_byte>:
and    $0xc0,%dil
xor    %eax,%eax
cmp    $0x80,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @u_is_continuation_byte(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, 192
%6 = icmp eq i32 %5, 128
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @u_is_continuation_byte(i8 zeroext %0) {
%2 = and i8 %0, -64
%3 = icmp eq i8 %2, -128
%4 = zext i1 %3 to i32
ret i32 %4
}
unsigned int f3(unsigned int x, int y __attribute__((unused))) {
  return (x << 1) | (x >> ((-1) & (8 * 4 - 1)));
}


x86 assembly (clang, -O0):
<f3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    -0x4(%rbp),%ecx
shr    $0x1f,%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @f3(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 = shl i32 %5, 1
%7 = load i32, i32* %3
%8 = lshr i32 %7, 31
%9 = or i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @f3(i32 %0, i32 %1) {
%3 = tail call i32 @llvm.fshl.i32(i32 %0, i32 %0, i32 1)
ret i32 %3
}
int harmless(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @harmless() {
ret i32 0
}

LLVM IR (-O2):
define i32 @harmless() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ read(int /*<<< orphan*/, char *, int);
char socket_byte() {
  char c;
  read(0, &c, 1);
  return c;
}


x86 assembly (clang, -O0):
<socket_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
lea    -0x1(%rbp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<socket_byte>:
push   %rax
lea    0x7(%rsp),%rsi
xor    %edi,%edi
mov    $0x1,%edx
call   1030 <read@plt>
mov    0x7(%rsp),%al
pop    %rcx
ret

LLVM IR (-O0):
define signext i8 @socket_byte() {
%1 = alloca i8
%2 = call i32 @read(i32 0, i8* %1, i32 1)
%3 = load i8, i8* %1
ret i8 %3
}

LLVM IR (-O2):
define signext i8 @socket_byte() {
%1 = alloca i8
%2 = call i32 @read(i32 0, i8* %1, i32 1)
%3 = load i8, i8* %1
ret i8 %3
}
/* Variables and functions */
int /*<<< orphan*/ db(int);
void fsqrt() {
  db(0xD9);
  db(0xFA);
}


x86 assembly (clang, -O0):
<fsqrt>:
push   %rbp
mov    %rsp,%rbp
mov    $0xd9,%edi
call   1030 <db@plt>
mov    $0xfa,%edi
call   1030 <db@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fsqrt>:
push   %rax
mov    $0xd9,%edi
call   1030 <db@plt>
mov    $0xfa,%edi
pop    %rax
jmp    1030 <db@plt>

LLVM IR (-O0):
define void @fsqrt() {
%1 = call i32 @db(i32 217)
%2 = call i32 @db(i32 250)
ret void
}

LLVM IR (-O2):
define void @fsqrt() {
%1 = tail call i32 @db(i32 217)
%2 = tail call i32 @db(i32 250)
ret void
}
/* Variables and functions */
char *strcat(char *, char const *);
char *MCP_HAL_STRING_StrCat(char *strDest, const char *strSource) {
  return strcat(strDest, strSource);
}


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

x86 assembly (clang, -O2):
<MCP_HAL_STRING_StrCat>:
jmp    1030 <strcat@plt>

LLVM IR (-O0):
define i8* @MCP_HAL_STRING_StrCat(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 = call i8* @strcat(i8* %5, i8* %6)
ret i8* %7
}

LLVM IR (-O2):
define i8* @MCP_HAL_STRING_StrCat(i8* returned %0, i8* nocapture %1) {
%3 = tail call i8* @strcat(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i8* %0
}
int hell2() { return 2; }


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

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

LLVM IR (-O0):
define i32 @hell2() {
ret i32 2
}

LLVM IR (-O2):
define i32 @hell2() {
ret i32 2
}
int test_imm_84int16_mem(short *val) {
  return ((*val) & (-0x84 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_84int16_mem>:
movzwl (%rdi),%eax
test   $0xff7c,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_84int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -132
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int invalid_vm86_irq(int irq) { return irq < 3 || irq > 15; }


x86 assembly (clang, -O0):
<invalid_vm86_irq>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x3,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1120 <invalid_vm86_irq+0x20>
cmpl   $0xf,-0x4(%rbp)
setg   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<invalid_vm86_irq>:
add    $0xfffffff0,%edi
xor    %eax,%eax
cmp    $0xfffffff3,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @invalid_vm86_irq(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 3
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sgt i32 %6, 15
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ true, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @invalid_vm86_irq(i32 %0) {
%2 = add i32 %0, -16
%3 = icmp ult i32 %2, -13
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void biotool_log(int verbose, const char *msg) {
  if (verbose) {
    fprintf(stderr, "%s\n", msg);
  }
}


x86 assembly (clang, -O0):
<biotool_log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1142 <biotool_log+0x32>
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xec3(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<biotool_log>:
test   %edi,%edi
je     112c <biotool_log+0x1c>
mov    %rsi,%rdx
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
lea    0xed9(%rip),%rsi
jmp    1030 <fprintf@plt>
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @biotool_log(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 = icmp ne i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = load i8*, i8** %4
%10 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %11
11: ; preds = %7, %2
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @biotool_log(i32 %0, i8* %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %7
7: ; preds = %4, %2
ret void
}
int average(int a[3][4]) {
  int i;
  int j = 0;
  for (i = 0; i < 3; i++)
    j = j + a[i][3];
  return j / 3;
}


x86 assembly (clang, -O0):
<average>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    1146 <average+0x46>
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%rcx
movslq -0xc(%rbp),%rdx
shl    $0x4,%rdx
add    %rdx,%rcx
add    0xc(%rcx),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <average+0x16>
mov    -0x10(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<average>:
mov    0x1c(%rdi),%eax
add    0xc(%rdi),%eax
add    0x2c(%rdi),%eax
cltq
imul   $0x55555556,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @average([4 x i32]* nocapture %0) {
%2 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 0, i64 3
%3 = load i32, i32* %2
%4 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 1, i64 3
%5 = load i32, i32* %4
%6 = add nsw i32 %5, %3
%7 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 2, i64 3
%8 = load i32, i32* %7
%9 = add nsw i32 %8, %6
%10 = sdiv i32 %9, 3
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void bar() {
  printf("World\n");
  exit(0);
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<bar>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"World\0A\00"
define void @bar() {
%1 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [6 x i8] c"World\00"
define void @bar() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
int main() {
  int i = 123, j = 5, k = 1;
  while (i < 5) {
    while (j < 2) {
      while (k < 4) {
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x7b,-0x8(%rbp)
movl   $0x5,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1157 <main+0x57>
jmp    112f <main+0x2f>
cmpl   $0x2,-0xc(%rbp)
jge    1152 <main+0x52>
jmp    113e <main+0x3e>
cmpl   $0x4,-0x10(%rbp)
jge    114d <main+0x4d>
jmp    113e <main+0x3e>
jmp    112f <main+0x2f>
jmp    1120 <main+0x20>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 123, i32* %2
store i32 5, i32* %3
store i32 1, i32* %4
br label %5
5: ; preds = %18, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 5
br i1 %7, label %8, label %19
8: ; preds = %5
br label %9
9: ; preds = %17, %8
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 2
br i1 %11, label %12, label %18
12: ; preds = %9
br label %13
13: ; preds = %16, %12
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 4
br i1 %15, label %16, label %17
16: ; preds = %13
br label %13
17: ; preds = %13
br label %9
18: ; preds = %9
br label %5
19: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
typedef scalar_t__ loff_t;

/* Variables and functions */
scalar_t__ lseek64(int, scalar_t__, int /*<<< orphan*/);
int read(int, char *, int);
int valid_offset(int fd, loff_t offset) {
  char ch;
  loff_t res;
  res = lseek64(fd, offset, 0);
  if (res < 0)
    return 0;
  if (read(fd, &ch, 1) < 1)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<valid_offset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
xor    %edx,%edx
call   1040 <lseek64@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jge    1158 <valid_offset+0x38>
movl   $0x0,-0x4(%rbp)
jmp    1185 <valid_offset+0x65>
mov    -0x8(%rbp),%edi
lea    -0x11(%rbp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
cmp    $0x1,%eax
jge    117e <valid_offset+0x5e>
movl   $0x0,-0x4(%rbp)
jmp    1185 <valid_offset+0x65>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<valid_offset>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
xor    %ebx,%ebx
xor    %edx,%edx
call   1040 <lseek64@plt>
test   %rax,%rax
js     114b <valid_offset+0x2b>
lea    0x7(%rsp),%rsi
mov    %ebp,%edi
mov    $0x1,%edx
call   1030 <read@plt>
xor    %ebx,%ebx
test   %eax,%eax
setg   %bl
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @valid_offset(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
%6 = alloca i8
%7 = alloca i64
store i32 %0, i32* %4
store i64 %1, i64* %5
%8 = load i32, i32* %4
%9 = load i64, i64* %5
%10 = call i64 @lseek64(i32 %8, i64 %9, i32 0)
store i64 %10, i64* %7
%11 = load i64, i64* %7
%12 = icmp slt i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 0, i32* %3
br label %20
14: ; preds = %2
%15 = load i32, i32* %4
%16 = call i32 @read(i32 %15, i8* %6, i32 1)
%17 = icmp slt i32 %16, 1
br i1 %17, label %18, label %19
18: ; preds = %14
store i32 0, i32* %3
br label %20
19: ; preds = %14
store i32 1, i32* %3
br label %20
20: ; preds = %19, %18, %13
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
define i32 @valid_offset(i32 %0, i64 %1) {
%3 = alloca i8
%4 = tail call i64 @lseek64(i32 %0, i64 %1, i32 0)
%5 = icmp slt i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = call i32 @read(i32 %0, i8* %3, i32 1)
%8 = icmp sgt i32 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %2
%11 = phi i32 [ 0, %2 ], [ %9, %6 ]
ret i32 %11
}
/* Variables and functions */
int hideme(int);
int rand();
int main(int argc, char **argv) {
  int r = rand();
  int s = hideme(r);
  return (r <= s);
}


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)
mov    $0x0,%al
call   1040 <rand@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <hideme@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
setle  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <rand@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1030 <hideme@plt>
xor    %ecx,%ecx
cmp    %eax,%ebx
setle  %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 (...) @rand()
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = call i32 @hideme(i32 %9)
store i32 %10, i32* %7
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = icmp sle i32 %11, %12
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @rand()
%4 = tail call i32 @hideme(i32 %3)
%5 = icmp sle i32 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ send_event;
};
struct TYPE_4__ {
  TYPE_1__ xunmap;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
int get_XEvent_xunmap_send_event(void *_p) {
  return (int)((XEvent *)_p)->xunmap.send_event;
}


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

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

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

LLVM IR (-O2):
define i32 @get_XEvent_xunmap_send_event(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
int combine(int tens, int ones) { return tens * 10 + ones; }


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

x86 assembly (clang, -O2):
<combine>:
lea    (%rdi,%rdi,4),%eax
lea    (%rsi,%rax,2),%eax
ret

LLVM IR (-O0):
define i32 @combine(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 = mul nsw i32 %5, 10
%7 = load i32, i32* %4
%8 = add nsw i32 %6, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @combine(i32 %0, i32 %1) {
%3 = mul nsw i32 %0, 10
%4 = add nsw i32 %3, %1
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ SPI_IOC_WR_MAX_SPEED_HZ;
int ioctl(int, int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ pabort(char *);
void set_spi_speed(int fd, uint32_t speed) {
  int ret = ioctl(fd, SPI_IOC_WR_MAX_SPEED_HZ, &speed);
  if (ret < 0) {
    pabort("Cannot set speed");
  }
}


x86 assembly (clang, -O0):
<set_spi_speed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ea8(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rdx
call   1030 <ioctl@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    115c <set_spi_speed+0x3c>
lea    0xea9(%rip),%rdi
call   1040 <pabort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_spi_speed>:
push   %rax
mov    %esi,0x4(%rsp)
mov    0x2eb4(%rip),%rax
mov    (%rax),%esi
lea    0x4(%rsp),%rdx
call   1030 <ioctl@plt>
test   %eax,%eax
js     113e <set_spi_speed+0x1e>
pop    %rax
ret
lea    0xebb(%rip),%rdi
call   1040 <pabort@plt>
pop    %rax
ret

LLVM IR (-O0):
@SPI_IOC_WR_MAX_SPEED_HZ = global i32 0
@.str = [17 x i8] c"Cannot set speed\00"
define void @set_spi_speed(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 = load i32, i32* @SPI_IOC_WR_MAX_SPEED_HZ
%8 = call i32 @ioctl(i32 %6, i32 %7, i32* %4)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @pabort(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %2
ret void
}

LLVM IR (-O2):
@SPI_IOC_WR_MAX_SPEED_HZ = global i32 0
@.str = [17 x i8] c"Cannot set speed\00"
define void @set_spi_speed(i32 %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = load i32, i32* @SPI_IOC_WR_MAX_SPEED_HZ
%5 = call i32 @ioctl(i32 %0, i32 %4, i32* %3)
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = call i32 @pabort(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %2
ret void
}
/* Variables and functions */
size_t ocl_round_up(int group_size, int global_size) {
  int r = global_size % group_size;
  if (r == 0) {
    return global_size;
  } else {
    return global_size + group_size - r;
  }
}


x86 assembly (clang, -O0):
<ocl_round_up>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    112b <ocl_round_up+0x2b>
movslq -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    113a <ocl_round_up+0x3a>
mov    -0x10(%rbp),%eax
add    -0xc(%rbp),%eax
sub    -0x14(%rbp),%eax
cltq
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ocl_round_up>:
mov    %esi,%eax
cltd
idiv   %edi
add    %esi,%edi
sub    %edx,%edi
test   %edx,%edx
cmove  %esi,%edi
movslq %edi,%rax
ret

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

LLVM IR (-O2):
define i64 @ocl_round_up(i32 %0, i32 %1) {
%3 = srem i32 %1, %0
%4 = icmp eq i32 %3, 0
%5 = add nsw i32 %1, %0
%6 = sub i32 %5, %3
%7 = select i1 %4, i32 %1, i32 %6
%8 = sext i32 %7 to i64
ret i64 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ retire();
void storm_out(void) {
  printf("Hamurabi: I cannot do what you wish.\n");
  printf("Get yourself another steward!!!!!\n");
  retire();
}


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

x86 assembly (clang, -O2):
<storm_out>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xef1(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <retire@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"Hamurabi: I cannot do what you wish.\0A\00"
@.str.1 = [35 x i8] c"Get yourself another steward!!!!!\0A\00"
define void @storm_out() {
%1 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 (...) @retire()
ret void
}

LLVM IR (-O2):
@str = [37 x i8] c"Hamurabi: I cannot do what you wish.\00"
@str.2 = [34 x i8] c"Get yourself another steward!!!!!\00"
define void @storm_out() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.2, i64 0, i64 0))
%3 = tail call i32 (...) @retire()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isbdigit(int);
void t_isbdigit_0x4e() {
  Assert_real((isbdigit(78) == 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_isbdigit.c",
              395, ("isbdigit should be 0 for N"));
}


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

x86 assembly (clang, -O2):
<t_isbdigit_0x4e>:
push   %rax
mov    $0x4e,%edi
call   1040 <isbdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x18b,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 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_isbdigit.c\00"
@.str.1 = [27 x i8] c"isbdigit should be 0 for N\00"
define void @t_isbdigit_0x4e() {
%1 = call i64 @isbdigit(i32 78)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 395, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 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_isbdigit.c\00"
@.str.1 = [27 x i8] c"isbdigit should be 0 for N\00"
define void @t_isbdigit_0x4e() {
%1 = tail call i64 @isbdigit(i32 78)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 395, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int foo(int);
int main() {
  if (foo(0x40) != 0x3fc0)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x40,%edi
call   1040 <foo@plt>
cmp    $0x3fc0,%eax
je     114b <main+0x2b>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x40,%edi
call   1040 <foo@plt>
cmp    $0x3fc0,%eax
jne    1136 <main+0x16>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @foo(i32 64)
%3 = icmp ne i32 %2, 16320
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(i32 64)
%2 = icmp eq i32 %1, 16320
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Cvar_ForceSet(char *, char *);
int /*<<< orphan*/ StartGame();
void HardGameFunc(void *data) {
  Cvar_ForceSet("skill", "2");
  StartGame();
}


x86 assembly (clang, -O0):
<HardGameFunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
lea    0xecc(%rip),%rsi
call   1040 <Cvar_ForceSet@plt>
mov    $0x0,%al
call   1030 <StartGame@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HardGameFunc>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xed7(%rip),%rsi
call   1040 <Cvar_ForceSet@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <StartGame@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"skill\00"
@.str.1 = [2 x i8] c"2\00"
define void @HardGameFunc(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @Cvar_ForceSet(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 (...) @StartGame()
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"skill\00"
@.str.1 = [2 x i8] c"2\00"
define void @HardGameFunc(i8* nocapture readnone %0) {
%2 = tail call i32 @Cvar_ForceSet(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 (...) @StartGame()
ret void
}
void outsl(short port, void *buf, int size) {
  __asm__("rep outsl" ::"S"(buf), "d"(port), "c"(size));
}


x86 assembly (clang, -O0):
<outsl>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x2(%rbp),%dx
mov    -0x14(%rbp),%ecx
rep outsl %ds:(%rsi),(%dx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<outsl>:
mov    %edx,%ecx
mov    %edi,%edx
rep outsl %ds:(%rsi),(%dx)
ret

LLVM IR (-O0):
define void @outsl(i16 signext %0, i8* %1, i32 %2) {
%4 = alloca i16
%5 = alloca i8*
%6 = alloca i32
store i16 %0, i16* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %5
%8 = load i16, i16* %4
%9 = load i32, i32* %6
ret void
}

LLVM IR (-O2):
define void @outsl(i16 signext %0, i8* %1, i32 %2) {
tail call void asm sideeffect "rep outsl", "{si},{dx},{cx},~{dirflag},~{fpsr},~{flags}"(i8* %1, i16 %0, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ glutSolidCube(int);
void drawSolidCube(void) { glutSolidCube(1); }


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

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

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

LLVM IR (-O2):
define void @drawSolidCube() {
%1 = tail call i32 @glutSolidCube(i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ BlinkNoTimerTaskC__Boot__booted();
void RealMainP__Boot__booted(void) { BlinkNoTimerTaskC__Boot__booted(); }


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

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

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

LLVM IR (-O2):
define void @RealMainP__Boot__booted() {
%1 = tail call i32 (...) @BlinkNoTimerTaskC__Boot__booted()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int main(void) {
  printf("%c", "ACEGIK"[3] - 1);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x46,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [7 x i8] c"ACEGIK\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 3)
%3 = sext i8 %2 to i32
%4 = sub nsw i32 %3, 1
%5 = trunc i32 %4 to i8
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext 70)
ret i32 0
}
unsigned int test_18(int x) { return ~(x >> 31) & 0x0000FF00; }


x86 assembly (clang, -O0):
<test_18>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1f,%eax
xor    $0xffffffff,%eax
and    $0xff00,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_18>:
xor    %ecx,%ecx
test   %edi,%edi
mov    $0xff00,%eax
cmovs  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_18(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 31
%5 = xor i32 %4, -1
%6 = and i32 %5, 65280
ret i32 %6
}

LLVM IR (-O2):
define i32 @test_18(i32 %0) {
%2 = icmp slt i32 %0, 0
%3 = select i1 %2, i32 0, i32 65280
ret i32 %3
}
void init_double(void *p) {
  double *pd = (double *)p;
  pd[0] = 3.145;
  pd[1] = 42.0;
}


x86 assembly (clang, -O0):
<init_double>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  0xeec(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  0xed4(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_double>:
movaps 0xef9(%rip),%xmm0
movups %xmm0,(%rdi)
ret

LLVM IR (-O0):
define void @init_double(i8* %0) {
%2 = alloca i8*
%3 = alloca double*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to double*
store double* %5, double** %3
%6 = load double*, double** %3
%7 = getelementptr inbounds double, double* %6, i64 0
store double 3.145000e+00, double* %7
%8 = load double*, double** %3
%9 = getelementptr inbounds double, double* %8, i64 1
store double 4.200000e+01, double* %9
ret void
}

LLVM IR (-O2):
define void @init_double(i8* nocapture writeonly %0) {
%2 = bitcast i8* %0 to <2 x double>*
store <2 x double> <double 3.145000e+00, double 4.200000e+01>, <2 x double>* %2
ret void
}