int mkrep(mach, lb, ub)
int mach, lb, ub;
{
  int base_mach, tail, copy, i;
  base_mach = copysingl(mach, lb - 1);
  if (ub == -1) {
    copy = dupmachine(mach);
    mach = link_machines(mach, link_machines(base_mach, mkclos(copy)));
  } else {
    tail = mkstate((256 + 1));
    for (i = lb; i < ub; ++i) {
      copy = dupmachine(mach);
      tail = mkopt(link_machines(copy, tail));
    }
    mach = link_machines(mach, link_machines(base_mach, tail));
  }
  return (mach);
}


x86 assembly (clang, -O0):
<mkrep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
mov    $0x0,%al
call   1030 <copysingl@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    11d1 <mkrep+0x71>
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1070 <dupmachine@plt>
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%edi
mov    $0x0,%al
call   1060 <mkclos@plt>
mov    -0x24(%rbp),%edi
mov    %eax,%esi
mov    $0x0,%al
call   1080 <link_machines@plt>
mov    -0x20(%rbp),%edi
mov    %eax,%esi
mov    $0x0,%al
call   1080 <link_machines@plt>
mov    %eax,-0x4(%rbp)
jmp    1248 <mkrep+0xe8>
mov    $0x101,%edi
mov    $0x0,%al
call   1050 <mkstate@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1226 <mkrep+0xc6>
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1070 <dupmachine@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    $0x0,%al
call   1080 <link_machines@plt>
mov    %eax,%edi
mov    $0x0,%al
call   1040 <mkopt@plt>
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11e6 <mkrep+0x86>
mov    -0x4(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    $0x0,%al
call   1080 <link_machines@plt>
mov    -0x28(%rbp),%edi
mov    %eax,%esi
mov    $0x0,%al
call   1080 <link_machines@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkrep>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%ebp
mov    %esi,%r12d
mov    %edi,%r15d
lea    -0x1(%r12),%esi
xor    %eax,%eax
call   1030 <copysingl@plt>
mov    %eax,%r14d
cmp    $0xffffffff,%ebp
je     11c7 <mkrep+0x67>
mov    $0x101,%edi
xor    %eax,%eax
call   1050 <mkstate@plt>
mov    %eax,%ebx
cmp    %ebp,%r12d
jge    11dc <mkrep+0x7c>
sub    %r12d,%ebp
nopw   0x0(%rax,%rax,1)
mov    %r15d,%edi
xor    %eax,%eax
call   1070 <dupmachine@plt>
mov    %eax,%edi
mov    %ebx,%esi
xor    %eax,%eax
call   1080 <link_machines@plt>
mov    %eax,%edi
xor    %eax,%eax
call   1040 <mkopt@plt>
mov    %eax,%ebx
add    $0xffffffff,%ebp
jne    11a0 <mkrep+0x40>
jmp    11dc <mkrep+0x7c>
mov    %r15d,%edi
xor    %eax,%eax
call   1070 <dupmachine@plt>
mov    %eax,%edi
xor    %eax,%eax
call   1060 <mkclos@plt>
mov    %eax,%ebx
mov    %r14d,%edi
mov    %ebx,%esi
xor    %eax,%eax
call   1080 <link_machines@plt>
mov    %r15d,%edi
mov    %eax,%esi
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1080 <link_machines@plt>

LLVM IR (-O0):
define i32 @mkrep(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = sub nsw i32 %12, 1
%14 = call i32 (i32, i32, ...) bitcast (i32 (...)* @copysingl to i32 (i32, i32, ...)*)(i32 %11, i32 %13)
store i32 %14, i32* %7
%15 = load i32, i32* %6
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %26
17: ; preds = %3
%18 = load i32, i32* %4
%19 = call i32 (i32, ...) bitcast (i32 (...)* @dupmachine to i32 (i32, ...)*)(i32 %18)
store i32 %19, i32* %9
%20 = load i32, i32* %4
%21 = load i32, i32* %7
%22 = load i32, i32* %9
%23 = call i32 (i32, ...) bitcast (i32 (...)* @mkclos to i32 (i32, ...)*)(i32 %22)
%24 = call i32 (i32, i32, ...) bitcast (i32 (...)* @link_machines to i32 (i32, i32, ...)*)(i32 %21, i32 %23)
%25 = call i32 (i32, i32, ...) bitcast (i32 (...)* @link_machines to i32 (i32, i32, ...)*)(i32 %20, i32 %24)
store i32 %25, i32* %4
br label %49
26: ; preds = %3
%27 = call i32 (i32, ...) bitcast (i32 (...)* @mkstate to i32 (i32, ...)*)(i32 257)
store i32 %27, i32* %8
%28 = load i32, i32* %5
store i32 %28, i32* %10
br label %29
29: ; preds = %40, %26
%30 = load i32, i32* %10
%31 = load i32, i32* %6
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %43
33: ; preds = %29
%34 = load i32, i32* %4
%35 = call i32 (i32, ...) bitcast (i32 (...)* @dupmachine to i32 (i32, ...)*)(i32 %34)
store i32 %35, i32* %9
%36 = load i32, i32* %9
%37 = load i32, i32* %8
%38 = call i32 (i32, i32, ...) bitcast (i32 (...)* @link_machines to i32 (i32, i32, ...)*)(i32 %36, i32 %37)
%39 = call i32 (i32, ...) bitcast (i32 (...)* @mkopt to i32 (i32, ...)*)(i32 %38)
store i32 %39, i32* %8
br label %40
40: ; preds = %33
%41 = load i32, i32* %10
%42 = add nsw i32 %41, 1
store i32 %42, i32* %10
br label %29
43: ; preds = %29
%44 = load i32, i32* %4
%45 = load i32, i32* %7
%46 = load i32, i32* %8
%47 = call i32 (i32, i32, ...) bitcast (i32 (...)* @link_machines to i32 (i32, i32, ...)*)(i32 %45, i32 %46)
%48 = call i32 (i32, i32, ...) bitcast (i32 (...)* @link_machines to i32 (i32, i32, ...)*)(i32 %44, i32 %47)
store i32 %48, i32* %4
br label %49
49: ; preds = %43, %17
%50 = load i32, i32* %4
ret i32 %50
}

LLVM IR (-O2):
define i32 @mkrep(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, -1
%5 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @copysingl to i32 (i32, i32, ...)*)(i32 %0, i32 %4)
%6 = icmp eq i32 %2, -1
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = tail call i32 (i32, ...) bitcast (i32 (...)* @dupmachine to i32 (i32, ...)*)(i32 %0)
%9 = tail call i32 (i32, ...) bitcast (i32 (...)* @mkclos to i32 (i32, ...)*)(i32 %8)
br label %21
10: ; preds = %3
%11 = tail call i32 (i32, ...) bitcast (i32 (...)* @mkstate to i32 (i32, ...)*)(i32 257)
%12 = icmp slt i32 %1, %2
br i1 %12, label %13, label %21
13: ; preds = %10, %13
%14 = phi i32 [ %19, %13 ], [ %1, %10 ]
%15 = phi i32 [ %18, %13 ], [ %11, %10 ]
%16 = tail call i32 (i32, ...) bitcast (i32 (...)* @dupmachine to i32 (i32, ...)*)(i32 %0)
%17 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @link_machines to i32 (i32, i32, ...)*)(i32 %16, i32 %15)
%18 = tail call i32 (i32, ...) bitcast (i32 (...)* @mkopt to i32 (i32, ...)*)(i32 %17)
%19 = add i32 %14, 1
%20 = icmp eq i32 %19, %2
br i1 %20, label %21, label %13
21: ; preds = %13, %10, %7
%22 = phi i32 [ %9, %7 ], [ %11, %10 ], [ %18, %13 ]
%23 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @link_machines to i32 (i32, i32, ...)*)(i32 %5, i32 %22)
%24 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @link_machines to i32 (i32, i32, ...)*)(i32 %0, i32 %23)
ret i32 %24
}