#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
char *emit_copy_less_than64(char *, int, int);
char *emit_copy(char *op, int offset, int len) {
  while (len >= 68) {
    op = emit_copy_less_than64(op, offset, 64);
    len -= 64;
  }
  if (len > 64) {
    op = emit_copy_less_than64(op, offset, 60);
    len -= 60;
  }
  op = emit_copy_less_than64(op, offset, len);
  return op;
}


x86 assembly (clang, -O0):
<emit_copy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x44,-0x10(%rbp)
jl     114f <emit_copy+0x3f>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    $0x40,%edx
call   1030 <emit_copy_less_than64@plt>
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
sub    $0x40,%eax
mov    %eax,-0x10(%rbp)
jmp    1122 <emit_copy+0x12>
cmpl   $0x40,-0x10(%rbp)
jle    1177 <emit_copy+0x67>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    $0x3c,%edx
call   1030 <emit_copy_less_than64@plt>
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
sub    $0x3c,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <emit_copy_less_than64@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_copy>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%r14d
mov    %rdi,%rax
cmp    $0x44,%edx
jl     1176 <emit_copy+0x66>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rax,%rdi
mov    %r14d,%esi
mov    $0x40,%edx
call   1030 <emit_copy_less_than64@plt>
lea    -0x40(%rbx),%ebp
cmp    $0x83,%ebx
mov    %ebp,%ebx
ja     1130 <emit_copy+0x20>
cmp    $0x41,%ebp
jl     1165 <emit_copy+0x55>
mov    %rax,%rdi
mov    %r14d,%esi
mov    $0x3c,%edx
call   1030 <emit_copy_less_than64@plt>
add    $0xffffffc4,%ebp
mov    %rax,%rdi
mov    %r14d,%esi
mov    %ebp,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <emit_copy_less_than64@plt>
mov    %ebx,%ebp
cmp    $0x41,%ebp
jge    1152 <emit_copy+0x42>
jmp    1165 <emit_copy+0x55>

LLVM IR (-O0):
define i8* @emit_copy(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
br label %7
7: ; preds = %10, %3
%8 = load i32, i32* %6
%9 = icmp sge i32 %8, 68
br i1 %9, label %10, label %16
10: ; preds = %7
%11 = load i8*, i8** %4
%12 = load i32, i32* %5
%13 = call i8* @emit_copy_less_than64(i8* %11, i32 %12, i32 64)
store i8* %13, i8** %4
%14 = load i32, i32* %6
%15 = sub nsw i32 %14, 64
store i32 %15, i32* %6
br label %7
16: ; preds = %7
%17 = load i32, i32* %6
%18 = icmp sgt i32 %17, 64
br i1 %18, label %19, label %25
19: ; preds = %16
%20 = load i8*, i8** %4
%21 = load i32, i32* %5
%22 = call i8* @emit_copy_less_than64(i8* %20, i32 %21, i32 60)
store i8* %22, i8** %4
%23 = load i32, i32* %6
%24 = sub nsw i32 %23, 60
store i32 %24, i32* %6
br label %25
25: ; preds = %19, %16
%26 = load i8*, i8** %4
%27 = load i32, i32* %5
%28 = load i32, i32* %6
%29 = call i8* @emit_copy_less_than64(i8* %26, i32 %27, i32 %28)
store i8* %29, i8** %4
%30 = load i8*, i8** %4
ret i8* %30
}

LLVM IR (-O2):
define i8* @emit_copy(i8* %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, 67
br i1 %4, label %5, label %11
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ %2, %3 ]
%7 = phi i8* [ %8, %5 ], [ %0, %3 ]
%8 = tail call i8* @emit_copy_less_than64(i8* %7, i32 %1, i32 64)
%9 = add nsw i32 %6, -64
%10 = icmp ugt i32 %6, 131
br i1 %10, label %5, label %11
11: ; preds = %5, %3
%12 = phi i8* [ %0, %3 ], [ %8, %5 ]
%13 = phi i32 [ %2, %3 ], [ %9, %5 ]
%14 = icmp sgt i32 %13, 64
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = tail call i8* @emit_copy_less_than64(i8* %12, i32 %1, i32 60)
%17 = add nsw i32 %13, -60
br label %18
18: ; preds = %15, %11
%19 = phi i8* [ %16, %15 ], [ %12, %11 ]
%20 = phi i32 [ %17, %15 ], [ %13, %11 ]
%21 = tail call i8* @emit_copy_less_than64(i8* %19, i32 %1, i32 %20)
ret i8* %21
}