// File: /workspace/github_c_makefile_star2_O1/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 %r12
pushq %rbx
cmpl $-0x1, %esi
je 0x2354
movl %r8d, %ebp
movl %esi, %ebx
leal -0x14(,%rbx,4), %eax
cvtsi2ss %edx, %xmm0
cvtss2sd %xmm0, %xmm0
divsd 0x1378(%rip), %xmm0     # 0x3080
cvtsi2sd %eax, %xmm1
mulsd %xmm0, %xmm1
cvttsd2si %xmm1, %r12d
xorps %xmm0, %xmm0
cvtsi2ss %edi, %xmm0
divss 0x1334(%rip), %xmm0     # 0x3058
movl $0x17, %eax
subl %esi, %eax
xorps %xmm1, %xmm1
cvtsi2ss %eax, %xmm1
mulss %xmm0, %xmm1
cvttss2si %xmm1, %eax
subl %eax, %r12d
cmpl $0x11, %esi
jl 0x1dff
movl %ecx, %r15d
movl $0x22, %r14d
subl %r12d, %r14d
callq 0x1030
testb %r15b, %r15b
je 0x1e8e
testb %al, %al
je 0x1d7a
movq 0x3275(%rip), %rax      # 0x4fe0
movq (%rax), %rdi
movl $0x600, %esi            # imm = 0x600
xorl %edx, %edx
callq 0x10c0
movq 0x325f(%rip), %r15      # 0x4fe0
movq (%r15), %rdi
movl $0x23, %edx
subl %r12d, %edx
movl %ebx, %esi
callq 0x1140
testb %bpl, %bpl
je 0x1fa2
cmpl $-0x1, %eax
je 0x1db5
movq (%r15), %rdi
leaq 0x1af2(%rip), %rsi      # 0x389d
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1180
movq (%r15), %rdi
leal 0x1(%rbx), %esi
movl %r14d, %edx
callq 0x1140
cmpl $-0x1, %eax
je 0x1ddc
movq (%r15), %rdi
leaq 0x1ac9(%rip), %rsi      # 0x389b
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1180
movq (%r15), %rdi
leal 0x2(%rbx), %esi
movl %r14d, %edx
callq 0x1140
cmpl $-0x1, %eax
je 0x2009
leaq 0x1aa1(%rip), %rsi      # 0x389b
jmp 0x1ffc
cmpl $0xc, %ebx
jl 0x1f2d
movl $0x24, %r14d
callq 0x1030
testb %al, %al
je 0x1e2d
movq 0x31c2(%rip), %rax      # 0x4fe0
movq (%rax), %rdi
movl $0x700, %esi            # imm = 0x700
xorl %edx, %edx
callq 0x10c0
subl %r12d, %r14d
movq 0x31a9(%rip), %r15      # 0x4fe0
movq (%r15), %rdi
movl $0x25, %edx
subl %r12d, %edx
movl %ebx, %esi
callq 0x1140
testb %bpl, %bpl
je 0x2014
cmpl $-0x1, %eax
je 0x1e6b
movq (%r15), %rdi
leaq 0x1a40(%rip), %rsi      # 0x38a1
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1180
movq (%r15), %rdi
leal 0x1(%rbx), %esi
movl %r14d, %edx
callq 0x1140
cmpl $-0x1, %eax
je 0x2054
leaq 0x1a16(%rip), %rsi      # 0x389f
jmp 0x2047
testb %al, %al
je 0x1ea8
movq 0x3147(%rip), %rax      # 0x4fe0
movq (%rax), %rdi
movl $0x700, %esi            # imm = 0x700
xorl %edx, %edx
callq 0x10c0
movq 0x3131(%rip), %r15      # 0x4fe0
movq (%r15), %rdi
movl $0x23, %edx
subl %r12d, %edx
movl %ebx, %esi
callq 0x1140
testb %bpl, %bpl
je 0x20cf
cmpl $-0x1, %eax
je 0x1ee3
movq (%r15), %rdi
leaq 0x19c4(%rip), %rsi      # 0x389d
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1180
movq (%r15), %rdi
leal 0x1(%rbx), %esi
movl %r14d, %edx
callq 0x1140
cmpl $-0x1, %eax
je 0x1f0a
movq (%r15), %rdi
leaq 0x199b(%rip), %rsi      # 0x389b
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1180
movq (%r15), %rdi
leal 0x2(%rbx), %esi
movl %r14d, %edx
callq 0x1140
cmpl $-0x1, %eax
je 0x2136
leaq 0x1973(%rip), %rsi      # 0x389b
jmp 0x2129
cmpl $0x9, %ebx
jl 0x228e
movl $0x26, %r14d
subl %r12d, %r14d
callq 0x1030
testb %al, %al
je 0x1f5e
movq 0x3091(%rip), %rax      # 0x4fe0
movq (%rax), %rdi
movl $0x700, %esi            # imm = 0x700
xorl %edx, %edx
callq 0x10c0
movq 0x307b(%rip), %r15      # 0x4fe0
movq (%r15), %rdi
movl %ebx, %esi
movl %r14d, %edx
callq 0x1140
cmpl $-0x1, %eax
je 0x22ee
leaq 0x1922(%rip), %rax      # 0x38a4
leaq 0x1979(%rip), %rsi      # 0x3902
testb %bpl, %bpl
cmovneq %rax, %rsi
movq (%r15), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1180
jmp 0x22ee
cmpl $-0x1, %eax
je 0x1fbb
movq (%r15), %rdi
leaq 0x18f7(%rip), %rsi      # 0x38a8
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1180
movq (%r15), %rdi
leal 0x1(%rbx), %esi
movl %r14d, %edx
callq 0x1140
cmpl $-0x1, %eax
je 0x1fe2
movq (%r15), %rdi
leaq 0x18db(%rip), %rsi      # 0x38b3
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1180
movq (%r15), %rdi
leal 0x2(%rbx), %esi
movl %r14d, %edx
callq 0x1140
cmpl $-0x1, %eax
je 0x2009
leaq 0x18c4(%rip), %rsi      # 0x38c0
movq (%r15), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1180
movl $0x600, %r14d           # imm = 0x600
jmp 0x213c
cmpl $-0x1, %eax
je 0x202d
movq (%r15), %rdi
leaq 0x18cf(%rip), %rsi      # 0x38f2
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1180
movq (%r15), %rdi
leal 0x1(%rbx), %esi
movl %r14d, %edx
callq 0x1140
cmpl $-0x1, %eax
je 0x2054
leaq 0x18b2(%rip), %rsi      # 0x38f9
movq (%r15), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1180
callq 0x1030
testb %al, %al
je 0x206c
movq (%r15), %rdi
movl $0x700, %esi            # imm = 0x700
xorl %edx, %edx
callq 0x1190
callq 0x1030
testb %al, %al
je 0x2084
movq (%r15), %rdi
movl $0x500, %esi            # imm = 0x500
xorl %edx, %edx
callq 0x10c0
movq (%r15), %rdi
incl %ebx
movl $0x25, %edx
subl %r12d, %edx
movl %ebx, %esi
callq 0x1140
testb %bpl, %bpl
je 0x22f5
cmpl $-0x1, %eax
je 0x20b3
movq (%r15), %rdi
movl $0x20, %esi
callq 0x1150
movq (%r15), %rdi
movl $0x2a, %edx
subl %r12d, %edx
movl %ebx, %esi
callq 0x1140
movl $0x20, %esi
jmp 0x231e
cmpl $-0x1, %eax
je 0x20e8
movq (%r15), %rdi
leaq 0x17ef(%rip), %rsi      # 0x38cd
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1180
movq (%r15), %rdi
leal 0x1(%rbx), %esi
movl %r14d, %edx
callq 0x1140
cmpl $-0x1, %eax
je 0x210f
movq (%r15), %rdi
leaq 0x17d3(%rip), %rsi      # 0x38d8
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1180
movq (%r15), %rdi
leal 0x2(%rbx), %esi
movl %r14d, %edx
callq 0x1140
cmpl $-0x1, %eax
je 0x2136
leaq 0x17bc(%rip), %rsi      # 0x38e5
movq (%r15), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1180
movl $0x700, %r14d           # imm = 0x700
callq 0x1030
testb %al, %al
je 0x2159
movq 0x2e94(%rip), %rax      # 0x4fe0
movq (%rax), %rdi
movl %r14d, %esi
xorl %edx, %edx
callq 0x1190
callq 0x1030
testb %al, %al
je 0x2178
movq 0x2e77(%rip), %rax      # 0x4fe0
movq (%rax), %rdi
movl $0x500, %esi            # imm = 0x500
xorl %edx, %edx
callq 0x10c0
movq 0x2e61(%rip), %r14      # 0x4fe0
movq (%r14), %rdi
addl $0x2, %ebx
movl $0x23, %edx
subl %r12d, %edx
movl %ebx, %esi
callq 0x1140
testb %bpl, %bpl
je 0x220c
cmpl $-0x1, %eax
je 0x21ab
movq (%r14), %rdi
movl $0x20, %esi
callq 0x1150
movq (%r14), %rdi
movl $0x24, %edx
subl %r12d, %edx
movl %ebx, %esi
callq 0x1140
cmpl $-0x1, %eax
je 0x21cf
movq (%r14), %rdi
movl $0x20, %esi
callq 0x1150
movq (%r14), %rdi
movl $0x2b, %edx
subl %r12d, %edx
movl %ebx, %esi
callq 0x1140
cmpl $-0x1, %eax
je 0x21f3
movq (%r14), %rdi
movl $0x20, %esi
callq 0x1150
movq (%r14), %rdi
movl $0x2c, %edx
subl %r12d, %edx
movl %ebx, %esi
callq 0x1140
movl $0x20, %esi
jmp 0x227d
cmpl $-0x1, %eax
je 0x221e
movq (%r14), %rdi
movl $0x40, %esi
callq 0x1150
movq (%r14), %rdi
movl $0x24, %edx
subl %r12d, %edx
movl %ebx, %esi
callq 0x1140
cmpl $-0x1, %eax
je 0x2242
movq (%r14), %rdi
movl $0x40, %esi
callq 0x1150
movq (%r14), %rdi
movl $0x2b, %edx
subl %r12d, %edx
movl %ebx, %esi
callq 0x1140
cmpl $-0x1, %eax
je 0x2266
movq (%r14), %rdi
movl $0x40, %esi
callq 0x1150
movq (%r14), %rdi
movl $0x2c, %edx
subl %r12d, %edx
movl %ebx, %esi
callq 0x1140
movl $0x40, %esi
cmpl $-0x1, %eax
je 0x232b
movq (%r14), %rdi
jmp 0x2326
cmpl $0x5, %ebx
jl 0x2354
movl $0x27, %r14d
subl %r12d, %r14d
callq 0x1030
testb %al, %al
je 0x22bf
movq 0x2d30(%rip), %rax      # 0x4fe0
movq (%rax), %rdi
movl $0x700, %esi            # imm = 0x700
xorl %edx, %edx
callq 0x10c0
movq 0x2d1a(%rip), %r15      # 0x4fe0
movq (%r15), %rdi
movl %ebx, %esi
movl %r14d, %edx
callq 0x1140
cmpl $-0x1, %eax
je 0x22ee
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 0x2330
cmpl $-0x1, %eax
je 0x2307
movq (%r15), %rdi
movl $0x40, %esi
callq 0x1150
movq (%r15), %rdi
movl $0x2a, %edx
subl %r12d, %edx
movl %ebx, %esi
callq 0x1140
movl $0x40, %esi
cmpl $-0x1, %eax
je 0x232b
movq (%r15), %rdi
callq 0x1150
movl $0x500, %ebx            # imm = 0x500
callq 0x1030
testb %al, %al
je 0x2354
movq 0x2ca0(%rip), %rax      # 0x4fe0
movq (%rax), %rdi
movl %ebx, %esi
xorl %edx, %edx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1190
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq