// File: /workspace/github_c_makefile_star2_O2/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), %rdx
testq %rdx, %rdx
movl %r8d, 0x14(%rsp)
je 0xa858
leaq 0x8(%rsp), %rbx
movq %rdx, (%rbx)
pushq $0x1
popq %rbp
pushq $0x6
popq %r13
movzbl (%r14), %eax
imull %r12d, %eax
cmpl %eax, %ebp
jg 0xa7c2
movl %r13d, %edi
movq %r15, %rsi
movq %rbx, %rcx
callq 0xa3ef
movq 0x8(%rsp), %rdx
testq %rdx, %rdx
je 0xaa2b
incl %ebp
jmp 0xa796
pushq $0x2
popq %rbx
xorl %r12d, %r12d
leaq 0x8(%rsp), %r13
testq %rdx, %rdx
je 0xa80e
incl %r12d
cmpl $0x7, %ebx
jg 0xa7f9
movslq %ebx, %rax
movzbl (%r14,%rax), %eax
cmpl %eax, %r12d
jne 0xa7f9
pushq $0x5
popq %rdi
movq %r15, %rsi
movq %r13, %rcx
callq 0xa3ef
incl %ebx
jmp 0xa807
pushq $0x6
popq %rdi
movq %r15, %rsi
movq %r13, %rcx
callq 0xa3ef
movq 0x8(%rsp), %rdx
jmp 0xa7cd
addl %r12d, %ebp
movl 0x14(%rsp), %r14d
cmpl %r14d, %ebp
je 0xaa1c
movq 0x87d2(%rip), %rbx      # 0x12ff8
movq (%rbx), %rcx
leaq 0x422d(%rip), %rdi      # 0xea5d
pushq $0x2b
popq %rsi
pushq $0x1
popq %rdx
callq 0x1150
movq (%rbx), %rdi
leaq 0x4244(%rip), %rsi      # 0xea89
movl %ebp, %edx
movl %r14d, %ecx
xorl %eax, %eax
callq 0x10a0
pushq $0x5b
jmp 0xaa69
leal (%r12,%r12), %eax
movw %ax, 0x92(%r15)
movslq %eax, %rsi
imulq $0x90, %rsi, %rdx
leaq (%r15,%rdx), %rdi
addq $0x30, %rdi
movq %rdi, 0xb8(%r15)
movw $0x246, 0xc2(%r15)      # imm = 0x246
andq $0x0, 0xe8(%r15)
addq %r15, %rdx
movw $0x2, 0xf2(%r15)
leaq 0x120(%r15), %rdi
movq %rdi, 0x118(%r15)
leaq 0x240(%r15), %rdi
pushq $0x2
popq %r11
movw $0x246, %r9w            # imm = 0x246
cmpq %rsi, %r11
jge 0xa936
leal -0x1(%r11), %r10d
movw %r10w, -0x11e(%rdi)
leaq -0x150(%rdi), %r10
movq %r10, -0xf8(%rdi)
leal 0x1(%r11), %r10d
movw %r10w, -0xee(%rdi)
leaq -0x90(%rdi), %r10
movq %r10, -0xc8(%rdi)
movw %r9w, -0xbe(%rdi)
andq $0x0, -0x98(%rdi)
leaq -0xf0(%rdi), %r10
movw %r11w, -0x8e(%rdi)
movq %r10, -0x68(%rdi)
movw %r9w, -0x5e(%rdi)
andq $0x0, -0x38(%rdi)
addq $0x2, %r11
movw %r11w, -0x2e(%rdi)
movq %rdi, -0x8(%rdi)
addq $0x120, %rdi            # imm = 0x120
jmp 0xa8ba
leaq 0x90(%r15), %rsi
movl %eax, %edi
decl %edi
movw %di, 0x2(%rdx)
movslq %edi, %rdi
imulq $0x90, %rdi, %rdi
addq %r15, %rdi
addq $0x60, %rdi
movq %rdi, 0x28(%rdx)
movw $0x1, 0x32(%rdx)
movq %rsi, 0x58(%rdx)
movw $0x246, 0x62(%rdx)      # imm = 0x246
andq $0x0, 0x88(%rdx)
leaq 0xc0(%r15), %rdx
movw %ax, 0x2(%r15)
leaq 0x180(%r15), %rax
movq %rax, (%rcx)
leaq 0x8(%rsp), %rbx
movq %rdx, (%rbx)
pushq $0x1
popq %rbp
pushq $0x6
popq %r13
movzbl (%r14), %eax
imull %r12d, %eax
cmpl %eax, %ebp
jg 0xa9c3
movl %r13d, %edi
movq %r15, %rsi
movq %rbx, %rcx
callq 0xa3ef
movq 0x8(%rsp), %rdx
testq %rdx, %rdx
je 0xaa4b
incl %ebp
jmp 0xa997
pushq $0x2
popq %rbx
xorl %r12d, %r12d
leaq 0x8(%rsp), %r13
testq %rdx, %rdx
je 0xaa0f
incl %r12d
cmpl $0x7, %ebx
jg 0xa9fa
movslq %ebx, %rax
movzbl (%r14,%rax), %eax
cmpl %eax, %r12d
jne 0xa9fa
pushq $0x5
popq %rdi
movq %r15, %rsi
movq %r13, %rcx
callq 0xa3ef
incl %ebx
jmp 0xaa08
pushq $0x6
popq %rdi
movq %r15, %rsi
movq %r13, %rcx
callq 0xa3ef
movq 0x8(%rsp), %rdx
jmp 0xa9ce
addl %r12d, %ebp
movl 0x14(%rsp), %r14d
cmpl %r14d, %ebp
jne 0xaa6f
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x85c6(%rip), %rax      # 0x12ff8
movq (%rax), %rcx
leaq 0x3ff3(%rip), %rdi      # 0xea2f
pushq $0x2d
popq %rsi
pushq $0x1
popq %rdx
callq 0x1150
pushq $0x5a
jmp 0xaa69
movq 0x85a6(%rip), %rax      # 0x12ff8
movq (%rax), %rcx
leaq 0x3fd3(%rip), %rdi      # 0xea2f
pushq $0x2d
popq %rsi
pushq $0x1
popq %rdx
callq 0x1150
pushq $0x58
popq %rdi
callq 0x1140
movq 0x8582(%rip), %rbx      # 0x12ff8
movq (%rbx), %rcx
leaq 0x3fdd(%rip), %rdi      # 0xea5d
pushq $0x2b
popq %rsi
pushq $0x1
popq %rdx
callq 0x1150
movq (%rbx), %rdi
leaq 0x3ff4(%rip), %rsi      # 0xea89
movl %ebp, %edx
movl %r14d, %ecx
xorl %eax, %eax
callq 0x10a0
pushq $0x59
jmp 0xaa69