#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 */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
int find_iso(int *, int, int *, int, int *, int, int, int, int, int, int, int);
int /*<<< orphan*/ populate_candidates(int, int *, int *, int, int *, int);
uint16_t find_iso_from_start(uint16_t start, uint8_t n, uint8_t min_hd,
                             uint8_t min_iso, uint16_t a_len,
                             uint16_t min_b_len) {
  uint16_t code[(1 << 16)];
  uint16_t next_candidates[(1 << 16)];
  uint16_t next_b_candidates[(1 << 16)];
  uint16_t icand = 1 << n;
  uint16_t candidates[icand];
  int i;
  uint16_t nc, bc;
  uint16_t inext_cand = 0;
  uint16_t inext_b_cand = 0;
  code[0] = start;
  for (i = 0; i < icand; i++)
    candidates[i] = i;
  populate_candidates(start, candidates, next_candidates, icand, &inext_cand,
                      min_hd);
  populate_candidates(start, candidates, next_b_candidates, icand,
                      &inext_b_cand, min_iso);
  return find_iso(&code[0], 1, &next_candidates[0], inext_cand,
                  &next_b_candidates[0], inext_b_cand, min_hd, min_iso, a_len,
                  min_b_len, n, a_len + min_b_len);
}


x86 assembly (clang, -O0):
<find_iso_from_start>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
sub    $0xc0058,%rsp
mov    %edi,-0x1c(%rbp)
mov    %esi,-0x20(%rbp)
mov    %edx,-0x24(%rbp)
mov    %ecx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
mov    %r9d,-0x30(%rbp)
mov    -0x20(%rbp),%cl
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0xc0034(%rbp)
mov    -0xc0034(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0xc0040(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xc0068(%rbp)
mov    %rcx,%rsp
mov    %rax,-0xc0048(%rbp)
movl   $0x0,-0xc0058(%rbp)
movl   $0x0,-0xc005c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x40030(%rbp)
movl   $0x0,-0xc004c(%rbp)
mov    -0xc004c(%rbp),%eax
cmp    -0xc0034(%rbp),%eax
jge    11eb <find_iso_from_start+0xcb>
mov    -0xc0068(%rbp),%rax
mov    -0xc004c(%rbp),%edx
movslq -0xc004c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xc004c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc004c(%rbp)
jmp    11ae <find_iso_from_start+0x8e>
mov    -0xc0068(%rbp),%rsi
mov    -0x1c(%rbp),%edi
lea    -0x80030(%rbp),%rdx
mov    -0xc0034(%rbp),%ecx
mov    -0x24(%rbp),%r9d
lea    -0xc0058(%rbp),%r8
call   1040 <populate_candidates@plt>
mov    -0xc0068(%rbp),%rsi
mov    -0x1c(%rbp),%edi
lea    -0xc0030(%rbp),%rdx
mov    -0xc0034(%rbp),%ecx
mov    -0x28(%rbp),%r9d
lea    -0xc005c(%rbp),%r8
call   1040 <populate_candidates@plt>
lea    -0x40030(%rbp),%rdi
lea    -0x80030(%rbp),%rdx
mov    -0xc0058(%rbp),%ecx
lea    -0xc0030(%rbp),%r8
mov    -0xc005c(%rbp),%r9d
mov    -0x24(%rbp),%r15d
mov    -0x28(%rbp),%r14d
mov    -0x2c(%rbp),%ebx
mov    -0x30(%rbp),%r11d
mov    -0x20(%rbp),%r10d
mov    -0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
mov    $0x1,%esi
sub    $0x30,%rsp
mov    %r15d,(%rsp)
mov    %r14d,0x8(%rsp)
mov    %ebx,0x10(%rsp)
mov    %r11d,0x18(%rsp)
mov    %r10d,0x20(%rsp)
mov    %eax,0x28(%rsp)
call   1030 <find_iso@plt>
add    $0x30,%rsp
mov    -0xc0040(%rbp),%rcx
mov    %rcx,%rsp
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_iso_from_start>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc0038,%rsp
mov    %rcx,-0x58(%rbp)
mov    $0x1,%r14d
mov    %esi,%ecx
shl    %cl,%r14d
mov    %r9,-0x38(%rbp)
mov    %r8,-0x40(%rbp)
mov    %edx,%r13d
mov    %edi,%ebx
mov    %rsp,-0x50(%rbp)
mov    $0x1,%eax
lea    0xf(,%r14,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%r12
sub    %rcx,%r12
mov    %r12,%rsp
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    %edi,-0x80060(%rbp)
mov    %rsi,-0x48(%rbp)
cmp    $0x1f,%esi
je     131d <find_iso_from_start+0x1fd>
cmp    $0x2,%r14d
cmovge %r14d,%eax
cmp    $0x8,%eax
jae    11a3 <find_iso_from_start+0x83>
xor    %ecx,%ecx
jmp    1310 <find_iso_from_start+0x1f0>
mov    %eax,%ecx
and    $0x7ffffff8,%ecx
lea    -0x8(%rcx),%rdi
mov    %rdi,%rsi
shr    $0x3,%rsi
add    $0x1,%rsi
mov    %esi,%edx
and    $0x3,%edx
cmp    $0x18,%rdi
jae    11d4 <find_iso_from_start+0xb4>
movdqa 0xe33(%rip),%xmm0
xor    %edi,%edi
jmp    12b0 <find_iso_from_start+0x190>
and    $0xfffffffffffffffc,%rsi
movdqa 0xe20(%rip),%xmm0
xor    %edi,%edi
movdqa 0xe25(%rip),%xmm8
movdqa 0xe2c(%rip),%xmm9
movdqa 0xe33(%rip),%xmm10
movdqa 0xe3b(%rip),%xmm4
movdqa 0xe43(%rip),%xmm5
movdqa 0xe4b(%rip),%xmm6
movdqa 0xe53(%rip),%xmm7
movdqa 0xe5b(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
nop
movdqa %xmm0,%xmm2
paddd  %xmm8,%xmm2
movdqa %xmm0,(%r12,%rdi,4)
movdqa %xmm2,0x10(%r12,%rdi,4)
movdqa %xmm0,%xmm2
paddd  %xmm9,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm10,%xmm3
movdqa %xmm2,0x20(%r12,%rdi,4)
movdqa %xmm3,0x30(%r12,%rdi,4)
movdqa %xmm0,%xmm2
paddd  %xmm4,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm5,%xmm3
movdqa %xmm2,0x40(%r12,%rdi,4)
movdqa %xmm3,0x50(%r12,%rdi,4)
movdqa %xmm0,%xmm2
paddd  %xmm6,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm7,%xmm3
movdqa %xmm2,0x60(%r12,%rdi,4)
movdqa %xmm3,0x70(%r12,%rdi,4)
add    $0x20,%rdi
paddd  %xmm1,%xmm0
add    $0xfffffffffffffffc,%rsi
jne    1230 <find_iso_from_start+0x110>
test   %rdx,%rdx
je     1300 <find_iso_from_start+0x1e0>
lea    (%r12,%rdi,4),%rsi
add    $0x10,%rsi
shl    $0x5,%rdx
xor    %edi,%edi
movdqa 0xd45(%rip),%xmm1
movdqa 0xd4d(%rip),%xmm2
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movdqa %xmm0,%xmm3
paddd  %xmm1,%xmm3
movdqa %xmm0,-0x10(%rsi,%rdi,1)
movdqa %xmm3,(%rsi,%rdi,1)
paddd  %xmm2,%xmm0
add    $0x20,%rdi
cmp    %rdi,%rdx
jne    12e0 <find_iso_from_start+0x1c0>
cmp    %rax,%rcx
je     131d <find_iso_from_start+0x1fd>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ecx,(%r12,%rcx,4)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1310 <find_iso_from_start+0x1f0>
lea    -0x40060(%rbp),%rdx
lea    -0x30(%rbp),%r8
mov    %ebx,%edi
mov    %r12,%rsi
mov    %r14d,%ecx
mov    %r13d,%r9d
call   1040 <populate_candidates@plt>
lea    -0xc0060(%rbp),%r15
lea    -0x2c(%rbp),%r8
mov    %ebx,%edi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %r14d,%ecx
mov    -0x58(%rbp),%r14
mov    %r14d,%r9d
call   1040 <populate_candidates@plt>
mov    -0x30(%rbp),%ecx
mov    -0x2c(%rbp),%r9d
mov    -0x40(%rbp),%rax
mov    -0x38(%rbp),%rbx
lea    (%rbx,%rax,1),%r10d
lea    -0x80060(%rbp),%rdi
mov    $0x1,%esi
lea    -0x40060(%rbp),%rdx
mov    %r15,%r8
push   %r10
push   -0x48(%rbp)
push   %rbx
push   %rax
push   %r14
push   %r13
call   1030 <find_iso@plt>
add    $0x30,%rsp
mov    -0x50(%rbp),%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @find_iso_from_start(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca [65536 x i32]
%14 = alloca [65536 x i32]
%15 = alloca [65536 x i32]
%16 = alloca i32
%17 = alloca i8*
%18 = alloca i64
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%24 = load i32, i32* %8
%25 = shl i32 1, %24
store i32 %25, i32* %16
%26 = load i32, i32* %16
%27 = zext i32 %26 to i64
%28 = call i8* @llvm.stacksave()
store i8* %28, i8** %17
%29 = alloca i32, i64 %27
store i64 %27, i64* %18
store i32 0, i32* %22
store i32 0, i32* %23
%30 = load i32, i32* %7
%31 = getelementptr inbounds [65536 x i32], [65536 x i32]* %13, i64 0, i64 0
store i32 %30, i32* %31
store i32 0, i32* %19
br label %32
32: ; preds = %41, %6
%33 = load i32, i32* %19
%34 = load i32, i32* %16
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %44
36: ; preds = %32
%37 = load i32, i32* %19
%38 = load i32, i32* %19
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i32, i32* %29, i64 %39
store i32 %37, i32* %40
br label %41
41: ; preds = %36
%42 = load i32, i32* %19
%43 = add nsw i32 %42, 1
store i32 %43, i32* %19
br label %32
44: ; preds = %32
%45 = load i32, i32* %7
%46 = getelementptr inbounds [65536 x i32], [65536 x i32]* %14, i64 0, i64 0
%47 = load i32, i32* %16
%48 = load i32, i32* %9
%49 = call i32 @populate_candidates(i32 %45, i32* %29, i32* %46, i32 %47, i32* %22, i32 %48)
%50 = load i32, i32* %7
%51 = getelementptr inbounds [65536 x i32], [65536 x i32]* %15, i64 0, i64 0
%52 = load i32, i32* %16
%53 = load i32, i32* %10
%54 = call i32 @populate_candidates(i32 %50, i32* %29, i32* %51, i32 %52, i32* %23, i32 %53)
%55 = getelementptr inbounds [65536 x i32], [65536 x i32]* %13, i64 0, i64 0
%56 = getelementptr inbounds [65536 x i32], [65536 x i32]* %14, i64 0, i64 0
%57 = load i32, i32* %22
%58 = getelementptr inbounds [65536 x i32], [65536 x i32]* %15, i64 0, i64 0
%59 = load i32, i32* %23
%60 = load i32, i32* %9
%61 = load i32, i32* %10
%62 = load i32, i32* %11
%63 = load i32, i32* %12
%64 = load i32, i32* %8
%65 = load i32, i32* %11
%66 = load i32, i32* %12
%67 = add nsw i32 %65, %66
%68 = call i32 @find_iso(i32* %55, i32 1, i32* %56, i32 %57, i32* %58, i32 %59, i32 %60, i32 %61, i32 %62, i32 %63, i32 %64, i32 %67)
%69 = load i8*, i8** %17
ret i32 %68
}

LLVM IR (-O2):
define i32 @find_iso_from_start(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca [65536 x i32]
%8 = alloca [65536 x i32]
%9 = alloca [65536 x i32]
%10 = alloca i32
%11 = alloca i32
%12 = bitcast [65536 x i32]* %7 to i8*
%13 = bitcast [65536 x i32]* %8 to i8*
%14 = bitcast [65536 x i32]* %9 to i8*
%15 = shl nuw i32 1, %1
%16 = zext i32 %15 to i64
%17 = tail call i8* @llvm.stacksave()
%18 = alloca i32, i64 %16
%19 = bitcast i32* %10 to i8*
store i32 0, i32* %10
%20 = bitcast i32* %11 to i8*
store i32 0, i32* %11
%21 = getelementptr inbounds [65536 x i32], [65536 x i32]* %7, i64 0, i64 0
store i32 %0, i32* %21
%22 = icmp eq i32 %1, 31
br i1 %22, label %97, label %23
23: ; preds = %6
%24 = call i32 @llvm.smax.i32(i32 %15, i32 1)
%25 = zext i32 %24 to i64
%26 = icmp ult i32 %24, 8
br i1 %26, label %89, label %27
27: ; preds = %23
%28 = and i64 %25, 2147483640
%29 = add nsw i64 %28, -8
%30 = lshr exact i64 %29, 3
%31 = add nuw nsw i64 %30, 1
%32 = and i64 %31, 3
%33 = icmp ult i64 %29, 24
br i1 %33, label %70, label %34
34: ; preds = %27
%35 = and i64 %31, 4611686018427387900
br label %36
36: ; preds = %36, %34
%37 = phi i64 [ 0, %34 ], [ %66, %36 ]
%38 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %34 ], [ %67, %36 ]
%39 = phi i64 [ 0, %34 ], [ %68, %36 ]
%40 = add <4 x i32> %38, <i32 4, i32 4, i32 4, i32 4>
%41 = getelementptr inbounds i32, i32* %18, i64 %37
%42 = bitcast i32* %41 to <4 x i32>*
store <4 x i32> %38, <4 x i32>* %42
%43 = getelementptr inbounds i32, i32* %41, i64 4
%44 = bitcast i32* %43 to <4 x i32>*
store <4 x i32> %40, <4 x i32>* %44
%45 = or i64 %37, 8
%46 = add <4 x i32> %38, <i32 8, i32 8, i32 8, i32 8>
%47 = add <4 x i32> %38, <i32 12, i32 12, i32 12, i32 12>
%48 = getelementptr inbounds i32, i32* %18, i64 %45
%49 = bitcast i32* %48 to <4 x i32>*
store <4 x i32> %46, <4 x i32>* %49
%50 = getelementptr inbounds i32, i32* %48, i64 4
%51 = bitcast i32* %50 to <4 x i32>*
store <4 x i32> %47, <4 x i32>* %51
%52 = or i64 %37, 16
%53 = add <4 x i32> %38, <i32 16, i32 16, i32 16, i32 16>
%54 = add <4 x i32> %38, <i32 20, i32 20, i32 20, i32 20>
%55 = getelementptr inbounds i32, i32* %18, i64 %52
%56 = bitcast i32* %55 to <4 x i32>*
store <4 x i32> %53, <4 x i32>* %56
%57 = getelementptr inbounds i32, i32* %55, i64 4
%58 = bitcast i32* %57 to <4 x i32>*
store <4 x i32> %54, <4 x i32>* %58
%59 = or i64 %37, 24
%60 = add <4 x i32> %38, <i32 24, i32 24, i32 24, i32 24>
%61 = add <4 x i32> %38, <i32 28, i32 28, i32 28, i32 28>
%62 = getelementptr inbounds i32, i32* %18, i64 %59
%63 = bitcast i32* %62 to <4 x i32>*
store <4 x i32> %60, <4 x i32>* %63
%64 = getelementptr inbounds i32, i32* %62, i64 4
%65 = bitcast i32* %64 to <4 x i32>*
store <4 x i32> %61, <4 x i32>* %65
%66 = add nuw i64 %37, 32
%67 = add <4 x i32> %38, <i32 32, i32 32, i32 32, i32 32>
%68 = add i64 %39, 4
%69 = icmp eq i64 %68, %35
br i1 %69, label %70, label %36
70: ; preds = %36, %27
%71 = phi i64 [ 0, %27 ], [ %66, %36 ]
%72 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %27 ], [ %67, %36 ]
%73 = icmp eq i64 %32, 0
br i1 %73, label %87, label %74
74: ; preds = %70, %74
%75 = phi i64 [ %83, %74 ], [ %71, %70 ]
%76 = phi <4 x i32> [ %84, %74 ], [ %72, %70 ]
%77 = phi i64 [ %85, %74 ], [ 0, %70 ]
%78 = add <4 x i32> %76, <i32 4, i32 4, i32 4, i32 4>
%79 = getelementptr inbounds i32, i32* %18, i64 %75
%80 = bitcast i32* %79 to <4 x i32>*
store <4 x i32> %76, <4 x i32>* %80
%81 = getelementptr inbounds i32, i32* %79, i64 4
%82 = bitcast i32* %81 to <4 x i32>*
store <4 x i32> %78, <4 x i32>* %82
%83 = add nuw i64 %75, 8
%84 = add <4 x i32> %76, <i32 8, i32 8, i32 8, i32 8>
%85 = add i64 %77, 1
%86 = icmp eq i64 %85, %32
br i1 %86, label %87, label %74
87: ; preds = %74, %70
%88 = icmp eq i64 %28, %25
br i1 %88, label %97, label %89
89: ; preds = %23, %87
%90 = phi i64 [ 0, %23 ], [ %28, %87 ]
br label %91
91: ; preds = %89, %91
%92 = phi i64 [ %95, %91 ], [ %90, %89 ]
%93 = getelementptr inbounds i32, i32* %18, i64 %92
%94 = trunc i64 %92 to i32
store i32 %94, i32* %93
%95 = add nuw nsw i64 %92, 1
%96 = icmp eq i64 %95, %25
br i1 %96, label %97, label %91
97: ; preds = %91, %87, %6
%98 = getelementptr inbounds [65536 x i32], [65536 x i32]* %8, i64 0, i64 0
%99 = call i32 @populate_candidates(i32 %0, i32* %18, i32* %98, i32 %15, i32* %10, i32 %2)
%100 = getelementptr inbounds [65536 x i32], [65536 x i32]* %9, i64 0, i64 0
%101 = call i32 @populate_candidates(i32 %0, i32* %18, i32* %100, i32 %15, i32* %11, i32 %3)
%102 = load i32, i32* %10
%103 = load i32, i32* %11
%104 = add nsw i32 %5, %4
%105 = call i32 @find_iso(i32* %21, i32 1, i32* %98, i32 %102, i32* %100, i32 %103, i32 %2, i32 %3, i32 %4, i32 %5, i32 %1, i32 %104)
ret i32 %105
}