xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int shmdt(void *);
void detach_from_shm_block(void *shmaddr) {
  if (NULL == shmaddr)
    return;
  if (shmdt(shmaddr) == -1) {
    perror("shmdt");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<detach_from_shm_block>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%rax
jne    114d <detach_from_shm_block+0x1d>
jmp    1175 <detach_from_shm_block+0x45>
mov    -0x8(%rbp),%rdi
call   1030 <shmdt@plt>
cmp    $0xffffffff,%eax
jne    1175 <detach_from_shm_block+0x45>
lea    0xe9a(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<detach_from_shm_block>:
push   %rax
test   %rdi,%rdi
je     1140 <detach_from_shm_block+0x10>
call   1030 <shmdt@plt>
cmp    $0xffffffff,%eax
je     1142 <detach_from_shm_block+0x12>
pop    %rax
ret
lea    0xeb7(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"shmdt\00"
define void @detach_from_shm_block(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = tail call i32 @shmdt(i8* %0)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %1, %3
ret void
}
__attribute__((noipa, optimize("Ofast"))) int f7(float x) {
  return __builtin_sqrtf(x) <= 0x1.4da1cp-19f;
}


x86 assembly (clang, -O0):
<f7>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <sqrtf@plt>
movaps %xmm0,%xmm1
movss  0xece(%rip),%xmm0
ucomiss %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f7>:
push   %rax
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     111f <f7+0xf>
sqrtss %xmm0,%xmm0
jmp    1124 <f7+0x14>
call   1030 <sqrtf@plt>
movss  0xed4(%rip),%xmm1
xor    %eax,%eax
ucomiss %xmm0,%xmm1
setae  %al
pop    %rcx
ret

LLVM IR (-O0):
define i32 @f7(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @sqrtf(float %3)
%5 = fcmp ole float %4, 0x3EC4DA1C00000000
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @f7(float %0) {
%2 = tail call float @sqrtf(float %0)
%3 = fcmp ole float %2, 0x3EC4DA1C00000000
%4 = zext i1 %3 to i32
ret i32 %4
}
int is_gpio_valid(int gpio) { return gpio >= 0 && gpio < 1000; }


x86 assembly (clang, -O0):
<is_gpio_valid>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1123 <is_gpio_valid+0x23>
cmpl   $0x3e8,-0x4(%rbp)
setl   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_gpio_valid>:
xor    %eax,%eax
cmp    $0x3e8,%edi
setb   %al
ret

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

LLVM IR (-O2):
define i32 @is_gpio_valid(i32 %0) {
%2 = icmp ult i32 %0, 1000
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ fmt_byte_hex(char *, int /*<<< orphan*/);
int /*<<< orphan*/ print(char *, int);
void print_byte_hex(uint8_t byte) {
  char buf[2];
  fmt_byte_hex(buf, byte);
  print(buf, sizeof(buf));
}


x86 assembly (clang, -O0):
<print_byte_hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x6(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1040 <fmt_byte_hex@plt>
lea    -0x6(%rbp),%rdi
mov    $0x2,%esi
call   1030 <print@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_byte_hex>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%esi
lea    0xe(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <fmt_byte_hex@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <print@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @print_byte_hex(i32 %0) {
%2 = alloca i32
%3 = alloca [2 x i8]
store i32 %0, i32* %2
%4 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* %2
%6 = call i32 @fmt_byte_hex(i8* %4, i32 %5)
%7 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%8 = call i32 @print(i8* %7, i32 2)
ret void
}

LLVM IR (-O2):
define void @print_byte_hex(i32 %0) {
%2 = alloca [2 x i8]
%3 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
%4 = call i32 @fmt_byte_hex(i8* %3, i32 %0)
%5 = call i32 @print(i8* %3, i32 2)
ret void
}
/* Variables and functions */
char *strchr(char *, char);
int __stripcomments(char *buf) {
  char *c;
  c = strchr(buf, '#');
  if (c != NULL)
    *c = '\0';
  return (c - buf + 1);
}


x86 assembly (clang, -O0):
<__stripcomments>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x23,%esi
call   1030 <strchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1140 <__stripcomments+0x30>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__stripcomments>:
push   %rbx
mov    %rdi,%rbx
mov    $0x23,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1126 <__stripcomments+0x16>
movb   $0x0,(%rax)
sub    %ebx,%eax
add    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @__stripcomments(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strchr(i8* %4, i8 signext 35)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load i8*, i8** %3
store i8 0, i8* %9
br label %10
10: ; preds = %8, %1
%11 = load i8*, i8** %3
%12 = load i8*, i8** %2
%13 = ptrtoint i8* %11 to i64
%14 = ptrtoint i8* %12 to i64
%15 = sub i64 %13, %14
%16 = add nsw i64 %15, 1
%17 = trunc i64 %16 to i32
ret i32 %17
}

LLVM IR (-O2):
define i32 @__stripcomments(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 35)
%3 = icmp eq i8* %2, null
br i1 %3, label %5, label %4
4: ; preds = %1
store i8 0, i8* %2
br label %5
5: ; preds = %4, %1
%6 = ptrtoint i8* %2 to i64
%7 = ptrtoint i8* %0 to i64
%8 = sub i64 %6, %7
%9 = trunc i64 %8 to i32
%10 = add i32 %9, 1
ret i32 %10
}
int fn6(int a, int b) {
  int tem1 = b | a;
  int tem2 = a & b;
  return tem1 + tem2;
}


x86 assembly (clang, -O0):
<fn6>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
or     -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn6>:
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @fn6(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = load i32, i32* %3
%9 = or i32 %7, %8
store i32 %9, i32* %5
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = and i32 %10, %11
store i32 %12, i32* %6
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = add nsw i32 %13, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @fn6(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ set_value(char const *, char const *, char const *,
                             char const *);
void set_string(const char *group, const char *name, const char *key,
                const char *value) {
  set_value(group, name, key, value);
}


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

x86 assembly (clang, -O2):
<set_string>:
jmp    1030 <set_value@plt>

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

LLVM IR (-O2):
define void @set_string(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call i32 @set_value(i8* %0, i8* %1, i8* %2, i8* %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gendep__register_rename(char const *, char const *);
int real_rename(char const *, char const *);
int __rename(const char *oldname, const char *newname) {
  gendep__register_rename(oldname, newname);
  return real_rename(oldname, newname);
}


x86 assembly (clang, -O0):
<__rename>:
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   1040 <gendep__register_rename@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <real_rename@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__rename>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <gendep__register_rename@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <real_rename@plt>

LLVM IR (-O0):
define i32 @__rename(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 i32 @gendep__register_rename(i8* %5, i8* %6)
%8 = load i8*, i8** %3
%9 = load i8*, i8** %4
%10 = call i32 @real_rename(i8* %8, i8* %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @__rename(i8* %0, i8* %1) {
%3 = tail call i32 @gendep__register_rename(i8* %0, i8* %1)
%4 = tail call i32 @real_rename(i8* %0, i8* %1)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void app_callback(void *ctx) { printf("Timeout\n"); }


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

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

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

LLVM IR (-O2):
@str = [8 x i8] c"Timeout\00"
define void @app_callback(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fwrite(unsigned char *, int, int, int /*<<< orphan*/ *);
int ephcom_outdouble(FILE *outfp, double x) {
  double retval;
  unsigned char ch[8];
  unsigned char *gnulliver64c(unsigned char *);
  void *memcpy(void *, const void *, size_t);
  memcpy((void *)ch, (const void *)&x, 8);
  (void)gnulliver64c(ch);
  fwrite(ch, 1, 8, outfp);
  return (0);
}


x86 assembly (clang, -O0):
<ephcom_outdouble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <gnulliver64c@plt>
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x1,%esi
mov    $0x8,%edx
call   1040 <fwrite@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ephcom_outdouble>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
movsd  %xmm0,(%rsp)
mov    %rsp,%r14
mov    %r14,%rdi
call   1030 <gnulliver64c@plt>
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x8,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @ephcom_outdouble(i32* %0, double %1) {
%3 = alloca i32*
%4 = alloca double
%5 = alloca double
%6 = alloca [8 x i8]
store i32* %0, i32** %3
store double %1, double* %4
%7 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
%8 = bitcast double* %4 to i8*
%9 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
%10 = call i8* @gnulliver64c(i8* %9)
%11 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
%12 = load i32*, i32** %3
%13 = call i32 @fwrite(i8* %11, i32 1, i32 8, i32* %12)
ret i32 0
}

LLVM IR (-O2):
define i32 @ephcom_outdouble(i32* nocapture %0, double %1) {
%3 = alloca double
%4 = bitcast double* %3 to i8*
store double %1, double* %3
%5 = call i8* @gnulliver64c(i8* %4)
%6 = call i32 @fwrite(i8* %4, i32 1, i32 8, i32* %0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ matNd_print(double const *, int);
void mat4d_print(const double m[16]) { matNd_print(m, 4); }


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

x86 assembly (clang, -O2):
<mat4d_print>:
mov    $0x4,%esi
jmp    1030 <matNd_print@plt>

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

LLVM IR (-O2):
define void @mat4d_print(double* %0) {
%2 = tail call i32 @matNd_print(double* %0, i32 4)
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ height_inc;
};
typedef TYPE_1__ XIconSize;

/* Variables and functions */
int get_XIconSize_height_inc(void *_p) {
  return (int)((XIconSize *)_p)->height_inc;
}


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

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

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

LLVM IR (-O2):
define i32 @get_XIconSize_height_inc(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
void adts_set_num_blocks(uint8_t *p_adts, uint8_t i_blocks) {
  p_adts[6] &= ~0x03;
  p_adts[6] |= i_blocks & 0x03;
}


x86 assembly (clang, -O0):
<adts_set_num_blocks>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%ecx
and    $0xfffffffc,%ecx
mov    %ecx,0x18(%rax)
mov    -0xc(%rbp),%ecx
and    $0x3,%ecx
mov    -0x8(%rbp),%rax
or     0x18(%rax),%ecx
mov    %ecx,0x18(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<adts_set_num_blocks>:
mov    0x18(%rdi),%eax
and    $0xfffffffc,%eax
and    $0x3,%esi
or     %eax,%esi
mov    %esi,0x18(%rdi)
ret

LLVM IR (-O0):
define void @adts_set_num_blocks(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 = getelementptr inbounds i32, i32* %5, i64 6
%7 = load i32, i32* %6
%8 = and i32 %7, -4
store i32 %8, i32* %6
%9 = load i32, i32* %4
%10 = and i32 %9, 3
%11 = load i32*, i32** %3
%12 = getelementptr inbounds i32, i32* %11, i64 6
%13 = load i32, i32* %12
%14 = or i32 %13, %10
store i32 %14, i32* %12
ret void
}

LLVM IR (-O2):
define void @adts_set_num_blocks(i32* nocapture %0, i32 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 6
%4 = load i32, i32* %3
%5 = and i32 %4, -4
%6 = and i32 %1, 3
%7 = or i32 %5, %6
store i32 %7, i32* %3
ret void
}
/* Type definitions */
struct stat {
  size_t st_size;
};

/* Variables and functions */
scalar_t__ stat(char const *, struct stat *);
size_t getFileSize(const char *filename) {
  struct stat st;
  if (stat(filename, &st) != 0) {
    return 0;
  }
  return st.st_size;
}


x86 assembly (clang, -O0):
<getFileSize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
je     1140 <getFileSize+0x30>
movq   $0x0,-0x8(%rbp)
jmp    1148 <getFileSize+0x38>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getFileSize>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
test   %rax,%rax
jne    1124 <getFileSize+0x14>
mov    (%rsp),%rax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i64 }
define i64 @getFileSize(i8* %0) {
%2 = alloca i64
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @stat(i8* %5, %struct.stat* %4)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i64 0, i64* %2
br label %12
9: ; preds = %1
%10 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%11 = load i64, i64* %10
store i64 %11, i64* %2
br label %12
12: ; preds = %9, %8
%13 = load i64, i64* %2
ret i64 %13
}

LLVM IR (-O2):
%struct.stat = type { i64 }
define i64 @getFileSize(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
%6 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%7 = load i64, i64* %6
%8 = select i1 %5, i64 %7, i64 0
ret i64 %8
}
void matrix_int_free(int **Matrix, const int dimension1) {
  int i;
  for (i = 0; i < dimension1; i++) {
    free(Matrix[i]);
  }
  free(Matrix);
}


x86 assembly (clang, -O0):
<matrix_int_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1151 <matrix_int_free+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <matrix_int_free+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matrix_int_free>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
jle    1142 <matrix_int_free+0x32>
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <matrix_int_free+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @matrix_int_free(i32** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32*, i32** %0, i64 %7
%9 = bitcast i32** %8 to i8**
%10 = load i8*, i8** %9
tail call void @free(i8* %10)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = bitcast i32** %0 to i8*
tail call void @free(i8* %14)
ret void
}
/* Variables and functions */
void *alloc_(size_t);
void *Alloc_(size_t size) { return alloc_(size); }


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

x86 assembly (clang, -O2):
<Alloc_>:
jmp    1030 <alloc_@plt>

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

LLVM IR (-O2):
define i8* @Alloc_(i64 %0) {
%2 = tail call i8* @alloc_(i64 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ gdi_error_c(int *, char *);
int /*<<< orphan*/ warning(char *);
myerror(char *fmt, int error_code) {
  char msg[128];
  gdi_error_c(&error_code, msg);
  warning(msg);
}


x86 assembly (clang, -O0):
<myerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
lea    -0xa0(%rbp),%rsi
lea    -0x14(%rbp),%rdi
call   1040 <gdi_error_c@plt>
lea    -0xa0(%rbp),%rdi
call   1030 <warning@plt>
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myerror>:
push   %rbx
sub    $0x90,%rsp
mov    %esi,0xc(%rsp)
lea    0xc(%rsp),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
call   1040 <gdi_error_c@plt>
mov    %rbx,%rdi
call   1030 <warning@plt>
add    $0x90,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @myerror(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca [128 x i8]
store i8* %0, i8** %4
store i32 %1, i32* %5
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%8 = call i32 @gdi_error_c(i32* %5, i8* %7)
%9 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%10 = call i32 @warning(i8* %9)
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
define i32 @myerror(i8* nocapture readnone %0, i32 %1) {
%3 = alloca i32
%4 = alloca [128 x i8]
store i32 %1, i32* %3
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%6 = call i32 @gdi_error_c(i32* %3, i8* %5)
%7 = call i32 @warning(i8* %5)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ dns_error(int /*<<< orphan*/, char *);
int mempool_create(int);
void init_mempool() {
  int ret;
  ret = mempool_create((65536));
  if (ret < 0)
    dns_error(0, "create mempool failed");
}


x86 assembly (clang, -O0):
<init_mempool>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x10000,%edi
call   1030 <mempool_create@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    114d <init_mempool+0x2d>
xor    %edi,%edi
lea    0xeb8(%rip),%rsi
call   1040 <dns_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_mempool>:
push   %rax
mov    $0x10000,%edi
call   1030 <mempool_create@plt>
test   %eax,%eax
js     1131 <init_mempool+0x11>
pop    %rax
ret
lea    0xec8(%rip),%rsi
xor    %edi,%edi
pop    %rax
jmp    1040 <dns_error@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"create mempool failed\00"
define void @init_mempool() {
%1 = alloca i32
%2 = call i32 @mempool_create(i32 65536)
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @dns_error(i32 0, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %0
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"create mempool failed\00"
define void @init_mempool() {
%1 = tail call i32 @mempool_create(i32 65536)
%2 = icmp slt i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @dns_error(i32 0, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
ret void
}
int _ipa_read_gen_reg_v1_1(char *buff, int max_len) { return 0; }


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

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

LLVM IR (-O0):
define i32 @_ipa_read_gen_reg_v1_1(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
ret i32 0
}

LLVM IR (-O2):
define i32 @_ipa_read_gen_reg_v1_1(i8* nocapture readnone %0, i32 %1) {
ret i32 0
}
void clearArray(unsigned char array[], int num) {
  int i = 0;
  while (i < num)
    array[i++] = 0;
}


x86 assembly (clang, -O0):
<clearArray>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1139 <clearArray+0x39>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x10(%rbp)
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1112 <clearArray+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clearArray>:
test   %esi,%esi
jle    1122 <clearArray+0x12>
push   %rax
mov    %esi,%edx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @clearArray(i8* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %2
ret void
}
/* Variables and functions */
char *calloc(int, int);
int length(char const *);
char *my_strcpy(const char *s1) {
  int j;
  int size = length(s1);
  char *tab;
  tab = calloc(size, sizeof(char));
  for (j = 0; size >= j; j++) {
    tab[j] = s1[j];
  }
  return tab;
}


x86 assembly (clang, -O0):
<my_strcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <length@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     1180 <my_strcpy+0x60>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1150 <my_strcpy+0x30>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_strcpy>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <length@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,%rbx
test   %ebp,%ebp
js     1162 <my_strcpy+0x32>
mov    %ebp,%edx
add    $0x1,%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define noalias i8* @my_strcpy(i8* %0) {
%2 = tail call i32 @length(i8* %0)
%3 = tail call i8* @calloc(i32 %2, i32 1)
%4 = icmp slt i32 %2, 0
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = zext i32 %2 to i64
%7 = add nuw nsw i64 %6, 1
br label %8
8: ; preds = %5, %1
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ cleanup_printout();
int /*<<< orphan*/ mc_printer_controller(int);
int /*<<< orphan*/ setup_printout(char const *, int /*<<< orphan*/, char *);
int /*<<< orphan*/ test_printout();
int tst_printer_controller(const char *the_title) {
  setup_printout(the_title, (0), "scrolling region");
  mc_printer_controller((1));
  test_printout();
  mc_printer_controller((0));
  cleanup_printout();
  return 1;
}


x86 assembly (clang, -O0):
<tst_printer_controller>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
lea    0xea7(%rip),%rdx
call   1030 <setup_printout@plt>
mov    $0x1,%edi
call   1040 <mc_printer_controller@plt>
mov    $0x0,%al
call   1060 <test_printout@plt>
xor    %edi,%edi
call   1040 <mc_printer_controller@plt>
mov    $0x0,%al
call   1050 <cleanup_printout@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tst_printer_controller>:
push   %rax
lea    0xeb8(%rip),%rdx
xor    %esi,%esi
call   1030 <setup_printout@plt>
mov    $0x1,%edi
call   1040 <mc_printer_controller@plt>
xor    %eax,%eax
call   1060 <test_printout@plt>
xor    %edi,%edi
call   1040 <mc_printer_controller@plt>
xor    %eax,%eax
call   1050 <cleanup_printout@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"scrolling region\00"
define i32 @tst_printer_controller(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @setup_printout(i8* %3, i32 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @mc_printer_controller(i32 1)
%6 = call i32 (...) @test_printout()
%7 = call i32 @mc_printer_controller(i32 0)
%8 = call i32 (...) @cleanup_printout()
ret i32 1
}

LLVM IR (-O2):
@.str = [17 x i8] c"scrolling region\00"
define i32 @tst_printer_controller(i8* %0) {
%2 = tail call i32 @setup_printout(i8* %0, i32 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @mc_printer_controller(i32 1)
%4 = tail call i32 (...) @test_printout()
%5 = tail call i32 @mc_printer_controller(i32 0)
%6 = tail call i32 (...) @cleanup_printout()
ret i32 1
}
int main(void) {
  int i = 0;
  i += 10;
  i -= 9;
  i *= 1000;
  i /= 1;
  i %= 100;
  i <<= 1;
  i >>= 1;
  i &= 1000;
  i |= 10000;
  i ^= 0;
  return i;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x9,%eax
mov    %eax,-0x8(%rbp)
imul   $0x3e8,-0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x1,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x3e8,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
or     $0x2710,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
xor    $0x0,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 10
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = sub nsw i32 %5, 9
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = mul nsw i32 %7, 1000
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = sdiv i32 %9, 1
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = srem i32 %11, 100
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = shl i32 %13, 1
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = ashr i32 %15, 1
store i32 %16, i32* %2
%17 = load i32, i32* %2
%18 = and i32 %17, 1000
store i32 %18, i32* %2
%19 = load i32, i32* %2
%20 = or i32 %19, 10000
store i32 %20, i32* %2
%21 = load i32, i32* %2
%22 = xor i32 %21, 0
store i32 %22, i32* %2
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
define i32 @main() {
ret i32 10000
}
/* Type definitions */
struct func_hook {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ do_hook(struct func_hook *, int);
void rehook(struct func_hook *hook) { do_hook(hook, false); }


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

x86 assembly (clang, -O2):
<rehook>:
xor    %esi,%esi
jmp    1030 <do_hook@plt>

LLVM IR (-O0):
%struct.func_hook = type { i32 }
define void @rehook(%struct.func_hook* %0) {
%2 = alloca %struct.func_hook*
store %struct.func_hook* %0, %struct.func_hook** %2
%3 = load %struct.func_hook*, %struct.func_hook** %2
%4 = call i32 @do_hook(%struct.func_hook* %3, i32 0)
ret void
}

LLVM IR (-O2):
%struct.func_hook = type { i32 }
define void @rehook(%struct.func_hook* %0) {
%2 = tail call i32 @do_hook(%struct.func_hook* %0, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isalnum(int);
void t_isalnum_0xf6() {
  Assert_real((isalnum(246) == 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_isalnum.c",
              1235, ("isalnum should be 0 for 0xf6"));
}


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

x86 assembly (clang, -O2):
<t_isalnum_0xf6>:
push   %rax
mov    $0xf6,%edi
call   1030 <isalnum@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x4d3,%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_isalnum.c\00"
@.str.1 = [29 x i8] c"isalnum should be 0 for 0xf6\00"
define void @t_isalnum_0xf6() {
%1 = call i64 @isalnum(i32 246)
%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 1235, i8* getelementptr inbounds ([29 x i8], [29 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_isalnum.c\00"
@.str.1 = [29 x i8] c"isalnum should be 0 for 0xf6\00"
define void @t_isalnum_0xf6() {
%1 = tail call i64 @isalnum(i32 246)
%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 1235, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int addhi3(int a, int b) { return a + b; }


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

x86 assembly (clang, -O2):
<addhi3>:
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @addhi3(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = add nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @addhi3(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
int system_start(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @system_start() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ addbyte(int);
void MMX_PSRAW_imm(int dst_reg, int amount) {
  addbyte(0x66);
  addbyte(0x0f);
  addbyte(0x71);
  addbyte(0xc0 | dst_reg | 0x20);
  addbyte(amount);
}


x86 assembly (clang, -O0):
<MMX_PSRAW_imm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x66,%edi
call   1030 <addbyte@plt>
mov    $0xf,%edi
call   1030 <addbyte@plt>
mov    $0x71,%edi
call   1030 <addbyte@plt>
mov    -0x4(%rbp),%edi
or     $0xc0,%edi
or     $0x20,%edi
call   1030 <addbyte@plt>
mov    -0x8(%rbp),%edi
call   1030 <addbyte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MMX_PSRAW_imm>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x66,%edi
call   1030 <addbyte@plt>
mov    $0xf,%edi
call   1030 <addbyte@plt>
mov    $0x71,%edi
call   1030 <addbyte@plt>
or     $0xe0,%ebp
mov    %ebp,%edi
call   1030 <addbyte@plt>
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <addbyte@plt>

LLVM IR (-O0):
define void @MMX_PSRAW_imm(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @addbyte(i32 102)
%6 = call i32 @addbyte(i32 15)
%7 = call i32 @addbyte(i32 113)
%8 = load i32, i32* %3
%9 = or i32 192, %8
%10 = or i32 %9, 32
%11 = call i32 @addbyte(i32 %10)
%12 = load i32, i32* %4
%13 = call i32 @addbyte(i32 %12)
ret void
}

LLVM IR (-O2):
define void @MMX_PSRAW_imm(i32 %0, i32 %1) {
%3 = tail call i32 @addbyte(i32 102)
%4 = tail call i32 @addbyte(i32 15)
%5 = tail call i32 @addbyte(i32 113)
%6 = or i32 %0, 224
%7 = tail call i32 @addbyte(i32 %6)
%8 = tail call i32 @addbyte(i32 %1)
ret void
}
unsigned long bus_to_phys(unsigned long bus) { return bus; }


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

x86 assembly (clang, -O2):
<bus_to_phys>:
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @bus_to_phys(i64 returned %0) {
ret i64 %0
}
/* Variables and functions */
scalar_t__ puts(char *);
int foo(void) {
  int n = 0;
  n += puts("this is some string");
  n += puts("this -= '8' 2u '\\a' \"i\\ns\\t\" '\\n' a \"te\\0st\"");
  return n;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <puts@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbx
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
mov    %rax,%rbx
lea    0xeed(%rip),%rdi
call   1030 <puts@plt>
add    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"this is some string\00"
@.str.1 = [45 x i8] c"this -= '8' 2u '\\a' \22i\\ns\\t\22 '\\n' a \22te\\0st\22\00"
define i32 @foo() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
%4 = sext i32 %3 to i64
%5 = add nsw i64 %4, %2
%6 = trunc i64 %5 to i32
store i32 %6, i32* %1
%7 = call i64 @puts(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32, i32* %1
%9 = sext i32 %8 to i64
%10 = add nsw i64 %9, %7
%11 = trunc i64 %10 to i32
store i32 %11, i32* %1
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
@.str = [20 x i8] c"this is some string\00"
@.str.1 = [45 x i8] c"this -= '8' 2u '\\a' \22i\\ns\\t\22 '\\n' a \22te\\0st\22\00"
define i32 @foo() {
%1 = tail call i64 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%2 = tail call i64 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%3 = add i64 %2, %1
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ EC_KEY;
typedef int /*<<< orphan*/ BN_CTX;
typedef int /*<<< orphan*/ BIGNUM;

/* Variables and functions */
int SM2_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) {
  return SM2_sign_setup(eckey, ctx_in, kinvp, rp);
}


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

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

LLVM IR (-O0):
define i32 @SM2_sign_setup(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 = load i32**, i32*** %7
%12 = load i32**, i32*** %8
%13 = call i32 @SM2_sign_setup(i32* %9, i32* %10, i32** %11, i32** %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @SM2_sign_setup(i32* nocapture readnone %0, i32* nocapture readnone %1, i32** nocapture readnone %2, i32** nocapture readnone %3) {
br label %5
5: ; preds = %5, %4
br label %5
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void memCxtFree(void *addr) {
  free(addr);
  return;
}


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

x86 assembly (clang, -O2):
<memCxtFree>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @memCxtFree(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void printUsage(int exitCode) {
  printf("Usage: CryptPasswords -s <string> | -u <userid> | -a\n\n");
  printf("-s <string> : Encrypt the given string.\n");
  printf("-u <userid> : Encrypt the password for the given user.\n");
  printf("-a          : Encrypt the password for all users.\n");
  exit(exitCode);
}


x86 assembly (clang, -O0):
<printUsage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
lea    0xef9(%rip),%rdi
call   1030 <printf@plt>
lea    0xf16(%rip),%rdi
call   1030 <printf@plt>
lea    0xf42(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<printUsage>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
call   1030 <puts@plt>
lea    0xf00(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1c(%rip),%rdi
call   1030 <puts@plt>
lea    0xf47(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [55 x i8] c"Usage: CryptPasswords -s <string> | -u <userid> | -a\0A\0A\00"
@.str.1 = [41 x i8] c"-s <string> : Encrypt the given string.\0A\00"
@.str.2 = [56 x i8] c"-u <userid> : Encrypt the password for the given user.\0A\00"
@.str.3 = [51 x i8] c"-a : Encrypt the password for all users.\0A\00"
define void @printUsage(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0))
%7 = load i32, i32* %2
%8 = call i32 @exit(i32 %7)
unreachable
}

LLVM IR (-O2):
@str = [54 x i8] c"Usage: CryptPasswords -s <string> | -u <userid> | -a\0A\00"
@str.4 = [40 x i8] c"-s <string> : Encrypt the given string.\00"
@str.5 = [55 x i8] c"-u <userid> : Encrypt the password for the given user.\00"
@str.6 = [50 x i8] c"-a : Encrypt the password for all users.\00"
define void @printUsage(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.4, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.5, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.6, i64 0, i64 0))
%6 = tail call i32 @exit(i32 %0)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
char *asctime(struct tm *);
struct tm *localtime(int /*<<< orphan*/ *);
int strlen(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
char *getime() {
  time_t t = time(NULL);
  struct tm *ft = localtime(&t);
  char *hora = asctime(ft) + 11;
  hora[(strlen(hora) - 6)] = '\0';
  return ((char *)hora);
}


x86 assembly (clang, -O0):
<getime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <asctime@plt>
add    $0xb,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
sub    $0x6,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getime>:
push   %r14
push   %rbx
push   %rax
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <localtime@plt>
mov    %rax,%rdi
call   1050 <asctime@plt>
mov    %rax,%rbx
lea    0xb(%rax),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,0x5(%rax,%rbx,1)
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define i8* @getime() {
%1 = alloca i32
%2 = alloca %struct.tm*
%3 = alloca i8*
%4 = call i32 @time(i32* null)
store i32 %4, i32* %1
%5 = call %struct.tm* @localtime(i32* %1)
store %struct.tm* %5, %struct.tm** %2
%6 = load %struct.tm*, %struct.tm** %2
%7 = call i8* @asctime(%struct.tm* %6)
%8 = getelementptr inbounds i8, i8* %7, i64 11
store i8* %8, i8** %3
%9 = load i8*, i8** %3
%10 = load i8*, i8** %3
%11 = call i32 @strlen(i8* %10)
%12 = sub nsw i32 %11, 6
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %9, i64 %13
store i8 0, i8* %14
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define i8* @getime() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @time(i32* null)
store i32 %3, i32* %1
%4 = call %struct.tm* @localtime(i32* %1)
%5 = call i8* @asctime(%struct.tm* %4)
%6 = getelementptr inbounds i8, i8* %5, i64 11
%7 = call i32 @strlen(i8* %6)
%8 = add nsw i32 %7, -6
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %6, i64 %9
store i8 0, i8* %10
ret i8* %6
}