// File: /workspace/github_c_makefile_star2_O1/mishun[P]plantri/fullgen.c
// Function: baue_kuppe
void baue_kuppe(PLANMAP map, int bblaenge, FLAECHENTYP code[], KANTE **anfang, int flaechenzahl)
{
int i, puffer, codestelle, zaehler, flaechenzaehler;
KANTE *run;



puffer=2*bblaenge;

if (*anfang==nil) /* d.h. Bauchbinde und obere Kuppe bauen und Anfang zurueckgeben */
  { 
        map[1][0].name=puffer; map[1][0].invers=map[puffer]+1;
	map[1][1].name=aussen; map[1][1].invers=nil;
	map[1][2].name=2; map[1][2].invers=map[2];

   for (i=2; i<2*bblaenge; i++)
      { map[i][0].name=i-1; map[i][0].invers=map[i-1]+2;
	map[i][1].name=i+1; map[i][1].invers=map[i+1];
	map[i][2].name=aussen; map[i][2].invers=nil;
	i++;
        map[i][0].name=i-1; map[i][0].invers=map[i-1]+1;
	map[i][1].name=aussen; map[i][1].invers=nil;
	map[i][2].name=i+1; map[i][2].invers=map[i+1];
      }
	map[puffer][0].name=puffer-1; map[puffer][0].invers=map[puffer-1]+2;
	map[puffer][1].name=1; map[puffer][1].invers=map[1];
	map[puffer][2].name=aussen; map[puffer][2].invers=nil;
	
	map[0][0].name= puffer;
	*anfang=map[2]+2;

	for (run=map[1]+1, zaehler=1; zaehler<= bblaenge*code[0]; zaehler++ )
	  { add_polygon_invers(6, map, run, &run);
	    if (run==nil) { fprintf(stderr,"ERROR: nil-edge while building hexagon rings\n");
			    exit(88); }
	  } 
	flaechenzaehler=zaehler;
	for (codestelle=2, zaehler=1; run != nil; zaehler++, flaechenzaehler++ )
	  { 
	    if ((codestelle<8) && (code[codestelle]==zaehler))
	      { add_polygon_invers(5, map, run, &run); codestelle++; }
	    else add_polygon_invers(6, map, run, &run);
	  } 
        if (flaechenzaehler != flaechenzahl) 
	  { fprintf(stderr,"Baue_Kuppe: Could not insert enough faces: ");
	    fprintf(stderr,"%d instead of %d\n (upper half)\n",flaechenzaehler,flaechenzahl);
	    exit(89); }
      } /* ende if *anfang==nil) */
else /* d.h. untere Kuppe bauen */
  {
  for (run= *anfang, zaehler=1; zaehler <= bblaenge*code[0]; zaehler++ )
      { add_polygon_invers(6, map, run, &run);
	if (run==nil) { fprintf(stderr,"ERROR: nil-edge while building hexagon rings\n");
    		    exit(90); }
      } 
    flaechenzaehler=zaehler;
    for (codestelle=2, zaehler=1; run != nil; zaehler++, flaechenzaehler++ )
      { if ((codestelle<8) && (code[codestelle]==zaehler))
          { add_polygon_invers(5, map, run, &run); codestelle++; }
        else add_polygon_invers(6, map, run, &run);
      }
        if (flaechenzaehler != flaechenzahl) 
	  { fprintf(stderr,"Baue_Kuppe: Could not insert enough faces: ");
	    fprintf(stderr,"%d instead of %d\n (upper half)\n",flaechenzaehler,flaechenzahl);
	    exit(91); }
  } /* ende else */

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movl %esi, %r12d
movq %rdi, %r15
movq (%rcx), %rax
testq %rax, %rax
movl %r8d, 0xc(%rsp)
je 0xc92b
movq %rax, (%rsp)
movzbl (%r14), %eax
imull %r12d, %eax
testl %eax, %eax
jle 0xcae3
xorl %ebp, %ebp
movq %rsp, %r13
movq (%rsp), %rdx
movl $0x6, %edi
movq %r15, %rsi
movq %r13, %rcx
callq 0xc51c
cmpq $0x0, (%rsp)
je 0xcbc9
movzbl (%r14), %eax
imull %r12d, %eax
incl %ebp
cmpl %eax, %ebp
jl 0xc8f7
incl %ebp
jmp 0xcae8
leal (%r12,%r12), %eax
leaq 0x90(%r15), %rdx
movq %rdx, 0x10(%rsp)
movw %ax, 0x92(%r15)
movslq %eax, %rsi
leaq (%rsi,%rsi,8), %rsi
shlq $0x4, %rsi
leaq (%r15,%rsi), %rdi
addq %r15, %rsi
addq $0x30, %rsi
movq %rsi, 0xb8(%r15)
leaq 0xc0(%r15), %rsi
movw $0x246, 0xc2(%r15)      # imm = 0x246
movq $0x0, 0xe8(%r15)
movw $0x2, 0xf2(%r15)
leaq 0x120(%r15), %r8
movq %r8, 0x118(%r15)
cmpl $0x2, %r12d
jl 0xca4c
movl %eax, %r8d
movl $0x2, %r9d
movw $0x4, %r10w
movw $0x246, %r11w           # imm = 0x246
xorl %ebx, %ebx
movq %r15, %r13
leal -0x3(%r10), %ebp
movw %bp, 0x122(%r13)
leaq 0xf0(%r13), %rbp
movq %rbp, 0x148(%r13)
leal -0x1(%r10), %ebp
leaq 0x150(%r13), %rdx
movw %bp, 0x152(%r13)
leaq 0x1b0(%r13), %rbp
movq %rbp, 0x178(%r13)
movw %r11w, 0x182(%r13)
movq %rbx, 0x1a8(%r13)
movw %r9w, 0x1b2(%r13)
movq %rdx, 0x1d8(%r13)
movw %r11w, 0x1e2(%r13)
movq %rbx, 0x208(%r13)
addq $0x2, %r9
movw %r10w, 0x212(%r13)
leaq 0x240(%r13), %rdx
movq %rdx, 0x238(%r13)
addl $0x2, %r10d
addq $0x120, %r13            # imm = 0x120
cmpq %r8, %r9
jb 0xc9b6
movl %eax, %edx
decl %edx
movw %dx, 0x2(%rdi)
movslq %edx, %rdx
leaq (%rdx,%rdx,8), %rdx
shlq $0x4, %rdx
addq %r15, %rdx
addq $0x60, %rdx
movq %rdx, 0x28(%rdi)
movw $0x1, 0x32(%rdi)
movq 0x10(%rsp), %rdx
movq %rdx, 0x58(%rdi)
movw $0x246, 0x62(%rdi)      # imm = 0x246
movq $0x0, 0x88(%rdi)
movw %ax, 0x2(%r15)
leaq 0x180(%r15), %rax
movq %rax, (%rcx)
movq %rsi, (%rsp)
movzbl (%r14), %eax
imull %r12d, %eax
testl %eax, %eax
jle 0xcb52
xorl %ebp, %ebp
movq %rsp, %r13
movq (%rsp), %rdx
movl $0x6, %edi
movq %r15, %rsi
movq %r13, %rcx
callq 0xc51c
cmpq $0x0, (%rsp)
je 0xcbce
movzbl (%r14), %eax
imull %r12d, %eax
incl %ebp
cmpl %eax, %ebp
jl 0xcab2
incl %ebp
jmp 0xcb57
movl $0x1, %ebp
movq (%rsp), %rdx
testq %rdx, %rdx
je 0xcb43
movl $0x2, %r13d
movl $0x1, %ebx
movq %rsp, %r12
cmpl $0x7, %r13d
jg 0xcb26
movslq %r13d, %rax
movzbl (%r14,%rax), %eax
cmpl %eax, %ebx
jne 0xcb26
movl $0x5, %edi
movq %r15, %rsi
movq %r12, %rcx
callq 0xc51c
incl %r13d
jmp 0xcb36
movl $0x6, %edi
movq %r15, %rsi
movq %r12, %rcx
callq 0xc51c
incl %ebx
incl %ebp
movq (%rsp), %rdx
testq %rdx, %rdx
jne 0xcaff
movl 0xc(%rsp), %esi
cmpl %esi, %ebp
je 0xcbba
movl %ebp, %edi
callq 0x20b9
movl $0x1, %ebp
movq (%rsp), %rdx
testq %rdx, %rdx
je 0xcbb2
movl $0x2, %r13d
movl $0x1, %ebx
movq %rsp, %r12
cmpl $0x7, %r13d
jg 0xcb95
movslq %r13d, %rax
movzbl (%r14,%rax), %eax
cmpl %eax, %ebx
jne 0xcb95
movl $0x5, %edi
movq %r15, %rsi
movq %r12, %rcx
callq 0xc51c
incl %r13d
jmp 0xcba5
movl $0x6, %edi
movq %r15, %rsi
movq %r12, %rcx
callq 0xc51c
incl %ebx
incl %ebp
movq (%rsp), %rdx
testq %rdx, %rdx
jne 0xcb6e
movl 0xc(%rsp), %esi
cmpl %esi, %ebp
jne 0xcbd3
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2094
callq 0x20fa
movl %ebp, %edi
callq 0x211f