// File: /workspace/github_c_makefile_star2_O2/kobolt[P]curses-collection/racer/racer.c
// Function: draw_car
static void draw_car(int curve, int row, int hpos, bool player, bool draw_blank)
{
  int col;
  int road_width;
  int road_start;

  if (row == -1) {
    return;
  }

  /* Compensate for distance: */
  road_width = ((row - HORIZON_HEIGHT) * 4);
  hpos = ((float)hpos / 80.0) * road_width;

  /* Compensate for curve: */
  road_start = (curve / (float)(ROAD_HEIGHT - 1)) *
    (ROAD_HEIGHT - 1 - (row - HORIZON_HEIGHT));
  hpos -= road_start;

  /* Size of the car depends on the row where it is drawn: */
  if (row > 16) { /* Large */
    col = 34 - hpos;

    /* Body: */
    if (player) {
      if (has_colors()) {
        attron(COLOR_PAIR(COL_MAGENTA));
      }
      if (draw_blank) {
        mvaddstr(row    , col + 1, "          ");
        mvaddstr(row + 1, col    , "            ");
        mvaddstr(row + 2, col    , "            ");
      } else {
        mvaddstr(row    , col + 1, "/%%%%%%%%\\");
        mvaddstr(row + 1, col    , "/%%%%%%%%%%\\");
        mvaddstr(row + 2, col    , "|%%%%%%%%%%|");
      }
      if (has_colors()) {
        attroff(COLOR_PAIR(COL_MAGENTA));
      }

    } else {
      if (has_colors()) {
        attron(COLOR_PAIR(COL_CYAN));
      }
      if (draw_blank) {
        mvaddstr(row    , col + 1, "          ");
        mvaddstr(row + 1, col    , "            ");
        mvaddstr(row + 2, col    , "            ");
      } else {
        mvaddstr(row    , col + 1, "/########\\");
        mvaddstr(row + 1, col    , "/##########\\");
        mvaddstr(row + 2, col    , "|##########|");
      }
      if (has_colors()) {
        attroff(COLOR_PAIR(COL_CYAN));
      }
    }

    /* Tyres: */
    if (has_colors()) {
      attron(COLOR_PAIR(COL_BLUE));
    }
    if (draw_blank) {
      mvaddch(row + 2, col + 1,  ' ');
      mvaddch(row + 2, col + 2,  ' ');
      mvaddch(row + 2, col + 9,  ' ');
      mvaddch(row + 2, col + 10, ' ');
    } else {
      mvaddch(row + 2, col + 1,  '@');
      mvaddch(row + 2, col + 2,  '@');
      mvaddch(row + 2, col + 9,  '@');
      mvaddch(row + 2, col + 10, '@');
    }
    if (has_colors()) {
      attroff(COLOR_PAIR(COL_BLUE));
    }

  } else if (row > 11) { /* Medium */
    col = 36 - hpos;

    /* Body: */
    if (has_colors()) {
      attron(COLOR_PAIR(COL_CYAN));
    }
    if (draw_blank) {
      mvaddstr(row    , col + 1, "      ");
      mvaddstr(row + 1, col    , "        ");
    } else {
      mvaddstr(row    , col + 1, "/####\\");
      mvaddstr(row + 1, col    , "|######|");
    }
    if (has_colors()) {
      attroff(COLOR_PAIR(COL_CYAN));
    }

    /* Tyres: */
    if (has_colors()) {
      attron(COLOR_PAIR(COL_BLUE));
    }
    if (draw_blank) {
      mvaddch(row + 1, col + 1,  ' ');
      mvaddch(row + 1, col + 6,  ' ');
    } else {
      mvaddch(row + 1, col + 1,  '@');
      mvaddch(row + 1, col + 6,  '@');
    }
    if (has_colors()) {
      attroff(COLOR_PAIR(COL_BLUE));
    }

  } else if (row > 8) { /* Small */
    col = 38 - hpos;

    /* Body: */
    if (has_colors()) {
      attron(COLOR_PAIR(COL_CYAN));
    }
    if (draw_blank) {
      mvaddstr(row, col, "   ");
    } else {
      mvaddstr(row, col, "###");
    }
    if (has_colors()) {
      attroff(COLOR_PAIR(COL_CYAN));
    }

  } else if (row > 4) { /* Tiny */
    col = 39 - hpos;

    /* Body: */
    if (has_colors()) {
      attron(COLOR_PAIR(COL_CYAN));
    }
    if (draw_blank) {
      mvaddch(row, col, ' ');
    } else {
      mvaddch(row, col, '#');
    }
    if (has_colors()) {
      attroff(COLOR_PAIR(COL_CYAN));
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $-0x1, %esi
je 0x2256
movl %r8d, %ebp
movl %esi, %ebx
leal -0x14(,%rbx,4), %eax
cvtsi2ss %edx, %xmm0
cvtss2sd %xmm0, %xmm0
divsd 0x1455(%rip), %xmm0     # 0x3080
cvtsi2sd %eax, %xmm1
mulsd %xmm0, %xmm1
cvttsd2si %xmm1, %r13d
cvtsi2ss %edi, %xmm0
divss 0x1414(%rip), %xmm0     # 0x3058
pushq $0x17
popq %rax
subl %esi, %eax
cvtsi2ss %eax, %xmm1
mulss %xmm0, %xmm1
cvttss2si %xmm1, %eax
subl %eax, %r13d
cmpl $0x11, %esi
jl 0x1d1b
movl %ecx, %r12d
pushq $0x22
popq %r15
subl %r13d, %r15d
callq 0x1030
pushq $0x23
popq %r14
testb %r12b, %r12b
je 0x1dab
testb %al, %al
je 0x1c97
movq 0x3358(%rip), %rax      # 0x4fe0
movq (%rax), %rdi
movl $0x600, %esi            # imm = 0x600
xorl %edx, %edx
callq 0x10c0
movq 0x3342(%rip), %r12      # 0x4fe0
movq (%r12), %rdi
movl %r14d, %edx
subl %r13d, %edx
movl %ebx, %esi
callq 0x1140
testb %bpl, %bpl
je 0x1eba
cmpl $-0x1, %eax
je 0x1cd0
movq (%r12), %rdi
leaq 0x1bd5(%rip), %rsi      # 0x389d
pushq $-0x1
popq %rdx
callq 0x1180
movq (%r12), %rdi
leal 0x1(%rbx), %esi
movl %r15d, %edx
callq 0x1140
cmpl $-0x1, %eax
je 0x1cf7
movq (%r12), %rdi
leaq 0x1bac(%rip), %rsi      # 0x389b
pushq $-0x1
popq %rdx
callq 0x1180
movq (%r12), %rdi
leal 0x2(%rbx), %esi
movl %r15d, %edx
callq 0x1140
cmpl $-0x1, %eax
je 0x1f20
leaq 0x1b85(%rip), %rsi      # 0x389b
jmp 0x1f14
cmpl $0xc, %ebx
jl 0x1e49
pushq $0x24
popq %r15
callq 0x1030
testb %al, %al
je 0x1d47
movq 0x32a8(%rip), %rax      # 0x4fe0
movq (%rax), %rdi
movl $0x700, %esi            # imm = 0x700
xorl %edx, %edx
callq 0x10c0
subl %r13d, %r15d
movq 0x328f(%rip), %r12      # 0x4fe0
movq (%r12), %rdi
pushq $0x25
popq %r14
subl %r13d, %r14d
movl %ebx, %esi
movl %r14d, %edx
callq 0x1140
testb %bpl, %bpl
je 0x1f2b
cmpl $-0x1, %eax
je 0x1d87
movq (%r12), %rdi
leaq 0x1b22(%rip), %rsi      # 0x38a1
pushq $-0x1
popq %rdx
callq 0x1180
movq (%r12), %rdi
leal 0x1(%rbx), %esi
movl %r15d, %edx
callq 0x1140
cmpl $-0x1, %eax
je 0x1f6a
leaq 0x1af9(%rip), %rsi      # 0x389f
jmp 0x1f5e
testb %al, %al
je 0x1dc5
movq 0x322a(%rip), %rax      # 0x4fe0
movq (%rax), %rdi
movl $0x700, %esi            # imm = 0x700
xorl %edx, %edx
callq 0x10c0
movq 0x3214(%rip), %r12      # 0x4fe0
movq (%r12), %rdi
movl %r14d, %edx
subl %r13d, %edx
movl %ebx, %esi
callq 0x1140
testb %bpl, %bpl
je 0x1fe7
cmpl $-0x1, %eax
je 0x1dfe
movq (%r12), %rdi
leaq 0x1aa7(%rip), %rsi      # 0x389d
pushq $-0x1
popq %rdx
callq 0x1180
movq (%r12), %rdi
leal 0x1(%rbx), %esi
movl %r15d, %edx
callq 0x1140
cmpl $-0x1, %eax
je 0x1e25
movq (%r12), %rdi
leaq 0x1a7e(%rip), %rsi      # 0x389b
pushq $-0x1
popq %rdx
callq 0x1180
movq (%r12), %rdi
leal 0x2(%rbx), %esi
movl %r15d, %edx
callq 0x1140
cmpl $-0x1, %eax
je 0x204d
leaq 0x1a57(%rip), %rsi      # 0x389b
jmp 0x2041
cmpl $0x9, %ebx
jl 0x218f
pushq $0x26
popq %r14
subl %r13d, %r14d
callq 0x1030
testb %al, %al
je 0x1e78
movq 0x3177(%rip), %rax      # 0x4fe0
movq (%rax), %rdi
movl $0x700, %esi            # imm = 0x700
xorl %edx, %edx
callq 0x10c0
movq 0x3161(%rip), %r15      # 0x4fe0
movq (%r15), %rdi
movl %ebx, %esi
movl %r14d, %edx
callq 0x1140
cmpl $-0x1, %eax
je 0x21ed
leaq 0x1a08(%rip), %rax      # 0x38a4
leaq 0x1a5f(%rip), %rsi      # 0x3902
testb %bpl, %bpl
cmovneq %rax, %rsi
movq (%r15), %rdi
pushq $-0x1
popq %rdx
callq 0x1180
jmp 0x21ed
cmpl $-0x1, %eax
je 0x1ed2
movq (%r12), %rdi
leaq 0x19de(%rip), %rsi      # 0x38a8
pushq $-0x1
popq %rdx
callq 0x1180
movq (%r12), %rdi
leal 0x1(%rbx), %esi
movl %r15d, %edx
callq 0x1140
cmpl $-0x1, %eax
je 0x1ef9
movq (%r12), %rdi
leaq 0x19c2(%rip), %rsi      # 0x38b3
pushq $-0x1
popq %rdx
callq 0x1180
movq (%r12), %rdi
leal 0x2(%rbx), %esi
movl %r15d, %edx
callq 0x1140
cmpl $-0x1, %eax
je 0x1f20
leaq 0x19ac(%rip), %rsi      # 0x38c0
movq (%r12), %rdi
pushq $-0x1
popq %rdx
callq 0x1180
movl $0x600, %r15d           # imm = 0x600
jmp 0x2053
cmpl $-0x1, %eax
je 0x1f43
movq (%r12), %rdi
leaq 0x19b7(%rip), %rsi      # 0x38f2
pushq $-0x1
popq %rdx
callq 0x1180
movq (%r12), %rdi
leal 0x1(%rbx), %esi
movl %r15d, %edx
callq 0x1140
cmpl $-0x1, %eax
je 0x1f6a
leaq 0x199b(%rip), %rsi      # 0x38f9
movq (%r12), %rdi
pushq $-0x1
popq %rdx
callq 0x1180
callq 0x1030
testb %al, %al
je 0x1f83
movq (%r12), %rdi
movl $0x700, %esi            # imm = 0x700
xorl %edx, %edx
callq 0x1190
callq 0x1030
testb %al, %al
je 0x1f9c
movq (%r12), %rdi
movl $0x500, %esi            # imm = 0x500
xorl %edx, %edx
callq 0x10c0
movq (%r12), %rdi
incl %ebx
movl %ebx, %esi
movl %r14d, %edx
callq 0x1140
testb %bpl, %bpl
je 0x21f4
cmpl $-0x1, %eax
je 0x1fc6
movq (%r12), %rdi
pushq $0x20
popq %rsi
callq 0x1150
movq (%r12), %rdi
pushq $0x2a
popq %rdx
subl %r13d, %edx
movl %ebx, %esi
callq 0x1140
cmpl $-0x1, %eax
je 0x2227
pushq $0x20
jmp 0x221d
cmpl $-0x1, %eax
je 0x1fff
movq (%r12), %rdi
leaq 0x18d6(%rip), %rsi      # 0x38cd
pushq $-0x1
popq %rdx
callq 0x1180
movq (%r12), %rdi
leal 0x1(%rbx), %esi
movl %r15d, %edx
callq 0x1140
cmpl $-0x1, %eax
je 0x2026
movq (%r12), %rdi
leaq 0x18ba(%rip), %rsi      # 0x38d8
pushq $-0x1
popq %rdx
callq 0x1180
movq (%r12), %rdi
leal 0x2(%rbx), %esi
movl %r15d, %edx
callq 0x1140
cmpl $-0x1, %eax
je 0x204d
leaq 0x18a4(%rip), %rsi      # 0x38e5
movq (%r12), %rdi
pushq $-0x1
popq %rdx
callq 0x1180
movl $0x700, %r15d           # imm = 0x700
callq 0x1030
testb %al, %al
je 0x2070
movq 0x2f7d(%rip), %rax      # 0x4fe0
movq (%rax), %rdi
movl %r15d, %esi
xorl %edx, %edx
callq 0x1190
callq 0x1030
testb %al, %al
je 0x208f
movq 0x2f60(%rip), %rax      # 0x4fe0
movq (%rax), %rdi
movl $0x500, %esi            # imm = 0x500
xorl %edx, %edx
callq 0x10c0
movq 0x2f4a(%rip), %r15      # 0x4fe0
movq (%r15), %rdi
addl $0x2, %ebx
subl %r13d, %r14d
movl %ebx, %esi
movl %r14d, %edx
callq 0x1140
testb %bpl, %bpl
je 0x211b
cmpl $-0x1, %eax
je 0x20be
movq (%r15), %rdi
pushq $0x20
popq %rsi
callq 0x1150
movq (%r15), %rdi
pushq $0x24
popq %rdx
subl %r13d, %edx
movl %ebx, %esi
callq 0x1140
cmpl $-0x1, %eax
je 0x20de
movq (%r15), %rdi
pushq $0x20
popq %rsi
callq 0x1150
movq (%r15), %rdi
pushq $0x2b
popq %rdx
subl %r13d, %edx
movl %ebx, %esi
callq 0x1140
cmpl $-0x1, %eax
je 0x20fe
movq (%r15), %rdi
pushq $0x20
popq %rsi
callq 0x1150
movq (%r15), %rdi
pushq $0x2c
popq %rdx
subl %r13d, %edx
movl %ebx, %esi
callq 0x1140
cmpl $-0x1, %eax
je 0x2227
pushq $0x20
jmp 0x2186
cmpl $-0x1, %eax
je 0x212b
movq (%r15), %rdi
pushq $0x40
popq %rsi
callq 0x1150
movq (%r15), %rdi
pushq $0x24
popq %rdx
subl %r13d, %edx
movl %ebx, %esi
callq 0x1140
cmpl $-0x1, %eax
je 0x214b
movq (%r15), %rdi
pushq $0x40
popq %rsi
callq 0x1150
movq (%r15), %rdi
pushq $0x2b
popq %rdx
subl %r13d, %edx
movl %ebx, %esi
callq 0x1140
cmpl $-0x1, %eax
je 0x216b
movq (%r15), %rdi
pushq $0x40
popq %rsi
callq 0x1150
movq (%r15), %rdi
pushq $0x2c
popq %rdx
subl %r13d, %edx
movl %ebx, %esi
callq 0x1140
cmpl $-0x1, %eax
je 0x2227
pushq $0x40
popq %rsi
movq (%r15), %rdi
jmp 0x2222
cmpl $0x5, %ebx
jl 0x2256
pushq $0x27
popq %r14
subl %r13d, %r14d
callq 0x1030
testb %al, %al
je 0x21be
movq 0x2e31(%rip), %rax      # 0x4fe0
movq (%rax), %rdi
movl $0x700, %esi            # imm = 0x700
xorl %edx, %edx
callq 0x10c0
movq 0x2e1b(%rip), %r15      # 0x4fe0
movq (%r15), %rdi
movl %ebx, %esi
movl %r14d, %edx
callq 0x1140
cmpl $-0x1, %eax
je 0x21ed
xorb $0x1, %bpl
movzbl %bpl, %eax
leal (%rax,%rax,2), %esi
addl $0x20, %esi
movq (%r15), %rdi
callq 0x1150
movl $0x700, %ebx            # imm = 0x700
jmp 0x222c
cmpl $-0x1, %eax
je 0x2205
movq (%r12), %rdi
pushq $0x40
popq %rsi
callq 0x1150
movq (%r12), %rdi
pushq $0x2a
popq %rdx
subl %r13d, %edx
movl %ebx, %esi
callq 0x1140
cmpl $-0x1, %eax
je 0x2227
pushq $0x40
popq %rsi
movq (%r12), %rdi
callq 0x1150
movl $0x500, %ebx            # imm = 0x500
callq 0x1030
testb %al, %al
je 0x2256
movq 0x2da4(%rip), %rax      # 0x4fe0
movq (%rax), %rdi
movl %ebx, %esi
xorl %edx, %edx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1190
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq