xunge/DecIR huggingface dataset:
/* Variables and functions */
int check_arg_count(int, int /*<<< orphan*/);
int /*<<< orphan*/ no_color_attributes();
int /*<<< orphan*/ report_count(int);
int /*<<< orphan*/ report_int(int /*<<< orphan*/);
void cmd_no_color_attributes(int nargs, char **args) {
  if (check_arg_count(nargs, 0) == 1)
    return;
  report_count(1);
  report_int(no_color_attributes());
}


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

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

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

LLVM IR (-O2):
define void @cmd_no_color_attributes(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @check_arg_count(i32 %0, i32 0)
%4 = icmp eq i32 %3, 1
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = tail call i32 @report_count(i32 1)
%7 = tail call i32 (...) @no_color_attributes()
%8 = tail call i32 @report_int(i32 %7)
br label %9
9: ; preds = %2, %5
ret void
}
float __saturatef(float x) { return (x < 0) ? 0 : ((x > 1) ? 1 : x); }


x86 assembly (clang, -O0):
<__saturatef>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    1123 <__saturatef+0x23>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    115f <__saturatef+0x5f>
movss  -0x4(%rbp),%xmm0
movss  0xed0(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    114b <__saturatef+0x4b>
movss  0xebf(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1155 <__saturatef+0x55>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<__saturatef>:
movss  0xef8(%rip),%xmm1
minss  %xmm0,%xmm1
xorps  %xmm2,%xmm2
cmpltss %xmm2,%xmm0
andnps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @__saturatef(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fcmp olt float %3, 0.000000e+00
br i1 %4, label %5, label %6
5: ; preds = %1
br label %14
6: ; preds = %1
%7 = load float, float* %2
%8 = fcmp ogt float %7, 1.000000e+00
br i1 %8, label %9, label %10
9: ; preds = %6
br label %12
10: ; preds = %6
%11 = load float, float* %2
br label %12
12: ; preds = %10, %9
%13 = phi float [ 1.000000e+00, %9 ], [ %11, %10 ]
br label %14
14: ; preds = %12, %5
%15 = phi float [ 0.000000e+00, %5 ], [ %13, %12 ]
ret float %15
}

LLVM IR (-O2):
define float @__saturatef(float %0) {
%2 = fcmp olt float %0, 0.000000e+00
%3 = fcmp ogt float %0, 1.000000e+00
%4 = select i1 %3, float 1.000000e+00, float %0
%5 = select i1 %2, float 0.000000e+00, float %4
ret float %5
}
void XGetMotionEvents() {}


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

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

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

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


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

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

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

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


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

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

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

LLVM IR (-O2):
define void @X509_CRL_cmp() {
ret void
}
/* Variables and functions */
char *memchr(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
void nullpointerMemchr2(char *p, char *s) {
  p = memchr(s, 0, strlen(s));
  (void)p;
}


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

x86 assembly (clang, -O2):
<nullpointerMemchr2>:
push   %rbx
mov    %rsi,%rbx
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
pop    %rbx
jmp    1040 <memchr@plt>

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

LLVM IR (-O2):
define void @nullpointerMemchr2(i8* nocapture readnone %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i8* @memchr(i8* %1, i32 0, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ lround(double);
int /*<<< orphan*/ lroundf(float);
int /*<<< orphan*/ lroundl(long double);
void uninitvar_lround(void) {
  float f;
  (void)lroundf(f);
  double d;
  (void)lround(d);
  long double ld;
  (void)lroundl(ld);
}


x86 assembly (clang, -O0):
<uninitvar_lround>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  -0x4(%rbp),%xmm0
call   1050 <lroundf@plt>
movsd  -0x10(%rbp),%xmm0
call   1030 <lround@plt>
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <lroundl@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uninitvar_lround>:
sub    $0x18,%rsp
call   1050 <lroundf@plt>
call   1030 <lround@plt>
call   1040 <lroundl@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @uninitvar_lround() {
%1 = alloca float
%2 = alloca double
%3 = alloca x86_fp80
%4 = load float, float* %1
%5 = call i32 @lroundf(float %4)
%6 = load double, double* %2
%7 = call i32 @lround(double %6)
%8 = load x86_fp80, x86_fp80* %3
%9 = call i32 @lroundl(x86_fp80 %8)
ret void
}

LLVM IR (-O2):
define void @uninitvar_lround() {
%1 = tail call i32 @lroundf(float undef)
%2 = tail call i32 @lround(double undef)
%3 = tail call i32 @lroundl(x86_fp80 undef)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, size_t, char *, char const *);
void make_lib_filename(const char *libname, char *buf, size_t n) {
  snprintf(buf, n - 1, "lib%s.so", libname);
  buf[n - 1] = '\0';
}


x86 assembly (clang, -O0):
<make_lib_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
sub    $0x1,%rsi
mov    -0x8(%rbp),%rcx
lea    0xec5(%rip),%rdx
call   1030 <snprintf@plt>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_lib_filename>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%rcx
lea    -0x1(%rdx),%rsi
lea    0xed8(%rip),%rdx
mov    %rbx,%rdi
call   1030 <snprintf@plt>
movb   $0x0,-0x1(%rbx,%r14,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [9 x i8] c"lib%s.so\00"
define void @make_lib_filename(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %5
%8 = load i64, i64* %6
%9 = sub i64 %8, 1
%10 = load i8*, i8** %4
%11 = call i32 @snprintf(i8* %7, i64 %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i8*, i8** %5
%13 = load i64, i64* %6
%14 = sub i64 %13, 1
%15 = getelementptr inbounds i8, i8* %12, i64 %14
store i8 0, i8* %15
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"lib%s.so\00"
define void @make_lib_filename(i8* %0, i8* %1, i64 %2) {
%4 = add i64 %2, -1
%5 = tail call i32 @snprintf(i8* %1, i64 %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %0)
%6 = getelementptr inbounds i8, i8* %1, i64 %4
store i8 0, i8* %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Uart_SendByte(int /*<<< orphan*/);
void Uart_SendString(char *pt) {
  while (*pt)
    Uart_SendByte(*pt++);
}


x86 assembly (clang, -O0):
<Uart_SendString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1145 <Uart_SendString+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <Uart_SendByte@plt>
jmp    111c <Uart_SendString+0xc>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @Uart_SendString(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* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = sext i8 %5 to i32
%9 = tail call i32 @Uart_SendByte(i32 %8)
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
int gcd(int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("gcd(1989,1590) :%d\n", gcd(1989, 1590));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [20 x i8] c"gcd(1989,1590) :%d\0A\00"
define i32 @main() {
%1 = tail call i32 @gcd(i32 1989, i32 1590)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
void closef(i) register int i;
{
  if (i > 2)
    close(i);
}


x86 assembly (clang, -O0):
<closef>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x2,-0x4(%rbp)
jle    112f <closef+0x1f>
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1030 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<closef>:
cmp    $0x3,%edi
jl     111c <closef+0xc>
xor    %eax,%eax
jmp    1030 <close@plt>
ret

LLVM IR (-O0):
define void @closef(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 2
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = call i32 (i32, ...) bitcast (i32 (...)* @close to i32 (i32, ...)*)(i32 %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @closef(i32 %0) {
%2 = icmp sgt i32 %0, 2
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @close to i32 (i32, ...)*)(i32 %0)
br label %5
5: ; preds = %3, %1
ret void
}
int get() {
  static unsigned int i = 1;
  return i++;
}


x86 assembly (clang, -O0):
<get>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f16(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2f0b(%rip)
pop    %rbp
ret

x86 assembly (clang, -O2):
<get>:
mov    0x2f1a(%rip),%eax
lea    0x1(%rax),%ecx
mov    %ecx,0x2f11(%rip)
ret

LLVM IR (-O0):
@get.i = internal global i32 1
define i32 @get() {
%1 = load i32, i32* @get.i
%2 = add i32 %1, 1
store i32 %2, i32* @get.i
ret i32 %1
}

LLVM IR (-O2):
@get.i = internal unnamed_addr global i32 1
define i32 @get() {
%1 = load i32, i32* @get.i
%2 = add i32 %1, 1
store i32 %2, i32* @get.i
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ conway_test();
int /*<<< orphan*/ init();
int /*<<< orphan*/ memory_cleanup();
int main() {
  init();
  conway_test();
  memory_cleanup();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <init@plt>
mov    $0x0,%al
call   1030 <conway_test@plt>
mov    $0x0,%al
call   1050 <memory_cleanup@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <init@plt>
xor    %eax,%eax
call   1030 <conway_test@plt>
xor    %eax,%eax
call   1050 <memory_cleanup@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @init()
%2 = call i32 (...) @conway_test()
%3 = call i32 (...) @memory_cleanup()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @init()
%2 = tail call i32 (...) @conway_test()
%3 = tail call i32 (...) @memory_cleanup()
ret i32 0
}
/* Variables and functions */
char *buggy(int);
int main() {
  char *p = buggy(1);
  p[0] = 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
call   1030 <buggy@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <buggy@plt>
movb   $0x0,(%rax)
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i8*
%2 = call i8* @buggy(i32 1)
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = getelementptr inbounds i8, i8* %3, i64 0
store i8 0, i8* %4
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i8* @buggy(i32 1)
store i8 0, i8* %1
ret i32 0
}
/* Type definitions */
struct wl_proxy {
  int dummy;
};
struct wl_data_offer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ wl_proxy_set_user_data(struct wl_proxy *, void *);
void wl_data_offer_set_user_data(struct wl_data_offer *wl_data_offer,
                                 void *user_data) {
  wl_proxy_set_user_data((struct wl_proxy *)wl_data_offer, user_data);
}


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

x86 assembly (clang, -O2):
<wl_data_offer_set_user_data>:
jmp    1030 <wl_proxy_set_user_data@plt>

LLVM IR (-O0):
%struct.wl_data_offer = type { i32 }
%struct.wl_proxy = type { i32 }
define void @wl_data_offer_set_user_data(%struct.wl_data_offer* %0, i8* %1) {
%3 = alloca %struct.wl_data_offer*
%4 = alloca i8*
store %struct.wl_data_offer* %0, %struct.wl_data_offer** %3
store i8* %1, i8** %4
%5 = load %struct.wl_data_offer*, %struct.wl_data_offer** %3
%6 = bitcast %struct.wl_data_offer* %5 to %struct.wl_proxy*
%7 = load i8*, i8** %4
%8 = call i32 @wl_proxy_set_user_data(%struct.wl_proxy* %6, i8* %7)
ret void
}

LLVM IR (-O2):
%struct.wl_data_offer = type { i32 }
%struct.wl_proxy = type { i32 }
define void @wl_data_offer_set_user_data(%struct.wl_data_offer* %0, i8* %1) {
%3 = bitcast %struct.wl_data_offer* %0 to %struct.wl_proxy*
%4 = tail call i32 @wl_proxy_set_user_data(%struct.wl_proxy* %3, i8* %1)
ret void
}
/* Variables and functions */
char *cst_strdup(char const *);
size_t strlen(char const *);
char *strstr(char const *, char const *);
char *cst_string_before(const char *s, const char *c) {
  char *p;
  char *q;
  p = strstr(s, c);
  q = cst_strdup(s);
  q[strlen(s) - strlen(p)] = '\0';
  return q;
}


x86 assembly (clang, -O0):
<cst_string_before>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <strstr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <cst_strdup@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x30(%rbp),%rcx
mov    %rax,%rdx
mov    -0x28(%rbp),%rax
sub    %rdx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cst_string_before>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1050 <strstr@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <cst_strdup@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
sub    %rax,%rbx
movb   $0x0,(%r15,%rbx,1)
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @cst_string_before(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = load i8*, i8** %4
%9 = call i8* @strstr(i8* %7, i8* %8)
store i8* %9, i8** %5
%10 = load i8*, i8** %3
%11 = call i8* @cst_strdup(i8* %10)
store i8* %11, i8** %6
%12 = load i8*, i8** %6
%13 = load i8*, i8** %3
%14 = call i64 @strlen(i8* %13)
%15 = load i8*, i8** %5
%16 = call i64 @strlen(i8* %15)
%17 = sub i64 %14, %16
%18 = getelementptr inbounds i8, i8* %12, i64 %17
store i8 0, i8* %18
%19 = load i8*, i8** %6
ret i8* %19
}

LLVM IR (-O2):
define i8* @cst_string_before(i8* %0, i8* nocapture %1) {
%3 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%4 = tail call i8* @cst_strdup(i8* %0)
%5 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%6 = tail call i64 @strlen(i8* dereferenceable(1) %3)
%7 = sub i64 %5, %6
%8 = getelementptr inbounds i8, i8* %4, i64 %7
store i8 0, i8* %8
ret i8* %4
}
int is_black_field(int i, int j) { return ((i + j) % 2 == 0); }


x86 assembly (clang, -O0):
<is_black_field>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_black_field>:
lea    (%rdi,%rsi,1),%eax
not    %eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @is_black_field(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
%8 = srem i32 %7, 2
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @is_black_field(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
%4 = and i32 %3, 1
%5 = xor i32 %4, 1
ret i32 %5
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  unsigned int member_1;
  int /*<<< orphan*/ member_0;
};
struct TYPE_3__ {
  int /*<<< orphan*/ member_1;
  int /*<<< orphan*/ member_0;
};
struct itimerval {
  TYPE_2__ member_1;
  TYPE_1__ member_0;
};

/* Variables and functions */
int /*<<< orphan*/ ITIMER_REAL;
scalar_t__ setitimer(int /*<<< orphan*/, struct itimerval *,
                     int /*<<< orphan*/ *);
int main() {
  struct itimerval enable = {{0, 0}, {0, 1000u}};
  if (setitimer(ITIMER_REAL, &enable, NULL))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2ea4(%rip),%rax
mov    (%rax),%edi
lea    -0x18(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <setitimer@plt>
cmp    $0x0,%rax
je     1161 <main+0x51>
movl   $0x1,-0x4(%rbp)
jmp    1168 <main+0x58>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movups 0xee5(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
xor    %edx,%edx
call   1030 <setitimer@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.itimerval = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i32, i32 }
%struct.TYPE_3__ = type { i32, i32 }
@__const.main.enable = %struct.itimerval { %struct.TYPE_4__ zeroinitializer, %struct.TYPE_3__ { i32 0, i32 1000 } }
@ITIMER_REAL = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.itimerval
store i32 0, i32* %1
%3 = bitcast %struct.itimerval* %2 to i8*
%4 = load i32, i32* @ITIMER_REAL
%5 = call i64 @setitimer(i32 %4, %struct.itimerval* %2, i32* null)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %0
store i32 1, i32* %1
br label %9
8: ; preds = %0
store i32 0, i32* %1
br label %9
9: ; preds = %8, %7
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
%struct.itimerval = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i32, i32 }
%struct.TYPE_3__ = type { i32, i32 }
@__const.main.enable = %struct.itimerval { %struct.TYPE_4__ zeroinitializer, %struct.TYPE_3__ { i32 0, i32 1000 } }
@ITIMER_REAL = global i32 0
define i32 @main() {
%1 = alloca %struct.itimerval
%2 = bitcast %struct.itimerval* %1 to i8*
%3 = load i32, i32* @ITIMER_REAL
%4 = call i64 @setitimer(i32 %3, %struct.itimerval* %1, i32* null)
%5 = icmp ne i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
char base64char(int x) {
  static const char table[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
                                "abcdefghijklmnopqrstuvwxyz"
                                "0123456789+/";
  return table[x & 63];
}


x86 assembly (clang, -O0):
<base64char>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x3f,%eax
movslq %eax,%rcx
lea    0xee9(%rip),%rax
movsbl (%rax,%rcx,1),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<base64char>:
and    $0x3f,%edi
lea    0xef6(%rip),%rax
mov    (%rdi,%rax,1),%al
ret

LLVM IR (-O0):
@base64char.table = internal constant [64 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
define signext i8 @base64char(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 63
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds [64 x i8], [64 x i8]* @base64char.table, i64 0, i64 %5
%7 = load i8, i8* %6
ret i8 %7
}

LLVM IR (-O2):
@base64char.table = internal unnamed_addr constant [64 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
define signext i8 @base64char(i32 %0) {
%2 = and i32 %0, 63
%3 = zext i32 %2 to i64
%4 = getelementptr inbounds [64 x i8], [64 x i8]* @base64char.table, i64 0, i64 %3
%5 = load i8, i8* %4
ret i8 %5
}
/* Variables and functions */
int /*<<< orphan*/ _ITM_free(void *);
void tanger_stm_free(void *ptr) { _ITM_free(ptr); }


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

x86 assembly (clang, -O2):
<tanger_stm_free>:
jmp    1030 <_ITM_free@plt>

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

LLVM IR (-O2):
define void @tanger_stm_free(i8* %0) {
%2 = tail call i32 @_ITM_free(i8* %0)
ret void
}
/* Variables and functions */
int PDCRead(int);
int /*<<< orphan*/ PDCWrite(int, int);
void PDCLCDSetPos(unsigned char ucX, unsigned char ucY) {
  ;
  ;
  while ((PDCRead(0x6) & 0x80)) {
  }
  PDCWrite(0x6, 0x80 | (0x40 * ucY) + ucX);
}


x86 assembly (clang, -O0):
<PDCLCDSetPos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    $0x6,%edi
call   1030 <PDCRead@plt>
and    $0x80,%eax
cmp    $0x0,%eax
je     1151 <PDCLCDSetPos+0x31>
jmp    1134 <PDCLCDSetPos+0x14>
movzbl -0x2(%rbp),%esi
shl    $0x6,%esi
movzbl -0x1(%rbp),%eax
add    %eax,%esi
or     $0x80,%esi
mov    $0x6,%edi
call   1040 <PDCWrite@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PDCLCDSetPos>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x6,%edi
call   1030 <PDCRead@plt>
test   $0x80,%al
jne    1130 <PDCLCDSetPos+0x10>
movzbl %bpl,%eax
shl    $0x6,%eax
movzbl %bl,%esi
add    %eax,%esi
or     $0x80,%esi
mov    $0x6,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <PDCWrite@plt>

LLVM IR (-O0):
define void @PDCLCDSetPos(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
br label %5
5: ; preds = %9, %2
%6 = call i32 @PDCRead(i32 6)
%7 = and i32 %6, 128
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %5
br label %5
10: ; preds = %5
%11 = load i8, i8* %4
%12 = zext i8 %11 to i32
%13 = mul nsw i32 64, %12
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = add nsw i32 %13, %15
%17 = or i32 128, %16
%18 = call i32 @PDCWrite(i32 6, i32 %17)
ret void
}

LLVM IR (-O2):
define void @PDCLCDSetPos(i8 zeroext %0, i8 zeroext %1) {
br label %3
3: ; preds = %3, %2
%4 = tail call i32 @PDCRead(i32 6)
%5 = and i32 %4, 128
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %3
7: ; preds = %3
%8 = zext i8 %1 to i32
%9 = shl nuw nsw i32 %8, 6
%10 = zext i8 %0 to i32
%11 = add nuw nsw i32 %9, %10
%12 = or i32 %11, 128
%13 = tail call i32 @PDCWrite(i32 6, i32 %12)
ret void
}
/* Type definitions */
struct b_tonegen {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ setMIDIDrawBar(struct b_tonegen *, int, unsigned char);
void setDrawbar26(void *d, unsigned char v) {
  setMIDIDrawBar((struct b_tonegen *)d, 26, v);
}


x86 assembly (clang, -O0):
<setDrawbar26>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1a,%esi
movzbl -0x9(%rbp),%edx
call   1030 <setMIDIDrawBar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setDrawbar26>:
mov    %esi,%edx
mov    $0x1a,%esi
jmp    1030 <setMIDIDrawBar@plt>

LLVM IR (-O0):
%struct.b_tonegen = type { i32 }
define void @setDrawbar26(i8* %0, i8 zeroext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to %struct.b_tonegen*
%7 = load i8, i8* %4
%8 = call i32 @setMIDIDrawBar(%struct.b_tonegen* %6, i32 26, i8 zeroext %7)
ret void
}

LLVM IR (-O2):
%struct.b_tonegen = type { i32 }
define void @setDrawbar26(i8* %0, i8 zeroext %1) {
%3 = bitcast i8* %0 to %struct.b_tonegen*
%4 = tail call i32 @setMIDIDrawBar(%struct.b_tonegen* %3, i32 26, i8 zeroext %1)
ret void
}
/* Variables and functions */
float atof(char *);
float fgetf() {
  char chain[64];
  fgetf(chain, 64);
  return atof(chain);
}


x86 assembly (clang, -O0):
<fgetf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x40(%rbp),%rdi
mov    $0x40,%esi
mov    $0x0,%al
call   1040 <fgetf@plt>
lea    -0x40(%rbp),%rdi
call   1030 <atof@plt>
add    $0x40,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define float @fgetf() {
%1 = alloca [64 x i8]
%2 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 0
%3 = call float (i8*, i32, ...) bitcast (float ()* @fgetf to float (i8*, i32, ...)*)(i8* %2, i32 64)
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 0
%5 = call float @atof(i8* %4)
ret float %5
}

LLVM IR (-O2):
define float @fgetf() {
br label %1
1: ; preds = %1, %0
br label %1
}
unsigned int f2(unsigned int x, long int y) {
  return (x << y) | (x >> (8 * 4 - y));
}


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

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

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

LLVM IR (-O2):
define i32 @f2(i32 %0, i64 %1) {
%3 = trunc i64 %1 to i32
%4 = shl i32 %0, %3
%5 = sub i32 32, %3
%6 = lshr i32 %0, %5
%7 = or i32 %6, %4
ret i32 %7
}
int __attribute__((stdcall)) __stub_zero_std_8(int a, int b) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @__stub_zero_std_8(i32 %0, i32 %1) {
ret i32 0
}
unsigned long BKDRHash(const char *str) {
  unsigned int seed = 131;
  unsigned long hash = 0;
  while (*str) {
    hash = hash * seed + (*str++);
  }
  return (hash & 0x7FFFFFFF);
}


x86 assembly (clang, -O0):
<BKDRHash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x83,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     114e <BKDRHash+0x4e>
mov    -0x18(%rbp),%rax
mov    -0xc(%rbp),%ecx
imul   %rcx,%rax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movsbq (%rcx),%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
jmp    1117 <BKDRHash+0x17>
mov    -0x18(%rbp),%rax
and    $0x7fffffff,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<BKDRHash>:
mov    (%rdi),%cl
test   %cl,%cl
je     112f <BKDRHash+0x2f>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
imul   $0x83,%rax,%rdx
movsbq %cl,%rax
add    %rdx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <BKDRHash+0x10>
and    $0x7fffffff,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @BKDRHash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i64 [ %11, %4 ], [ 0, %1 ]
%7 = phi i8* [ %9, %4 ], [ %0, %1 ]
%8 = mul i64 %6, 131
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = sext i8 %5 to i64
%11 = add i64 %8, %10
%12 = load i8, i8* %9
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = and i64 %11, 2147483647
br label %16
16: ; preds = %14, %1
%17 = phi i64 [ 0, %1 ], [ %15, %14 ]
ret i64 %17
}
char *encrypt(int table[], char buf[], int len) {
  int j = 0;
  char *end = buf + len;
  while (buf < end) {
    *buf = (char)table[(unsigned char)*buf];
    buf++;
  }
  return buf - len;
}


x86 assembly (clang, -O0):
<encrypt>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    115a <encrypt+0x5a>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movzbl (%rcx),%ecx
mov    (%rax,%rcx,4),%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1125 <encrypt+0x25>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<encrypt>:
mov    %rsi,%rax
movslq %edx,%r8
test   %r8d,%r8d
jle    1122 <encrypt+0x22>
lea    (%rax,%r8,1),%rdx
nop
movzbl (%rax),%esi
movzbl (%rdi,%rsi,4),%ecx
mov    %cl,(%rax)
add    $0x1,%rax
cmp    %rdx,%rax
jb     1110 <encrypt+0x10>
sub    %r8,%rax
ret

LLVM IR (-O0):
define i8* @encrypt(i32* %0, i8* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
store i32 0, i32* %7
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
store i8* %12, i8** %8
br label %13
13: ; preds = %17, %3
%14 = load i8*, i8** %5
%15 = load i8*, i8** %8
%16 = icmp ult i8* %14, %15
br i1 %16, label %17, label %28
17: ; preds = %13
%18 = load i32*, i32** %4
%19 = load i8*, i8** %5
%20 = load i8, i8* %19
%21 = zext i8 %20 to i64
%22 = getelementptr inbounds i32, i32* %18, i64 %21
%23 = load i32, i32* %22
%24 = trunc i32 %23 to i8
%25 = load i8*, i8** %5
store i8 %24, i8* %25
%26 = load i8*, i8** %5
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %5
br label %13
28: ; preds = %13
%29 = load i8*, i8** %5
%30 = load i32, i32* %6
%31 = sext i32 %30 to i64
%32 = sub i64 0, %31
%33 = getelementptr inbounds i8, i8* %29, i64 %32
ret i8* %33
}

LLVM IR (-O2):
define i8* @encrypt(i32* nocapture %0, i8* %1, i32 %2) {
%4 = sext i32 %2 to i64
%5 = getelementptr inbounds i8, i8* %1, i64 %4
%6 = icmp sgt i32 %2, 0
br i1 %6, label %7, label %16
7: ; preds = %3, %7
%8 = phi i8* [ %14, %7 ], [ %1, %3 ]
%9 = load i8, i8* %8
%10 = zext i8 %9 to i64
%11 = getelementptr inbounds i32, i32* %0, i64 %10
%12 = load i32, i32* %11
%13 = trunc i32 %12 to i8
store i8 %13, i8* %8
%14 = getelementptr inbounds i8, i8* %8, i64 1
%15 = icmp ult i8* %14, %5
br i1 %15, label %7, label %16
16: ; preds = %7, %3
%17 = phi i8* [ %1, %3 ], [ %14, %7 ]
%18 = sub nsw i64 0, %4
%19 = getelementptr inbounds i8, i8* %17, i64 %18
ret i8* %19
}
/* Variables and functions */
int /*<<< orphan*/ SIGPIPE;
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ signal(int /*<<< orphan*/, void (*)(int));
void sig_pipe(int signum) {
  printf("got it!\n");
  signal(SIGPIPE, sig_pipe);
}


x86 assembly (clang, -O0):
<sig_pipe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
mov    0x2e91(%rip),%rsi
call   1040 <signal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_pipe>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
mov    0x2e9b(%rip),%rsi
pop    %rax
jmp    1040 <signal@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"got it!\0A\00"
@SIGPIPE = global i32 0
define void @sig_pipe(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @SIGPIPE
%5 = call i32 @signal(i32 %4, void (i32)* @sig_pipe)
ret void
}

LLVM IR (-O2):
@SIGPIPE = global i32 0
@str = [8 x i8] c"got it!\00"
define void @sig_pipe(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%3 = load i32, i32* @SIGPIPE
%4 = tail call i32 @signal(i32 %3, void (i32)* @sig_pipe)
ret void
}
void XtUnrealizeWidget() {}


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

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

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

LLVM IR (-O2):
define void @XtUnrealizeWidget() {
ret void
}
int test_imm_D9int64_lowword_mem(long long *val) {
  return ((*val) & (0xD9 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_D9int64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 217
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ fexpect(char *, int, int, int);
void t1() {
  int a = 1;
  fexpect("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/decl.c",
          7, 3, a + 2);
  ;
}


x86 assembly (clang, -O0):
<t1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
add    $0x2,%ecx
lea    0xed4(%rip),%rdi
mov    $0x7,%esi
mov    $0x3,%edx
call   1030 <fexpect@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [127 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/decl.c\00"
define void @t1() {
%1 = alloca i32
store i32 1, i32* %1
%2 = load i32, i32* %1
%3 = add nsw i32 %2, 2
%4 = call i32 @fexpect(i8* getelementptr inbounds ([127 x i8], [127 x i8]* @.str, i64 0, i64 0), i32 7, i32 3, i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [127 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/decl.c\00"
define void @t1() {
%1 = tail call i32 @fexpect(i8* getelementptr inbounds ([127 x i8], [127 x i8]* @.str, i64 0, i64 0), i32 7, i32 3, i32 3)
ret void
}
/* Variables and functions */
int ioCanCreateSocketOfType(int, int);
int secCanCreateSocketOfType(int netType, int socketType) {
  return ioCanCreateSocketOfType(netType, socketType);
}


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

x86 assembly (clang, -O2):
<secCanCreateSocketOfType>:
jmp    1030 <ioCanCreateSocketOfType@plt>

LLVM IR (-O0):
define i32 @secCanCreateSocketOfType(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 = call i32 @ioCanCreateSocketOfType(i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @secCanCreateSocketOfType(i32 %0, i32 %1) {
%3 = tail call i32 @ioCanCreateSocketOfType(i32 %0, i32 %1)
ret i32 %3
}
/* Type definitions */
struct list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ list_link(struct list *, struct list *);
void list_init(struct list *node) { list_link(node, node); }


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

x86 assembly (clang, -O2):
<list_init>:
mov    %rdi,%rsi
jmp    1030 <list_link@plt>

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

LLVM IR (-O2):
%struct.list = type { i32 }
define void @list_init(%struct.list* %0) {
%2 = tail call i32 @list_link(%struct.list* %0, %struct.list* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, char const *, size_t const);
size_t min_sz(int /*<<< orphan*/, size_t);
int /*<<< orphan*/ range_sz(char const *, char const *);
size_t raw_read_buf(const char **buf_pos, const char *buf_end, void *buf_out,
                    size_t byte_sz) {
  const size_t n = min_sz(range_sz(*buf_pos, buf_end), byte_sz);
  memcpy(buf_out, *buf_pos, n);
  *buf_pos += n;
  return n;
}


x86 assembly (clang, -O0):
<raw_read_buf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <range_sz@plt>
mov    %eax,%edi
mov    -0x20(%rbp),%rsi
call   1050 <min_sz@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
mov    -0x28(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x28(%rbp),%rcx
mov    -0x8(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<raw_read_buf>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r15
mov    %rdx,%r14
mov    %rdi,%r12
mov    (%rdi),%rdi
call   1030 <range_sz@plt>
mov    %eax,%edi
mov    %r15,%rsi
call   1050 <min_sz@plt>
mov    %rax,%rbx
mov    (%r12),%rsi
mov    %r14,%rdi
mov    %rax,%rdx
call   1040 <memcpy@plt>
add    %rbx,(%r12)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @raw_read_buf(i8** %0, i8* %1, i8* %2, i64 %3) {
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i64
store i8** %0, i8*** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%10 = load i8**, i8*** %5
%11 = load i8*, i8** %10
%12 = load i8*, i8** %6
%13 = call i32 @range_sz(i8* %11, i8* %12)
%14 = load i64, i64* %8
%15 = call i64 @min_sz(i32 %13, i64 %14)
store i64 %15, i64* %9
%16 = load i8*, i8** %7
%17 = load i8**, i8*** %5
%18 = load i8*, i8** %17
%19 = load i64, i64* %9
%20 = call i32 @memcpy(i8* %16, i8* %18, i64 %19)
%21 = load i64, i64* %9
%22 = load i8**, i8*** %5
%23 = load i8*, i8** %22
%24 = getelementptr inbounds i8, i8* %23, i64 %21
store i8* %24, i8** %22
%25 = load i64, i64* %9
ret i64 %25
}

LLVM IR (-O2):
define i64 @raw_read_buf(i8** nocapture %0, i8* %1, i8* %2, i64 %3) {
%5 = load i8*, i8** %0
%6 = tail call i32 @range_sz(i8* %5, i8* %1)
%7 = tail call i64 @min_sz(i32 %6, i64 %3)
%8 = load i8*, i8** %0
%9 = tail call i32 @memcpy(i8* %2, i8* %8, i64 %7)
%10 = load i8*, i8** %0
%11 = getelementptr inbounds i8, i8* %10, i64 %7
store i8* %11, i8** %0
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void banner() {
  printf("\nFollow patern: ./heartbeat <SerialPort> <times 2 get>\n"
         "Just Another geek thing to get HeartBeat and plot!!!\n"
         "Coded By Cooler_\n"
         "coolerlab.wordpress.com\n"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [151 x i8] c"\0AFollow patern: ./heartbeat <SerialPort> <times 2 get>\0AJust Another geek thing to get HeartBeat and plot!!!\0ACoded By Cooler_\0Acoolerlab.wordpress.com\0A\0A\00"
define void @banner() {
%1 = call i32 @printf(i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [150 x i8] c"\0AFollow patern: ./heartbeat <SerialPort> <times 2 get>\0AJust Another geek thing to get HeartBeat and plot!!!\0ACoded By Cooler_\0Acoolerlab.wordpress.com\0A\00"
define void @banner() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([150 x i8], [150 x i8]* @str, i64 0, i64 0))
ret void
}
void rop3_123_1_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = *D ^ T;
  stk2 = ~stk2;
  stk1 = S & stk2;
  stk1 = ~stk1;
  *D = (stk1 & (~S)) | (*D & S);
}


x86 assembly (clang, -O0):
<rop3_123_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)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xa(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0xc(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xc(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xc(%rbp),%ecx
and    %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_123_1_0>:
not    %sil
or     %sil,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_123_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
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
%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* %8
%17 = zext i8 %16 to i32
%18 = xor i32 %17, -1
%19 = trunc i32 %18 to i8
store i8 %19, i8* %8
%20 = load i8, i8* %5
%21 = zext i8 %20 to i32
%22 = load i8, i8* %8
%23 = zext i8 %22 to i32
%24 = and i32 %21, %23
%25 = trunc i32 %24 to i8
store i8 %25, i8* %7
%26 = load i8, i8* %7
%27 = zext i8 %26 to i32
%28 = xor i32 %27, -1
%29 = trunc i32 %28 to i8
store i8 %29, i8* %7
%30 = load i8, i8* %7
%31 = zext i8 %30 to i32
%32 = load i8, i8* %5
%33 = zext i8 %32 to i32
%34 = xor i32 %33, -1
%35 = and i32 %31, %34
%36 = load i8*, i8** %4
%37 = load i8, i8* %36
%38 = zext i8 %37 to i32
%39 = load i8, i8* %5
%40 = zext i8 %39 to i32
%41 = and i32 %38, %40
%42 = or i32 %35, %41
%43 = trunc i32 %42 to i8
%44 = load i8*, i8** %4
store i8 %43, i8* %44
ret void
}

LLVM IR (-O2):
define void @rop3_123_1_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = xor i8 %1, -1
%6 = or i8 %4, %5
store i8 %6, i8* %0
ret void
}