// File: /workspace/github_cpp_makefile_star2_O1/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 %esi, %r10d
movl %edi, %r13d
movl 0x77b77(%rip), %eax     # 0x16a6b8
movl %eax, -0x2c(%rbp)
leaq 0x21acad(%rip), %rax    # 0x30d7f8
movl %edi, (%rax)
leaq 0x21aca8(%rip), %rax    # 0x30d7fc
movl %esi, (%rax)
leaq 0x21aca3(%rip), %rax    # 0x30d800
movl %edx, (%rax)
leaq 0x248826(%rip), %rax    # 0x33b38c
movl (%rax), %eax
cmpl $0xa0, %eax
setge %sil
leaq 0x219c30(%rip), %rdi    # 0x30c7a8
movzbl (%rdi), %edi
testl %edi, %edi
setne %r8b
orb %sil, %r8b
movzbl %r8b, %r9d
incl %r9d
cmpl $0x57, %edi
je 0xf2bfe
testl %edi, %edi
jne 0xf2bdc
leaq 0x125d35(%rip), %rsi    # 0x2188d0
movq (%rsi), %rsi
movabsq $0x105b8b0400, %r8      # imm = 0x105B8B0400
testq %r8, %rsi
jne 0xf2bfe
leaq 0x12841c(%rip), %r8     # 0x21afd0
cmpl $0x0, (%r8)
je 0xf2bc7
leaq 0x21a803(%rip), %r8     # 0x30d3c4
cmpl $0x0, (%r8)
je 0xf2bfe
cmpq $0x400000, %rsi         # imm = 0x400000
jne 0xf2bdc
leaq 0x21addd(%rip), %rsi    # 0x30d9b4
cmpl $0x0, (%rsi)
je 0xf2bfe
leaq 0x2487c1(%rip), %rsi    # 0x33b3a4
leaq 0x2487b6(%rip), %r11    # 0x33b3a0
leaq 0x2487a7(%rip), %r8     # 0x33b398
testl %ecx, %ecx
je 0xf2c1c
cmpl $0x56, %edi
je 0xf2bfe
testl %edi, %edi
jne 0xf2c1c
leaq 0x24876b(%rip), %rax    # 0x33b370
movl (%rax), %eax
leaq 0x24876a(%rip), %rsi    # 0x33b378
leaq 0x24875f(%rip), %r11    # 0x33b374
leaq 0x125bf4(%rip), %r8     # 0x218810
movl (%r11), %ebx
movl %eax, %r14d
shrl $0x1f, %r14d
addl %eax, %r14d
sarl %r14d
subl (%r8), %r14d
leal (%r14,%rbx), %ecx
subl %r14d, %ebx
movl (%rsi), %r15d
movl %r15d, %eax
subl %r14d, %eax
movl %eax, -0x34(%rbp)
subl %r9d, %ecx
addl %r9d, %ebx
movslq %edx, %rax
imulq $0x55555556, %rax, %r12 # imm = 0x55555556
movq %r12, %rax
shrq $0x3f, %rax
shrq $0x20, %r12
addl %eax, %r12d
addl %edx, %r12d
leal (%r12,%r13), %edx
addl $0x4, %edx
movl %ecx, -0x4c(%rbp)
cmpl %ecx, %edx
movq %r10, -0x40(%rbp)
movl %r9d, -0x30(%rbp)
jge 0xf2c95
leal (%r12,%r13), %edi
movzbl -0x2c(%rbp), %r8d
movl %r10d, %esi
movl %r10d, %ecx
callq 0xed0e
movl -0x30(%rbp), %r9d
movq -0x40(%rbp), %r10
addl %r14d, %r15d
movl -0x34(%rbp), %r14d
addl %r9d, %r14d
movl %r13d, %edi
subl %r12d, %edi
leal -0x4(%rdi), %edx
cmpl %ebx, %edx
jle 0xf2cc4
movzbl -0x2c(%rbp), %r8d
movl %r10d, %esi
movl %r10d, %ecx
callq 0xed0e
movl -0x30(%rbp), %r9d
movq -0x40(%rbp), %r10
subl %r9d, %r15d
movl %r10d, %esi
subl %r12d, %esi
leal -0x4(%rsi), %ecx
cmpl %r14d, %ecx
jle 0xf2ced
movzbl -0x2c(%rbp), %r8d
movl %r13d, %edi
movl %r13d, %edx
callq 0xed0e
movl -0x30(%rbp), %r9d
movq -0x40(%rbp), %r10
movl %r14d, -0x34(%rbp)
leal (%r12,%r10), %ecx
addl $0x4, %ecx
cmpl %r15d, %ecx
jge 0xf2d19
leal (%r12,%r10), %esi
movzbl -0x2c(%rbp), %r8d
movl %r13d, %edi
movl %r13d, %edx
callq 0xed0e
movl -0x30(%rbp), %r9d
movq -0x40(%rbp), %r10
cvtsi2sd %r12d, %xmm0
mulsd 0x39942(%rip), %xmm0    # 0x12c668
cvttsd2si %xmm0, %r14d
leal (%r14,%r13), %edi
movq %r13, %r12
addl %r14d, %r13d
addl $0x4, %r13d
cmpl -0x4c(%rbp), %r13d
jge 0xf2d6d
leal (%r14,%r10), %ecx
addl $0x4, %ecx
cmpl %r15d, %ecx
jge 0xf2d6d
leal (%r14,%r10), %esi
movzbl -0x2c(%rbp), %r8d
movl %edi, -0x48(%rbp)
movl -0x48(%rbp), %edi
movl %r13d, %edx
callq 0xed0e
movl -0x48(%rbp), %edi
movl -0x30(%rbp), %r9d
movq -0x40(%rbp), %r10
subl %r14d, %r12d
movq %r12, -0x48(%rbp)
addl $-0x4, %r12d
cmpl %ebx, %r12d
jle 0xf2dac
leal (%r14,%r10), %ecx
addl $0x4, %ecx
cmpl %r15d, %ecx
jge 0xf2dac
leal (%r14,%r10), %esi
movzbl -0x2c(%rbp), %r8d
movl %edi, %r15d
movq -0x48(%rbp), %rdi
movl %r12d, %edx
callq 0xed0e
movl %r15d, %edi
movl -0x30(%rbp), %r9d
movq -0x40(%rbp), %r10
cmpl -0x4c(%rbp), %r13d
jge 0xf2dd5
movl %r10d, %esi
subl %r14d, %esi
leal -0x4(%rsi), %ecx
cmpl -0x34(%rbp), %ecx
jle 0xf2dd5
movzbl -0x2c(%rbp), %r8d
movl %r13d, %edx
callq 0xed0e
movl -0x30(%rbp), %r9d
movq -0x40(%rbp), %r10
cmpl %ebx, %r12d
jle 0xf2e08
subl %r14d, %r10d
leal -0x4(%r10), %ecx
cmpl -0x34(%rbp), %ecx
jle 0xf2e08
movzbl -0x2c(%rbp), %r8d
movq -0x48(%rbp), %rdi
movl %r10d, %esi
movl %r12d, %edx
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xed0e
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq