xunge/DecIR huggingface dataset:
void set_black(unsigned char *bw, int i) { bw[i / 8] |= 1 << (7 - i % 8); }


x86 assembly (clang, -O0):
<set_black>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    $0x7,%ecx
sub    %edx,%ecx
mov    $0x1,%esi
shl    %cl,%esi
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%edx
or     %esi,%edx
mov    %dl,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_black>:
lea    0x7(%rsi),%eax
test   %esi,%esi
cmovns %esi,%eax
mov    %eax,%ecx
and    $0xfffffff8,%ecx
sub    %ecx,%esi
mov    $0x7,%cl
sub    %sil,%cl
mov    $0x1,%edx
shl    %cl,%edx
sar    $0x3,%eax
cltq
or     %dl,(%rdi,%rax,1)
ret

LLVM IR (-O0):
define void @set_black(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = srem i32 %5, 8
%7 = sub nsw i32 7, %6
%8 = shl i32 1, %7
%9 = load i8*, i8** %3
%10 = load i32, i32* %4
%11 = sdiv i32 %10, 8
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %9, i64 %12
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = or i32 %15, %8
%17 = trunc i32 %16 to i8
store i8 %17, i8* %13
ret void
}

LLVM IR (-O2):
define void @set_black(i8* nocapture %0, i32 %1) {
%3 = srem i32 %1, 8
%4 = sub nsw i32 7, %3
%5 = shl nuw nsw i32 1, %4
%6 = sdiv i32 %1, 8
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = trunc i32 %5 to i8
%11 = or i8 %9, %10
store i8 %11, i8* %8
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int checkProfile(void) {
  FILE *fp = NULL;
  char destination[] = "Database/profile/empty";
  fp = fopen(destination, "r");
  if (fp == NULL) {
    return 1;
  } else {
    fclose(fp);
    fp = NULL;
    return 0;
  }
}


x86 assembly (clang, -O0):
<checkProfile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movq   $0x0,-0x10(%rbp)
mov    0xec9(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec6(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xec4(%rip),%eax
mov    %eax,-0x20(%rbp)
mov    0xebe(%rip),%ax
mov    %ax,-0x1c(%rbp)
mov    0xeb6(%rip),%al
mov    %al,-0x1a(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xea9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    118e <checkProfile+0x6e>
movl   $0x1,-0x4(%rbp)
jmp    11a6 <checkProfile+0x86>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
movq   $0x0,-0x10(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkProfile>:
sub    $0x18,%rsp
movaps 0xed5(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x7974706d652f65,%rax
mov    %rax,0xf(%rsp)
lea    0xed2(%rip),%rsi
mov    %rsp,%rdi
call   1040 <fopen@plt>
test   %rax,%rax
je     1161 <checkProfile+0x41>
mov    %rax,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret
mov    $0x1,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.checkProfile.destination = [23 x i8] c"Database/profile/empty\00"
@.str = [2 x i8] c"r\00"
define i32 @checkProfile() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [23 x i8]
store i32* null, i32** %2
%4 = bitcast [23 x i8]* %3 to i8*
%5 = getelementptr inbounds [23 x i8], [23 x i8]* %3, i64 0, i64 0
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %6, i32** %2
%7 = load i32*, i32** %2
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %10
9: ; preds = %0
store i32 1, i32* %1
br label %13
10: ; preds = %0
%11 = load i32*, i32** %2
%12 = call i32 @fclose(i32* %11)
store i32* null, i32** %2
store i32 0, i32* %1
br label %13
13: ; preds = %10, %9
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
@__const.checkProfile.destination = [23 x i8] c"Database/profile/empty\00"
@.str = [2 x i8] c"r\00"
define i32 @checkProfile() {
%1 = alloca [23 x i8]
%2 = getelementptr inbounds [23 x i8], [23 x i8]* %1, i64 0, i64 0
%3 = call i32* @fopen(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = tail call i32 @fclose(i32* %3)
br label %7
7: ; preds = %0, %5
%8 = phi i32 [ 0, %5 ], [ 1, %0 ]
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;
typedef int /*<<< orphan*/ gid_t;

/* Variables and functions */
int syscall(int, int, int /*<<< orphan*/, int /*<<< orphan*/);
int fchown(int fd, uid_t uid, gid_t gid) { return syscall(207, fd, uid, gid); }


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

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

LLVM IR (-O0):
define i32 @fchown(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @syscall(i32 207, i32 %7, i32 %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @fchown(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @syscall(i32 207, i32 %0, i32 %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
scalar_t__ system(char *);
int rm_work_dir() {
  char *s = "rm -rf /tmp/catchWish";
  if (0 != system(s)) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<rm_work_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <system@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1146 <rm_work_dir+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    114d <rm_work_dir+0x3d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rm_work_dir>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <system@plt>
neg    %rax
sbb    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"rm -rf /tmp/catchWish\00"
define i32 @rm_work_dir() {
%1 = alloca i32
%2 = alloca i8*
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @system(i8* %3)
%5 = icmp ne i64 0, %4
br i1 %5, label %6, label %7
6: ; preds = %0
store i32 -1, i32* %1
br label %8
7: ; preds = %0
store i32 0, i32* %1
br label %8
8: ; preds = %7, %6
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
@.str = [22 x i8] c"rm -rf /tmp/catchWish\00"
define i32 @rm_work_dir() {
%1 = tail call i64 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%2 = icmp ne i64 %1, 0
%3 = sext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
double fabs(double);
double dsign(double a, double b) { return b >= 0.0 ? fabs(a) : -fabs(a); }


x86 assembly (clang, -O0):
<dsign>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     113a <dsign+0x3a>
movsd  -0x8(%rbp),%xmm0
movaps 0xed4(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1166 <dsign+0x66>
movsd  -0x8(%rbp),%xmm0
movaps 0xeba(%rip),%xmm1
pand   %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dsign>:
movapd 0xef8(%rip),%xmm2
andpd  %xmm0,%xmm2
orpd   0xefc(%rip),%xmm0
xorpd  %xmm3,%xmm3
cmpnlesd %xmm1,%xmm3
andpd  %xmm3,%xmm0
andnpd %xmm2,%xmm3
orpd   %xmm3,%xmm0
ret

LLVM IR (-O0):
define double @dsign(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = fcmp oge double %5, 0.000000e+00
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load double, double* %3
%9 = call double @llvm.fabs.f64(double %8)
br label %14
10: ; preds = %2
%11 = load double, double* %3
%12 = call double @llvm.fabs.f64(double %11)
%13 = fneg double %12
br label %14
14: ; preds = %10, %7
%15 = phi double [ %9, %7 ], [ %13, %10 ]
ret double %15
}

LLVM IR (-O2):
define double @dsign(double %0, double %1) {
%3 = fcmp ult double %1, 0.000000e+00
%4 = tail call double @llvm.fabs.f64(double %0)
%5 = fneg double %4
%6 = select i1 %3, double %5, double %4
ret double %6
}
void delay1u(void) {
  int i;
  for (i = 0; i < 66; i++)
    ;
}


x86 assembly (clang, -O0):
<delay1u>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0x42,-0x4(%rbp)
jge    1128 <delay1u+0x28>
jmp    111a <delay1u+0x1a>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <delay1u+0xb>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @delay1u() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %6, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 66
br i1 %4, label %5, label %9
5: ; preds = %2
br label %6
6: ; preds = %5
%7 = load i32, i32* %1
%8 = add nsw i32 %7, 1
store i32 %8, i32* %1
br label %2
9: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @delay1u() {
ret void
}
/* Variables and functions */
char *strrchr(char const *, char);
const char *get_extension(const char *path) {
  const char *ext = strrchr(path, '.');
  if (ext)
    ext++;
  return ext;
}


x86 assembly (clang, -O0):
<get_extension>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1145 <get_extension+0x35>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_extension>:
push   %rax
mov    $0x2e,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmovne %rcx,%rax
pop    %rcx
ret

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

LLVM IR (-O2):
define i8* @get_extension(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 46)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* null, i8* %4
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ LCD_data_write_up(char);
void lprint(char *text) {
  while (*text != 0) {
    LCD_data_write_up(*text - 0x20);
    text++;
  }
}


x86 assembly (clang, -O0):
<lprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     114f <lprint+0x3f>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
sub    $0x20,%eax
movsbl %al,%edi
call   1030 <LCD_data_write_up@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <lprint+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lprint>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1135 <lprint+0x25>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
add    $0xe0,%al
movsbl %al,%edi
call   1030 <LCD_data_write_up@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <lprint+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @lprint(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %8, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %17
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = sub nsw i32 %11, 32
%13 = trunc i32 %12 to i8
%14 = call i32 @LCD_data_write_up(i8 signext %13)
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %2
br label %3
17: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @lprint(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %9, %4 ], [ %0, %1 ]
%7 = add i8 %5, -32
%8 = tail call i32 @LCD_data_write_up(i8 signext %7)
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Type definitions */
struct timeval {
  long tv_sec;
  long tv_usec;
};

/* Variables and functions */
long get_host_seed();
long getpid();
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ srand48(long);
void magic_init() {
  long seed;
  struct timeval t;
  gettimeofday(&t, NULL);
  seed = get_host_seed() ^ t.tv_sec ^ t.tv_usec ^ getpid();
  srand48(seed);
}


x86 assembly (clang, -O0):
<magic_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
mov    $0x0,%al
call   1050 <get_host_seed@plt>
xor    -0x18(%rbp),%rax
xor    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
xor    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <srand48@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<magic_init>:
push   %rbx
sub    $0x10,%rsp
mov    %rsp,%rdi
xor    %esi,%esi
call   1040 <gettimeofday@plt>
xor    %eax,%eax
call   1050 <get_host_seed@plt>
mov    %rax,%rbx
xor    (%rsp),%rbx
xor    0x8(%rsp),%rbx
xor    %eax,%eax
call   1030 <getpid@plt>
xor    %rax,%rbx
mov    %rbx,%rdi
add    $0x10,%rsp
pop    %rbx
jmp    1060 <srand48@plt>

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define void @magic_init() {
%1 = alloca i64
%2 = alloca %struct.timeval
%3 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%4 = call i64 (...) @get_host_seed()
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
%6 = load i64, i64* %5
%7 = xor i64 %4, %6
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 1
%9 = load i64, i64* %8
%10 = xor i64 %7, %9
%11 = call i64 (...) @getpid()
%12 = xor i64 %10, %11
store i64 %12, i64* %1
%13 = load i64, i64* %1
%14 = call i32 @srand48(i64 %13)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define void @magic_init() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = tail call i64 (...) @get_host_seed()
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%6 = load i64, i64* %5
%7 = xor i64 %6, %4
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%9 = load i64, i64* %8
%10 = xor i64 %7, %9
%11 = tail call i64 (...) @getpid()
%12 = xor i64 %10, %11
%13 = tail call i32 @srand48(i64 %12)
ret void
}
/* Variables and functions */
scalar_t__ ESRCH;
int /*<<< orphan*/ abort();
scalar_t__ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int sched_getscheduler(int);
int main(void) {
  if (sched_getscheduler(99) != -1 || errno != ESRCH)
    abort();
  printf("pass\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x63,%edi
call   1030 <sched_getscheduler@plt>
cmp    $0xffffffff,%eax
jne    117c <main+0x3c>
mov    0x2e77(%rip),%rax
mov    (%rax),%rax
mov    0x2e5d(%rip),%rcx
cmp    (%rcx),%rax
je     1183 <main+0x43>
mov    $0x0,%al
call   1040 <abort@plt>
lea    0xe76(%rip),%rdi
call   1050 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x63,%edi
call   1030 <sched_getscheduler@plt>
cmp    $0xffffffff,%eax
jne    1179 <main+0x39>
mov    0x2e89(%rip),%rax
mov    (%rax),%rax
mov    0x2e6f(%rip),%rcx
cmp    (%rcx),%rax
jne    1179 <main+0x39>
lea    0xe93(%rip),%rdi
call   1050 <puts@plt>
xor    %edi,%edi
call   1060 <exit@plt>
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
@errno = global i64 0
@ESRCH = global i64 0
@.str = [6 x i8] c"pass\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @sched_getscheduler(i32 99)
%3 = icmp ne i32 %2, -1
br i1 %3, label %8, label %4
4: ; preds = %0
%5 = load i64, i64* @errno
%6 = load i64, i64* @ESRCH
%7 = icmp ne i64 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %4, %0
%9 = call i32 (...) @abort()
unreachable
10: ; preds = %4
%11 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@errno = global i64 0
@ESRCH = global i64 0
@str = [5 x i8] c"pass\00"
define i32 @main() {
%1 = tail call i32 @sched_getscheduler(i32 99)
%2 = icmp eq i32 %1, -1
br i1 %2, label %3, label %7
3: ; preds = %0
%4 = load i64, i64* @errno
%5 = load i64, i64* @ESRCH
%6 = icmp eq i64 %4, %5
br i1 %6, label %9, label %7
7: ; preds = %3, %0
%8 = tail call i32 (...) @abort()
unreachable
9: ; preds = %3
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%11 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ svcPanic();
int write(int file, char *ptr, int len) { svcPanic(); }


x86 assembly (clang, -O0):
<write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0x0,%al
call   1030 <svcPanic@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @write(i32 %0, i8* nocapture readnone %1, i32 %2) {
%4 = tail call i32 (...) @svcPanic()
ret i32 undef
}
/* Type definitions */
typedef int uint64_t;
typedef int uint32_t;

/* Variables and functions */
uint32_t high_64(uint64_t val) { return (val >> 32) & ~(uint32_t)0; }


x86 assembly (clang, -O0):
<high_64>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x20,%ecx
sar    %cl,%eax
and    $0xffffffff,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @high_64(i32 %0) {
ret i32 poison
}
void f168(void) {
a:
  ({
    ({ 0; });
    ({ 0; });
    0;
  });
  ({
    ({ 0; });
    ({ 0; });
    0;
  });
  goto a;
  0;
}


x86 assembly (clang, -O0):
<f168>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
jmp    1104 <f168+0x4>

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

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

LLVM IR (-O2):
define void @f168() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Variables and functions */
int inb(int);
int kbhit() { return (inb(0x3fd) & 1) != 0; }


x86 assembly (clang, -O0):
<kbhit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3fd,%edi
call   1030 <inb@plt>
and    $0x1,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<kbhit>:
push   %rax
mov    $0x3fd,%edi
call   1030 <inb@plt>
and    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @kbhit() {
%1 = call i32 @inb(i32 1021)
%2 = and i32 %1, 1
%3 = icmp ne i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @kbhit() {
%1 = tail call i32 @inb(i32 1021)
%2 = and i32 %1, 1
ret i32 %2
}
/* Variables and functions */
int fibsum1();
int /*<<< orphan*/ printf(char *, int);
int main() { printf("sum: %d\n", fibsum1()); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <fibsum1@plt>
mov    %eax,%esi
lea    0xecc(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [9 x i8] c"sum: %d\0A\00"
define i32 @main() {
%1 = call i32 (...) @fibsum1()
%2 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"sum: %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @fibsum1()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
long atol(char *);
int /*<<< orphan*/ printf(char *, long);
int main() {
  long my_value;
  char my_string[] = "+2000000000";
  my_value = atol(my_string);
  printf("%ld\n", my_value);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x1c(%rbp)
mov    0xec8(%rip),%eax
mov    %eax,-0x14(%rbp)
lea    -0x1c(%rbp),%rdi
call   1040 <atol@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.main.my_string = [12 x i8] c"+2000000000\00"
@.str = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca [12 x i8]
store i32 0, i32* %1
%4 = bitcast [12 x i8]* %3 to i8*
%5 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%6 = call i64 @atol(i8* %5)
store i64 %6, i64* %2
%7 = load i64, i64* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 2000000000)
ret i32 0
}
int as_int32(unsigned a) { return *((int *)&a); }


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

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

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

LLVM IR (-O2):
define i32 @as_int32(i32 returned %0) {
ret i32 %0
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int y;
};
struct TYPE_4__ {
  TYPE_1__ xgraphicsexpose;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
void set_XEvent_xgraphicsexpose_y(void *_p, int _v) {
  ((XEvent *)_p)->xgraphicsexpose.y = (int)_v;
}


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

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

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

LLVM IR (-O2):
define void @set_XEvent_xgraphicsexpose_y(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
int enter_mount_ns(int pid) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @enter_mount_ns(i32 %0) {
ret i32 1
}
/* Type definitions */
struct genlist_link {
  int dummy;
};
struct genlist {
  int dummy;
};
struct entry_list_link {
  int dummy;
};
struct entry_list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ genlist_erase(struct genlist *, struct genlist_link *);
void entry_list_erase(struct entry_list *tthis, struct entry_list_link *plink) {
  genlist_erase((struct genlist *)tthis, (struct genlist_link *)plink);
}


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

x86 assembly (clang, -O2):
<entry_list_erase>:
jmp    1030 <genlist_erase@plt>

LLVM IR (-O0):
%struct.entry_list = type { i32 }
%struct.entry_list_link = type { i32 }
%struct.genlist = type { i32 }
%struct.genlist_link = type { i32 }
define void @entry_list_erase(%struct.entry_list* %0, %struct.entry_list_link* %1) {
%3 = alloca %struct.entry_list*
%4 = alloca %struct.entry_list_link*
store %struct.entry_list* %0, %struct.entry_list** %3
store %struct.entry_list_link* %1, %struct.entry_list_link** %4
%5 = load %struct.entry_list*, %struct.entry_list** %3
%6 = bitcast %struct.entry_list* %5 to %struct.genlist*
%7 = load %struct.entry_list_link*, %struct.entry_list_link** %4
%8 = bitcast %struct.entry_list_link* %7 to %struct.genlist_link*
%9 = call i32 @genlist_erase(%struct.genlist* %6, %struct.genlist_link* %8)
ret void
}

LLVM IR (-O2):
%struct.entry_list = type { i32 }
%struct.entry_list_link = type { i32 }
%struct.genlist = type { i32 }
%struct.genlist_link = type { i32 }
define void @entry_list_erase(%struct.entry_list* %0, %struct.entry_list_link* %1) {
%3 = bitcast %struct.entry_list* %0 to %struct.genlist*
%4 = bitcast %struct.entry_list_link* %1 to %struct.genlist_link*
%5 = tail call i32 @genlist_erase(%struct.genlist* %3, %struct.genlist_link* %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char const *);
int /*<<< orphan*/ stderr;
int _touch_error(char const *message, int ret) {
  fputs("touch"
        ": ",
        stderr);
  perror(message);
  return ret;
}


x86 assembly (clang, -O0):
<_touch_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%esi
lea    0xec1(%rip),%rdi
call   1030 <fputs@plt>
mov    -0x8(%rbp),%rdi
call   1040 <perror@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_touch_error>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    0x2eb1(%rip),%rax
mov    (%rax),%esi
lea    0xec8(%rip),%rdi
call   1030 <fputs@plt>
mov    %rbx,%rdi
call   1040 <perror@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"touch: \00"
@stderr = global i32 0
define i32 @_touch_error(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @stderr
%6 = call i32 @fputs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i8*, i8** %3
%8 = call i32 @perror(i8* %7)
%9 = load i32, i32* %4
ret i32 %9
}

LLVM IR (-O2):
@.str = [8 x i8] c"touch: \00"
@stderr = global i32 0
define i32 @_touch_error(i8* nocapture %0, i32 returned %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fputs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @perror(i8* %0)
ret i32 %1
}
/* Variables and functions */
int atoi_eol(char const *, int /*<<< orphan*/);
int atoi(const char *str) { return atoi_eol(str, 0); }


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

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

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

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

/* Variables and functions */
int main(void) {
  daddr_t addr = 0;
  (void)addr;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
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
store i32 0, i32* %1
store i32 0, i32* %2
%3 = load i32, i32* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void decimalBinario(int num) {
  int resto;
  int cociente;
  cociente = num / 2;
  resto = num % 2;
  if (cociente > 1)
    decimalBinario(cociente);
  else
    printf("%d", cociente);
  printf("%d", resto);
}


x86 assembly (clang, -O0):
<decimalBinario>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
cmpl   $0x1,-0xc(%rbp)
jle    115e <decimalBinario+0x3e>
mov    -0xc(%rbp),%edi
call   1040 <decimalBinario@plt>
jmp    116d <decimalBinario+0x4d>
mov    -0xc(%rbp),%esi
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decimalBinario>:
push   %rbx
mov    %edi,%eax
shr    $0x1f,%eax
add    %edi,%eax
mov    %eax,%esi
sar    %esi
and    $0xfffffffe,%eax
mov    %edi,%ebx
sub    %eax,%ebx
cmp    $0x4,%edi
jl     1141 <decimalBinario+0x21>
mov    %esi,%edi
call   1040 <decimalBinario@plt>
jmp    114d <decimalBinario+0x2d>
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
lea    0xeac(%rip),%rdi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define void @decimalBinario(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = sdiv i32 %5, 2
store i32 %6, i32* %4
%7 = load i32, i32* %2
%8 = srem i32 %7, 2
store i32 %8, i32* %3
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 1
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = load i32, i32* %4
br label %16
13: ; preds = %1
%14 = load i32, i32* %4
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %14)
br label %16
16: ; preds = %13, %11
%17 = load i32, i32* %3
%18 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %17)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @decimalBinario(i32 %0) {
%2 = sdiv i32 %0, 2
%3 = srem i32 %0, 2
%4 = icmp sgt i32 %0, 3
br i1 %4, label %5, label %6
5: ; preds = %1
tail call void @decimalBinario(i32 %2)
br label %8
6: ; preds = %1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %8
8: ; preds = %6, %5
%9 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}
void __gnat_clear_exception_count(void) {}


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

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

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

LLVM IR (-O2):
define void @__gnat_clear_exception_count() {
ret void
}
EBBImp(ConsoleStream, Imp) {
  char *buf;
  int bufsize;
}


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

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

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

LLVM IR (-O2):
define i32 @EBBImp(i32 %0, i32 %1) {
ret i32 undef
}
int ft_isprint(int c) {
  return (((c >= ' ') && (c <= '?')) || ((c >= '@') && (c <= '~')));
}


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

x86 assembly (clang, -O2):
<ft_isprint>:
mov    %edi,%eax
and    $0xffffffe0,%eax
cmp    $0x20,%eax
sete   %al
add    $0xffffffc0,%edi
cmp    $0x3f,%edi
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @ft_isprint(i32 %0) {
%2 = and i32 %0, -32
%3 = icmp eq i32 %2, 32
%4 = add i32 %0, -64
%5 = icmp ult i32 %4, 63
%6 = or i1 %3, %5
%7 = zext i1 %6 to i32
ret i32 %7
}
int test_0(int a, int b, int c, int d) { return (a / b) + c + d; }


x86 assembly (clang, -O0):
<test_0>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_0>:
mov    %edx,%r8d
mov    %edi,%eax
cltd
idiv   %esi
add    %ecx,%r8d
add    %r8d,%eax
ret

LLVM IR (-O0):
define i32 @test_0(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 = sdiv i32 %9, %10
%12 = load i32, i32* %7
%13 = add nsw i32 %11, %12
%14 = load i32, i32* %8
%15 = add nsw i32 %13, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @test_0(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = sdiv i32 %0, %1
%6 = add i32 %3, %2
%7 = add i32 %6, %5
ret i32 %7
}
/* Variables and functions */
char *malloc(size_t);
char *memcpy(char *, char const *, size_t);
char *json_strndup(const char *str, size_t size) {
  char *copy = malloc((size + 1) * sizeof(char));
  copy[size] = 0;
  return memcpy(copy, str, size * sizeof(char));
}


x86 assembly (clang, -O0):
<json_strndup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
shl    $0x0,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
shl    $0x0,%rdx
call   1030 <memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<json_strndup>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0x1(%rsi),%rdi
call   1040 <malloc@plt>
movb   $0x0,(%rax,%rbx,1)
mov    %rax,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
define i8* @json_strndup(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = add i64 %6, 1
%8 = mul i64 %7, 1
%9 = call i8* @malloc(i64 %8)
store i8* %9, i8** %5
%10 = load i8*, i8** %5
%11 = load i64, i64* %4
%12 = getelementptr inbounds i8, i8* %10, i64 %11
store i8 0, i8* %12
%13 = load i8*, i8** %5
%14 = load i8*, i8** %3
%15 = load i64, i64* %4
%16 = mul i64 %15, 1
%17 = call i8* @memcpy(i8* %13, i8* %14, i64 %16)
ret i8* %17
}

LLVM IR (-O2):
define noalias i8* @json_strndup(i8* nocapture %0, i64 %1) {
%3 = add i64 %1, 1
%4 = tail call i8* @malloc(i64 %3)
%5 = getelementptr inbounds i8, i8* %4, i64 %1
store i8 0, i8* %5
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %4, i8* align 1 %0, i64 %1, i1 false)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
int write(int, unsigned char *, int);
int set_i2c_data(int dev, unsigned char val) {
  int r;
  unsigned char buf[2];
  buf[1] = 0;
  buf[0] = val;
  if ((r = write(dev, buf, 1)) < 0) {
    return 0;
  }
  usleep(2);
  return 1;
}


x86 assembly (clang, -O0):
<set_i2c_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %edi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movb   $0x0,-0x11(%rbp)
mov    -0x9(%rbp),%al
mov    %al,-0x12(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x12(%rbp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
jge    1164 <set_i2c_data+0x44>
movl   $0x0,-0x4(%rbp)
jmp    1175 <set_i2c_data+0x55>
mov    $0x2,%edi
call   1040 <usleep@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_i2c_data>:
push   %rbx
sub    $0x10,%rsp
movb   $0x0,0xf(%rsp)
mov    %sil,0xe(%rsp)
lea    0xe(%rsp),%rsi
mov    $0x1,%ebx
mov    $0x1,%edx
call   1030 <write@plt>
test   %eax,%eax
js     1153 <set_i2c_data+0x33>
mov    $0x2,%edi
call   1040 <usleep@plt>
jmp    1155 <set_i2c_data+0x35>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @set_i2c_data(i32 %0, i8 zeroext %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
%6 = alloca i32
%7 = alloca [2 x i8]
store i32 %0, i32* %4
store i8 %1, i8* %5
%8 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 1
store i8 0, i8* %8
%9 = load i8, i8* %5
%10 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
store i8 %9, i8* %10
%11 = load i32, i32* %4
%12 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
%13 = call i32 @write(i32 %11, i8* %12, i32 1)
store i32 %13, i32* %6
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %2
store i32 0, i32* %3
br label %18
16: ; preds = %2
%17 = call i32 @usleep(i32 2)
store i32 1, i32* %3
br label %18
18: ; preds = %16, %15
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
define i32 @set_i2c_data(i32 %0, i8 zeroext %1) {
%3 = alloca [2 x i8]
%4 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 1
store i8 0, i8* %5
store i8 %1, i8* %4
%6 = call i32 @write(i32 %0, i8* %4, i32 1)
%7 = icmp slt i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32 @usleep(i32 2)
br label %10
10: ; preds = %2, %8
%11 = phi i32 [ 1, %8 ], [ 0, %2 ]
ret i32 %11
}
void isr_Interrupt(void) {}


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

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

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

LLVM IR (-O2):
define void @isr_Interrupt() {
ret void
}
void rop3_43_1_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  stk2 = S ^ T;
  stk3 = T ^ *D;
  stk2 = stk2 & stk3;
  stk1 = S ^ stk2;
  stk1 = ~stk1;
  *D = (stk1 & (~S)) | (*D & S);
}


x86 assembly (clang, -O0):
<rop3_43_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xa(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0xa(%rbp),%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
xor    %ecx,%eax
mov    %al,-0xd(%rbp)
movzbl -0xc(%rbp),%eax
movzbl -0xd(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xc(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_43_1_0>:
mov    (%rdi),%al
mov    %eax,%ecx
xor    %dl,%cl
xor    %sil,%dl
and    %cl,%dl
or     %sil,%dl
not    %dl
and    %sil,%al
or     %dl,%al
mov    %al,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_43_1_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%10 = load i8, i8* %5
%11 = zext i8 %10 to i32
%12 = load i8, i8* %6
%13 = zext i8 %12 to i32
%14 = xor i32 %11, %13
%15 = trunc i32 %14 to i8
store i8 %15, i8* %8
%16 = load i8, i8* %6
%17 = zext i8 %16 to i32
%18 = load i8*, i8** %4
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = xor i32 %17, %20
%22 = trunc i32 %21 to i8
store i8 %22, i8* %9
%23 = load i8, i8* %8
%24 = zext i8 %23 to i32
%25 = load i8, i8* %9
%26 = zext i8 %25 to i32
%27 = and i32 %24, %26
%28 = trunc i32 %27 to i8
store i8 %28, i8* %8
%29 = load i8, i8* %5
%30 = zext i8 %29 to i32
%31 = load i8, i8* %8
%32 = zext i8 %31 to i32
%33 = xor i32 %30, %32
%34 = trunc i32 %33 to i8
store i8 %34, i8* %7
%35 = load i8, i8* %7
%36 = zext i8 %35 to i32
%37 = xor i32 %36, -1
%38 = trunc i32 %37 to i8
store i8 %38, i8* %7
%39 = load i8, i8* %7
%40 = zext i8 %39 to i32
%41 = load i8, i8* %5
%42 = zext i8 %41 to i32
%43 = xor i32 %42, -1
%44 = and i32 %40, %43
%45 = load i8*, i8** %4
%46 = load i8, i8* %45
%47 = zext i8 %46 to i32
%48 = load i8, i8* %5
%49 = zext i8 %48 to i32
%50 = and i32 %47, %49
%51 = or i32 %44, %50
%52 = trunc i32 %51 to i8
%53 = load i8*, i8** %4
store i8 %52, i8* %53
ret void
}

LLVM IR (-O2):
define void @rop3_43_1_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = xor i8 %2, %1
%5 = load i8, i8* %0
%6 = xor i8 %5, %2
%7 = and i8 %6, %4
%8 = or i8 %7, %1
%9 = xor i8 %8, -1
%10 = and i8 %5, %1
%11 = or i8 %10, %9
store i8 %11, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ delay(int);
int /*<<< orphan*/ mbus_remote_register_write(int, int, int);
void pmu_reset_solar_short() {
  mbus_remote_register_write(
      0x6, 0x0E, ((1 << 10) | (1 << 9) | (0 << 8) | (1 << 4) | (0)));
  delay(100);
  mbus_remote_register_write(
      0x6, 0x0E, ((1 << 10) | (0 << 9) | (0 << 8) | (1 << 4) | (0)));
  delay(100);
}


x86 assembly (clang, -O0):
<pmu_reset_solar_short>:
push   %rbp
mov    %rsp,%rbp
mov    $0x6,%edi
mov    $0xe,%esi
mov    $0x610,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
mov    $0x6,%edi
mov    $0xe,%esi
mov    $0x410,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pmu_reset_solar_short>:
push   %rax
mov    $0x6,%edi
mov    $0xe,%esi
mov    $0x610,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
mov    $0x6,%edi
mov    $0xe,%esi
mov    $0x410,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
pop    %rax
jmp    1030 <delay@plt>

LLVM IR (-O0):
define void @pmu_reset_solar_short() {
%1 = call i32 @mbus_remote_register_write(i32 6, i32 14, i32 1552)
%2 = call i32 @delay(i32 100)
%3 = call i32 @mbus_remote_register_write(i32 6, i32 14, i32 1040)
%4 = call i32 @delay(i32 100)
ret void
}

LLVM IR (-O2):
define void @pmu_reset_solar_short() {
%1 = tail call i32 @mbus_remote_register_write(i32 6, i32 14, i32 1552)
%2 = tail call i32 @delay(i32 100)
%3 = tail call i32 @mbus_remote_register_write(i32 6, i32 14, i32 1040)
%4 = tail call i32 @delay(i32 100)
ret void
}
/* Variables and functions */
int snprintf(char *, int, char *, char const *, char const *);
int connectionFile(const char *from, const char *to, char *buf, int len) {
  int numWritten;
  numWritten = snprintf(buf, len,
                        ("/tmp/.talkd"
                         "/%s:%s"),
                        from, to);
  if (numWritten < 0 || numWritten == len)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<connectionFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0xec3(%rip),%rdx
call   1030 <snprintf@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jl     115b <connectionFile+0x4b>
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jne    1167 <connectionFile+0x57>
movl   $0xffffffff,-0x4(%rbp)
jmp    116e <connectionFile+0x5e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<connectionFile>:
push   %rbx
mov    %ecx,%ebx
mov    %rdx,%rax
mov    %rsi,%r8
mov    %rdi,%rcx
lea    0xedd(%rip),%rdx
mov    %rax,%rdi
mov    %ebx,%esi
call   1030 <snprintf@plt>
test   %eax,%eax
sets   %cl
cmp    %ebx,%eax
sete   %al
or     %cl,%al
movzbl %al,%eax
neg    %eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"/tmp/.talkd/%s:%s\00"
define i32 @connectionFile(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i32 %3, i32* %9
%11 = load i8*, i8** %8
%12 = load i32, i32* %9
%13 = load i8*, i8** %6
%14 = load i8*, i8** %7
%15 = call i32 @snprintf(i8* %11, i32 %12, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %13, i8* %14)
store i32 %15, i32* %10
%16 = load i32, i32* %10
%17 = icmp slt i32 %16, 0
br i1 %17, label %22, label %18
18: ; preds = %4
%19 = load i32, i32* %10
%20 = load i32, i32* %9
%21 = icmp eq i32 %19, %20
br i1 %21, label %22, label %23
22: ; preds = %18, %4
store i32 -1, i32* %5
br label %24
23: ; preds = %18
store i32 0, i32* %5
br label %24
24: ; preds = %23, %22
%25 = load i32, i32* %5
ret i32 %25
}

LLVM IR (-O2):
@.str = [18 x i8] c"/tmp/.talkd/%s:%s\00"
define i32 @connectionFile(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = tail call i32 @snprintf(i8* %2, i32 %3, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%6 = icmp slt i32 %5, 0
%7 = icmp eq i32 %5, %3
%8 = or i1 %6, %7
%9 = sext i1 %8 to i32
ret i32 %9
}