// File: /workspace/github_c_makefile_star2_O3/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
movl %r8d, 0xc(%rsp)
movq %rdx, %r14
movl %esi, %r12d
movq %rdi, %r15
movq (%rcx), %rdx
testq %rdx, %rdx
je 0xc96c
movq %rdx, (%rsp)
movzbl (%r14), %eax
imull %r12d, %eax
movl $0x1, %ebx
testl %eax, %eax
jle 0xcb24
xorl %ebp, %ebp
movq %rsp, %r13
movl $0x6, %edi
movq %r15, %rsi
movq %r13, %rcx
callq 0xc571
movq (%rsp), %rdx
testq %rdx, %rdx
je 0xcbee
movzbl (%r14), %eax
imull %r12d, %eax
incl %ebp
cmpl %eax, %ebp
jl 0xc93a
incl %ebp
jmp 0xcb29
leal (%r12,%r12), %eax
leaq 0x90(%r15), %rdx
movq %rdx, 0x10(%rsp)
movw %ax, 0x92(%r15)
movslq %eax, %r8
leaq (%r8,%r8,8), %rdx
shlq $0x4, %rdx
leaq (%r15,%rdx), %rdi
addq %r15, %rdx
addq $0x30, %rdx
movq %rdx, 0xb8(%r15)
leaq 0xc0(%r15), %rdx
movw $0x246, 0xc2(%r15)      # imm = 0x246
movq $0x0, 0xe8(%r15)
movw $0x2, 0xf2(%r15)
leaq 0x120(%r15), %r9
movq %r9, 0x118(%r15)
cmpl $0x2, %r12d
jl 0xca8a
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), %rsi
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 %rsi, 0x1d8(%r13)
movw %r11w, 0x1e2(%r13)
movq %rbx, 0x208(%r13)
addq $0x2, %r9
movw %r10w, 0x212(%r13)
leaq 0x240(%r13), %rsi
movq %rsi, 0x238(%r13)
addl $0x2, %r10d
addq $0x120, %r13            # imm = 0x120
cmpq %r8, %r9
jl 0xc9f4
movl %eax, %esi
decl %esi
movw %si, 0x2(%rdi)
movslq %esi, %rsi
leaq (%rsi,%rsi,8), %rsi
shlq $0x4, %rsi
addq %r15, %rsi
addq $0x60, %rsi
movq %rsi, 0x28(%rdi)
movw $0x1, 0x32(%rdi)
movq 0x10(%rsp), %rsi
movq %rsi, 0x58(%rdi)
movw $0x246, 0x62(%rdi)      # imm = 0x246
movq $0x0, 0x88(%rdi)
movw %ax, 0x2(%r15)
leaq 0x180(%r15), %rax
movq %rax, (%rcx)
movq %rdx, (%rsp)
movzbl (%r14), %eax
imull %r12d, %eax
movl $0x1, %ebx
testl %eax, %eax
jle 0xcb85
xorl %ebp, %ebp
movq %rsp, %r13
movl $0x6, %edi
movq %r15, %rsi
movq %r13, %rcx
callq 0xc571
movq (%rsp), %rdx
testq %rdx, %rdx
je 0xcbf3
movzbl (%r14), %eax
imull %r12d, %eax
incl %ebp
cmpl %eax, %ebp
jl 0xcaf5
incl %ebp
jmp 0xcb8a
movl $0x1, %ebp
movl $0x2, %r13d
movq %rsp, %r12
cmpl $0x7, %r13d
jg 0xcb59
movslq %r13d, %rax
movzbl (%r14,%rax), %eax
cmpl %eax, %ebx
jne 0xcb59
movl $0x5, %edi
movq %r15, %rsi
movq %r12, %rcx
callq 0xc571
incl %r13d
jmp 0xcb69
movl $0x6, %edi
movq %r15, %rsi
movq %r12, %rcx
callq 0xc571
incl %ebx
incl %ebp
movq (%rsp), %rdx
testq %rdx, %rdx
jne 0xcb32
movl 0xc(%rsp), %esi
cmpl %ebp, %esi
je 0xcbdf
movl %ebp, %edi
callq 0x206f
movl $0x1, %ebp
movl $0x2, %r13d
movq %rsp, %r12
cmpl $0x7, %r13d
jg 0xcbba
movslq %r13d, %rax
movzbl (%r14,%rax), %eax
cmpl %eax, %ebx
jne 0xcbba
movl $0x5, %edi
movq %r15, %rsi
movq %r12, %rcx
callq 0xc571
incl %r13d
jmp 0xcbca
movl $0x6, %edi
movq %r15, %rsi
movq %r12, %rcx
callq 0xc571
incl %ebx
incl %ebp
movq (%rsp), %rdx
testq %rdx, %rdx
jne 0xcb93
movl 0xc(%rsp), %esi
cmpl %ebp, %esi
jne 0xcbf8
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x204a
callq 0x20b0
movl %ebp, %edi
callq 0x20d5