// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathmsc.cpp
// Function: draw_sun_rays(int, int, int, int)
void draw_sun_rays(int x,int y, int marker_size, int watch)
{
int k;
int thickness;
int ray_len;
int ray_gap;
#define RAY_LEN 4
#define RAY_GAP (marker_size / 3)
int color;
int clip_left_x, clip_right_x;
int clip_top_y, clip_bottom_y;
int NO_CLIP;

   color = sat_colors[YELLOW_SAT_COLOR];

   last_sun_x = x;
   last_sun_y = y;
   last_sun_r = marker_size;

   thickness = 1;
   if(!small_azel()) thickness = 2;

   // erase the satellite map area on the screen
   if((zoom_screen == 'W') || ((zoom_screen == 0) && NO_SATS)) {
      clip_left_x = aclock_x-ACLOCK_R;
      clip_right_x = aclock_x+ACLOCK_R;
      clip_top_y = aclock_y-ACLOCK_R;
      clip_bottom_y = aclock_y+ACLOCK_R;
   }
   else if(watch && ((zoom_screen == 0) || (zoom_screen == 'V'))) {
      clip_left_x = aclock_x-ACLOCK_R;
      clip_right_x = aclock_x+ACLOCK_R;
      clip_top_y = aclock_y-ACLOCK_R;
      clip_bottom_y = aclock_y+ACLOCK_R;
   }
   else {
      clip_left_x = AZEL_X-AZEL_RADIUS;
      clip_right_x = AZEL_X+AZEL_RADIUS;
      clip_top_y = AZEL_Y-AZEL_RADIUS;
      clip_bottom_y = AZEL_Y+AZEL_RADIUS;
   }
//draw_rectangle(clip_left_x,clip_top_y, clip_right_x-clip_left_x,clip_bottom_y-clip_top_y, WHITE);
   clip_right_x -= thickness;
   clip_left_x += thickness;
   clip_top_y += thickness;
   clip_bottom_y -= thickness;
//draw_rectangle(clip_left_x,clip_top_y, clip_right_x-clip_left_x,clip_bottom_y-clip_top_y, RED);

   ray_gap = RAY_GAP;
   ray_len = RAY_LEN;

   k = marker_size + ray_gap;

NO_CLIP = 0;

   if(NO_CLIP || (x+k+ray_len < clip_right_x))  {
      thick_line(x+k,y, x+k+ray_len,y, color, thickness);
   }
   if(NO_CLIP || (x-k-ray_len > clip_left_x)) {
      thick_line(x-k,y, x-k-ray_len,y, color, thickness);
   }
   if(NO_CLIP || (y-k-ray_len > clip_top_y)) {
      thick_line(x,y-k, x,y-k-ray_len, color, thickness);
   }
   if(NO_CLIP || (y+k+ray_len < clip_bottom_y)) {
      thick_line(x,y+k, x,y+k+ray_len, color, thickness);
   }

   k = (int) (((double) k) * 0.707);
   if(NO_CLIP || ((x+k+ray_len < clip_right_x) && (y+k+ray_len < clip_bottom_y))) {
      thick_line(x+k,y+k, x+k+ray_len,y+k+ray_len, color, thickness);
   }
   if(NO_CLIP || ((x-k-ray_len > clip_left_x) && (y+k+ray_len < clip_bottom_y))) {
      thick_line(x-k,y+k, x-k-ray_len,y+k+ray_len, color, thickness);
   }
   if(NO_CLIP || ((x+k+ray_len < clip_right_x) && (y-k-ray_len > clip_top_y))) {
       thick_line(x+k,y-k, x+k+ray_len,y-k-ray_len, color, thickness);
   }
   if(NO_CLIP || ((x-k-ray_len > clip_left_x) && (y-k-ray_len > clip_top_y))) {
      thick_line(x-k,y-k, x-k-ray_len,y-k-ray_len, color, thickness);
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %r8d
movl %esi, %r10d
movl %edi, %r11d
movl 0x76864(%rip), %ebx     # 0x1546b8
leaq 0x21999d(%rip), %rax    # 0x2f77f8
movl %edi, (%rax)
leaq 0x219998(%rip), %rax    # 0x2f77fc
movl %esi, (%rax)
leaq 0x219993(%rip), %rax    # 0x2f7800
movl %edx, (%rax)
leaq 0x247516(%rip), %rax    # 0x32538c
movl (%rax), %eax
cmpl $0xa0, %eax
setge %sil
leaq 0x218920(%rip), %rdx    # 0x2f67a8
movzbl (%rdx), %edx
testl %edx, %edx
setne %dil
orb %sil, %dil
movzbl %dil, %esi
incl %esi
movl %esi, -0x2c(%rbp)
cmpl $0x57, %edx
movl %ebx, -0x30(%rbp)
je 0xddf11
testl %edx, %edx
jne 0xddeef
leaq 0x124a20(%rip), %rsi    # 0x2028d0
movq (%rsi), %rsi
movabsq $0x105b8b0400, %rdi     # imm = 0x105B8B0400
testq %rdi, %rsi
jne 0xddf11
leaq 0x127107(%rip), %rdi    # 0x204fd0
cmpl $0x0, (%rdi)
je 0xddeda
leaq 0x2194ef(%rip), %rdi    # 0x2f73c4
cmpl $0x0, (%rdi)
je 0xddf11
cmpq $0x400000, %rsi         # imm = 0x400000
jne 0xddeef
leaq 0x219aca(%rip), %rsi    # 0x2f79b4
cmpl $0x0, (%rsi)
je 0xddf11
leaq 0x2474ae(%rip), %rsi    # 0x3253a4
leaq 0x2474a3(%rip), %r9     # 0x3253a0
leaq 0x247494(%rip), %rdi    # 0x325398
testl %ecx, %ecx
je 0xddf2f
cmpl $0x56, %edx
je 0xddf11
testl %edx, %edx
jne 0xddf2f
leaq 0x247458(%rip), %rax    # 0x325370
movl (%rax), %eax
leaq 0x247457(%rip), %rsi    # 0x325378
leaq 0x24744c(%rip), %r9     # 0x325374
leaq 0x1248e1(%rip), %rdi    # 0x202810
movl (%r9), %ebx
pushq $0x2
popq %rcx
cltd
idivl %ecx
movl %eax, %r13d
subl (%rdi), %r13d
leal (%rbx,%r13), %edi
subl %r13d, %ebx
movl (%rsi), %r15d
movl %r15d, %r14d
subl %r13d, %r14d
movl -0x2c(%rbp), %r9d
subl %r9d, %edi
addl %r9d, %ebx
pushq $0x3
popq %rcx
movl %r8d, %eax
cltd
idivl %ecx
movl %eax, %r12d
addl %r8d, %r12d
leal (%r11,%r12), %edx
addl $0x4, %edx
movl %edi, -0x48(%rbp)
cmpl %edi, %edx
movq %r10, -0x40(%rbp)
movq %r11, -0x38(%rbp)
jge 0xddfa1
leal (%r12,%r11), %edi
movzbl -0x30(%rbp), %r8d
movl %r10d, %esi
movl %r10d, %ecx
movl -0x2c(%rbp), %r9d
callq 0xe78c
movl -0x2c(%rbp), %r9d
movq -0x38(%rbp), %r11
movq -0x40(%rbp), %r10
addl %r13d, %r15d
movl %r14d, %r13d
addl %r9d, %r13d
movl %r11d, %edi
subl %r12d, %edi
leal -0x4(%rdi), %edx
cmpl %ebx, %edx
movl -0x30(%rbp), %r14d
jle 0xddfda
movzbl %r14b, %r8d
movl %r10d, %esi
movl %r10d, %ecx
movl -0x2c(%rbp), %r9d
callq 0xe78c
movl -0x2c(%rbp), %r9d
movq -0x38(%rbp), %r11
movq -0x40(%rbp), %r10
subl %r9d, %r15d
movl %r10d, %esi
subl %r12d, %esi
leal -0x4(%rsi), %ecx
cmpl %r13d, %ecx
jle 0xde00a
movzbl %r14b, %r8d
movl %r11d, %edi
movl %r11d, %edx
movl -0x2c(%rbp), %r9d
callq 0xe78c
movl -0x2c(%rbp), %r9d
movq -0x38(%rbp), %r11
movq -0x40(%rbp), %r10
movl %r13d, -0x44(%rbp)
leal (%r12,%r10), %ecx
addl $0x4, %ecx
cmpl %r15d, %ecx
jge 0xde03d
leal (%r12,%r10), %esi
movzbl %r14b, %r8d
movl %r11d, %edi
movl %r11d, %edx
movl -0x2c(%rbp), %r9d
callq 0xe78c
movl -0x2c(%rbp), %r9d
movq -0x38(%rbp), %r11
movq -0x40(%rbp), %r10
cvtsi2sd %r12d, %xmm0
mulsd 0x38626(%rip), %xmm0    # 0x116670
cvttsd2si %xmm0, %r14d
leal (%r14,%r11), %edi
leal (%r14,%r11), %r13d
addl $0x4, %r13d
cmpl -0x48(%rbp), %r13d
jge 0xde094
leal (%r14,%r10), %ecx
addl $0x4, %ecx
cmpl %r15d, %ecx
jge 0xde094
leal (%r14,%r10), %esi
movzbl -0x30(%rbp), %r8d
movl %edi, %r12d
movl %r13d, %edx
movl -0x2c(%rbp), %r9d
callq 0xe78c
movl %r12d, %edi
movl -0x2c(%rbp), %r9d
movq -0x38(%rbp), %r11
movq -0x40(%rbp), %r10
subl %r14d, %r11d
leal -0x4(%r11), %r12d
cmpl %ebx, %r12d
jle 0xde0d8
leal (%r14,%r10), %ecx
addl $0x4, %ecx
cmpl %r15d, %ecx
jge 0xde0d8
leal (%r14,%r10), %esi
movzbl -0x30(%rbp), %r8d
movl %edi, -0x38(%rbp)
movl %r11d, %edi
movl %r12d, %edx
movl -0x2c(%rbp), %r9d
movq %r11, %r15
callq 0xe78c
movl -0x38(%rbp), %edi
movl -0x2c(%rbp), %r9d
movq %r15, %r11
movq -0x40(%rbp), %r10
cmpl -0x48(%rbp), %r13d
jge 0xde10b
movl %r10d, %esi
subl %r14d, %esi
leal -0x4(%rsi), %ecx
cmpl -0x44(%rbp), %ecx
jle 0xde10b
movzbl -0x30(%rbp), %r8d
movl %r13d, %edx
movl -0x2c(%rbp), %r9d
movq %r11, %r15
callq 0xe78c
movl -0x2c(%rbp), %r9d
movq %r15, %r11
movq -0x40(%rbp), %r10
cmpl %ebx, %r12d
jle 0xde13d
subl %r14d, %r10d
leal -0x4(%r10), %ecx
cmpl -0x44(%rbp), %ecx
jle 0xde13d
movzbl -0x30(%rbp), %r8d
movl %r11d, %edi
movl %r10d, %esi
movl %r12d, %edx
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe78c
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq