// File: /workspace/github_cpp_makefile_star2_O3/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 0x774b2(%rip), %eax     # 0x16a6b8
movl %eax, -0x2c(%rbp)
leaq 0x21a5e8(%rip), %rax    # 0x30d7f8
movl %edi, (%rax)
leaq 0x21a5e3(%rip), %rax    # 0x30d7fc
movl %esi, (%rax)
leaq 0x21a5de(%rip), %rax    # 0x30d800
movl %edx, (%rax)
leaq 0x248161(%rip), %rax    # 0x33b38c
movl (%rax), %eax
cmpl $0xa0, %eax
setge %sil
leaq 0x21956b(%rip), %rdi    # 0x30c7a8
movzbl (%rdi), %edi
testl %edi, %edi
setne %r8b
orb %sil, %r8b
movzbl %r8b, %r9d
incl %r9d
cmpl $0x57, %edi
je 0xf32c3
testl %edi, %edi
jne 0xf32a1
leaq 0x125670(%rip), %rsi    # 0x2188d0
movq (%rsi), %rsi
movabsq $0x105b8b0400, %r8      # imm = 0x105B8B0400
testq %r8, %rsi
jne 0xf32c3
leaq 0x127d57(%rip), %r8     # 0x21afd0
cmpl $0x0, (%r8)
je 0xf328c
leaq 0x21a13e(%rip), %r8     # 0x30d3c4
cmpl $0x0, (%r8)
je 0xf32c3
cmpq $0x400000, %rsi         # imm = 0x400000
jne 0xf32a1
leaq 0x21a718(%rip), %rsi    # 0x30d9b4
cmpl $0x0, (%rsi)
je 0xf32c3
leaq 0x2480fc(%rip), %rsi    # 0x33b3a4
leaq 0x2480f1(%rip), %r11    # 0x33b3a0
leaq 0x2480e2(%rip), %r8     # 0x33b398
testl %ecx, %ecx
je 0xf32e1
cmpl $0x56, %edi
je 0xf32c3
testl %edi, %edi
jne 0xf32e1
leaq 0x2480a6(%rip), %rax    # 0x33b370
movl (%rax), %eax
leaq 0x2480a5(%rip), %rsi    # 0x33b378
leaq 0x24809a(%rip), %r11    # 0x33b374
leaq 0x12552f(%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 0xf335a
leal (%r12,%r13), %edi
movzbl -0x2c(%rbp), %r8d
movl %r10d, %esi
movl %r10d, %ecx
callq 0xec9b
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 0xf3389
movzbl -0x2c(%rbp), %r8d
movl %r10d, %esi
movl %r10d, %ecx
callq 0xec9b
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 0xf33b2
movzbl -0x2c(%rbp), %r8d
movl %r13d, %edi
movl %r13d, %edx
callq 0xec9b
movl -0x30(%rbp), %r9d
movq -0x40(%rbp), %r10
movl %r14d, -0x34(%rbp)
leal (%r12,%r10), %ecx
addl $0x4, %ecx
cmpl %r15d, %ecx
jge 0xf33de
leal (%r12,%r10), %esi
movzbl -0x2c(%rbp), %r8d
movl %r13d, %edi
movl %r13d, %edx
callq 0xec9b
movl -0x30(%rbp), %r9d
movq -0x40(%rbp), %r10
cvtsi2sd %r12d, %xmm0
mulsd 0x39365(%rip), %xmm0    # 0x12c750
cvttsd2si %xmm0, %r14d
leal (%r14,%r13), %edi
movq %r13, %r12
addl %r14d, %r13d
addl $0x4, %r13d
cmpl -0x4c(%rbp), %r13d
jge 0xf3432
leal (%r14,%r10), %ecx
addl $0x4, %ecx
cmpl %r15d, %ecx
jge 0xf3432
leal (%r14,%r10), %esi
movzbl -0x2c(%rbp), %r8d
movl %edi, -0x48(%rbp)
movl -0x48(%rbp), %edi
movl %r13d, %edx
callq 0xec9b
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 0xf3471
leal (%r14,%r10), %ecx
addl $0x4, %ecx
cmpl %r15d, %ecx
jge 0xf3471
leal (%r14,%r10), %esi
movzbl -0x2c(%rbp), %r8d
movl %edi, %r15d
movq -0x48(%rbp), %rdi
movl %r12d, %edx
callq 0xec9b
movl %r15d, %edi
movl -0x30(%rbp), %r9d
movq -0x40(%rbp), %r10
cmpl -0x4c(%rbp), %r13d
jge 0xf349a
movl %r10d, %esi
subl %r14d, %esi
leal -0x4(%rsi), %ecx
cmpl -0x34(%rbp), %ecx
jle 0xf349a
movzbl -0x2c(%rbp), %r8d
movl %r13d, %edx
callq 0xec9b
movl -0x30(%rbp), %r9d
movq -0x40(%rbp), %r10
cmpl %ebx, %r12d
jle 0xf34cd
subl %r14d, %r10d
leal -0x4(%r10), %ecx
cmpl -0x34(%rbp), %ecx
jle 0xf34cd
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 0xec9b
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq