// File: /workspace/github_c_makefile_star2_O1/nkanaev[P]tipsy/src/tipsy.c
// Function: draw_surface
void draw_surface(Tigr *scr, Obj *obj, Surface sf, State state) {
  Face f = *(Face*)(list_get(obj->f, sf.idx));

  Tigr *texture = NULL;
  if (f.mtl) texture = f.mtl->map_Ka ? f.mtl->map_Ka : f.mtl->map_Kd;
  if (texture == NULL) return;

  int shading = -1, has_normals = 0;
  Vec vn1, vn2, vn3;

  if (state.shading == SHADING_FLAT) {
    Vec bc = {0.333, 0.333, 0.333};
    shading = shade(sf.nrm, bc);
  }
  if (state.shading == SHADING_GOURAUD) {
    has_normals = f.vn1 > 0 && f.vn2 > 0 && f.vn3 > 0;
    if (has_normals) {
      vn1 = vec_nrm(VREF(list_get(obj->vn, f.vn1-1)));
      vn2 = vec_nrm(VREF(list_get(obj->vn, f.vn2-1)));
      vn3 = vec_nrm(VREF(list_get(obj->vn, f.vn3-1)));
      vn1 = perspective(vn1, state.x, state.y, state.z);
      vn2 = perspective(vn2, state.x, state.y, state.z);
      vn3 = perspective(vn3, state.x, state.y, state.z);
    }
  }

  Vec vt1 = VREF(list_get(obj->vt, f.vt1-1)),
      vt2 = VREF(list_get(obj->vt, f.vt2-1)),
      vt3 = VREF(list_get(obj->vt, f.vt3-1));

  int minX = fminf(fminf(sf.v1.x, sf.v2.x), sf.v3.x),
      maxX = fmaxf(fmaxf(sf.v1.x, sf.v2.x), sf.v3.x)+1,
      minY = fminf(fminf(sf.v1.y, sf.v2.y), sf.v3.y),
      maxY = fmaxf(fmaxf(sf.v1.y, sf.v2.y), sf.v3.y)+1;

  for (int y = minY; y < maxY; y++) {
    for (int x = minX; x < maxX; x++) {
      Vec p = {x, y, 0};
      Vec bc = barycenter(p, sf.v1, sf.v2, sf.v3);
      float err = -0.0001;
      if (bc.x >= err && bc.y >= err && bc.z >= err) {
        if (state.use_zbuffer) {
          float z = bc.x*sf.v1.z + bc.y*sf.v2.z + bc.z*sf.v3.z;
          int zbuff_idx = y * WIDTH + x;
          if (z > state.zbuff[zbuff_idx]) continue;
          state.zbuff[zbuff_idx] = z;
        }

        float u, v;

        if (state.use_pcorrect) {
          Vec bcc = bc;
          bcc.x = bc.x/(sf.v1.z);
          bcc.y = bc.y/(sf.v2.z);
          bcc.z = bc.z/(sf.v3.z);
          float bd = bcc.x+bcc.y+bcc.z;
          bcc.x = bcc.x/bd;
          bcc.y = bcc.y/bd;
          bcc.z = bcc.z/bd;

          u = bcc.x*vt1.x + bcc.y*vt2.x + bcc.z*vt3.x;
          v = 1.0-(bcc.x*vt1.y + bcc.y*vt2.y + bcc.z*vt3.y);
        } else {
          u = bc.x*vt1.x + bc.y*vt2.x + bc.z*vt3.x;
          v = 1.0-(bc.x*vt1.y + bc.y*vt2.y + bc.z*vt3.y);
        }

        int tx = texture->w * u;
        int ty = texture->h * v;

        TPixel texel = tigrGet(texture, tx % texture->w, ty % texture->h);

        if (state.shading == SHADING_GOURAUD && has_normals) {
          int s1 = shade(vn1, bc);
          int s2 = shade(vn2, bc);
          int s3 = shade(vn3, bc);
          shading = bc.x*s1 + bc.y*s2 + bc.z*s3;
        }

        if (shading >= 0) {
          texel.r = (texel.r * shading) >> 8;
          texel.g = (texel.g * shading) >> 8;
          texel.b = (texel.b * shading) >> 8;
        }
        tigrPlot(scr, x, y, texel);
      }
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movq %rsi, %r15
movq %rdi, 0xc8(%rsp)
movq 0x18(%rsi), %rcx
movslq 0x1f4(%rsp), %rdx
movq (%rcx), %rax
movslq 0x10(%rcx), %rcx
imulq %rdx, %rcx
movq 0x28(%rax,%rcx), %rdx
testq %rdx, %rdx
je 0x937d
movq 0x8(%rdx), %rdi
testq %rdi, %rdi
jne 0x937f
movq 0x10(%rdx), %rdi
jmp 0x937f
xorl %edi, %edi
testq %rdi, %rdi
je 0x9e49
leaq 0x1f8(%rsp), %r8
leaq 0x1a0(%rsp), %r9
movl 0x14(%r8), %r10d
movl $0xffffffff, 0x1c(%rsp) # imm = 0xFFFFFFFF
cmpl $0x1, %r10d
jne 0x93fb
movsd 0x48(%r9), %xmm0
movaps %xmm0, %xmm1
shufps $0x55, %xmm0, %xmm1     # xmm1 = xmm1[1,1],xmm0[1,1]
xorps 0x39e2(%rip), %xmm0     # 0xcda0
subss %xmm1, %xmm0
subss 0x50(%r9), %xmm0
mulss 0x3990(%rip), %xmm0     # 0xcd60
movaps %xmm0, %xmm1
addss %xmm0, %xmm1
addss %xmm0, %xmm1
maxss 0x3979(%rip), %xmm1     # 0xcd5c
minss 0x1c19(%rip), %xmm1     # 0xb004
mulss 0x1c15(%rip), %xmm1     # 0xb008
cvttss2si %xmm1, %edx
movl %edx, 0x1c(%rsp)
movslq 0xc(%rax,%rcx), %rbp
movslq 0x10(%rax,%rcx), %r13
movslq 0x14(%rax,%rcx), %r11
cmpl $0x2, %r10d
jne 0x94aa
movslq 0x18(%rax,%rcx), %rdx
movslq 0x1c(%rax,%rcx), %r14
movslq 0x20(%rax,%rcx), %rbx
testl %edx, %edx
setg %al
testl %r14d, %r14d
setg %cl
andb %al, %cl
testl %ebx, %ebx
setg %al
andb %cl, %al
cmpb $0x1, %al
jne 0x94ac
movq 0x8(%r15), %rax
decq %rdx
movq (%rax), %rcx
movslq 0x10(%rax), %rax
imulq %rdx, %rax
movsd (%rcx,%rax), %xmm3
movss 0x8(%rcx,%rax), %xmm2
movaps %xmm3, %xmm4
shufps $0x55, %xmm3, %xmm4     # xmm4 = xmm4[1,1],xmm3[1,1]
movaps %xmm4, %xmm0
mulss %xmm4, %xmm0
movaps %xmm3, %xmm1
mulss %xmm3, %xmm1
addss %xmm0, %xmm1
movaps %xmm2, %xmm0
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
xorps %xmm7, %xmm7
ucomiss %xmm7, %xmm0
movl %r10d, 0x14(%rsp)
movq %r11, 0x90(%rsp)
movss %xmm2, 0x8(%rsp)
movaps %xmm3, 0x60(%rsp)
movaps %xmm4, 0x50(%rsp)
movq %rdi, %r12
jb 0x94b1
sqrtss %xmm0, %xmm0
jmp 0x94b9
xorl %eax, %eax
jmp 0x97f5
callq 0x3730
xorps %xmm7, %xmm7
movss 0x1b43(%rip), %xmm5     # 0xb004
movaps %xmm5, %xmm6
divss %xmm0, %xmm6
movq 0x8(%r15), %rax
decq %r14
movq (%rax), %rcx
movslq 0x10(%rax), %rax
imulq %r14, %rax
movsd (%rcx,%rax), %xmm2
movss 0x8(%rcx,%rax), %xmm4
movaps %xmm2, %xmm3
shufps $0x55, %xmm2, %xmm3     # xmm3 = xmm3[1,1],xmm2[1,1]
movaps %xmm3, %xmm0
mulss %xmm3, %xmm0
movaps %xmm2, %xmm1
mulss %xmm2, %xmm1
addss %xmm0, %xmm1
movss %xmm4, 0x10(%rsp)
movaps %xmm4, %xmm0
mulss %xmm4, %xmm0
addss %xmm1, %xmm0
ucomiss %xmm7, %xmm0
jb 0x951a
sqrtss %xmm0, %xmm0
jmp 0x954d
movaps %xmm2, 0x80(%rsp)
movaps %xmm3, 0x70(%rsp)
movss %xmm6, 0x20(%rsp)
callq 0x3730
movss 0x20(%rsp), %xmm6
movss 0x1ac4(%rip), %xmm5     # 0xb004
movaps 0x70(%rsp), %xmm3
movaps 0x80(%rsp), %xmm2
movss 0x8(%rsp), %xmm12
movaps 0x60(%rsp), %xmm9
movaps 0x50(%rsp), %xmm8
mulss %xmm6, %xmm9
mulss %xmm6, %xmm8
mulss %xmm6, %xmm12
movaps %xmm5, %xmm1
divss %xmm0, %xmm1
mulss %xmm1, %xmm2
movaps %xmm2, 0x80(%rsp)
mulss %xmm1, %xmm3
movaps %xmm3, 0x70(%rsp)
movss 0x10(%rsp), %xmm0
mulss %xmm1, %xmm0
movss %xmm0, 0x10(%rsp)
movq 0x8(%r15), %rax
decq %rbx
movq (%rax), %rcx
movslq 0x10(%rax), %rax
imulq %rbx, %rax
movsd (%rcx,%rax), %xmm1
movss 0x8(%rcx,%rax), %xmm2
movaps %xmm1, %xmm0
shufps $0x55, %xmm1, %xmm0     # xmm0 = xmm0[1,1],xmm1[1,1]
movaps %xmm0, 0x20(%rsp)
mulss %xmm0, %xmm0
movaps %xmm1, 0xb0(%rsp)
mulss %xmm1, %xmm1
addss %xmm0, %xmm1
movaps %xmm2, %xmm3
movaps %xmm2, %xmm0
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jb 0x95f4
sqrtss %xmm0, %xmm0
jmp 0x9633
movss %xmm12, 0x8(%rsp)
movss %xmm3, 0x18(%rsp)
movaps %xmm9, 0x60(%rsp)
movaps %xmm8, 0x50(%rsp)
callq 0x3730
movss 0x19ea(%rip), %xmm5     # 0xb004
movaps 0x50(%rsp), %xmm8
movaps 0x60(%rsp), %xmm9
movss 0x18(%rsp), %xmm3
movss 0x8(%rsp), %xmm12
movq %r12, %rdi
leaq 0x1f8(%rsp), %r8
leaq 0x1a0(%rsp), %r9
movl 0x14(%rsp), %r10d
movq 0x90(%rsp), %r11
divss %xmm0, %xmm5
movaps 0xb0(%rsp), %xmm14
mulss %xmm5, %xmm14
movaps 0x20(%rsp), %xmm0
mulss %xmm5, %xmm0
movaps %xmm0, 0x20(%rsp)
movaps %xmm3, %xmm0
mulss %xmm5, %xmm0
movsd 0x18(%r8), %xmm2
movss 0x20(%r8), %xmm10
movsd 0x24(%r8), %xmm1
movss 0x2c(%r8), %xmm15
movsd 0x30(%r8), %xmm5
movaps %xmm2, %xmm3
shufps $0x55, %xmm2, %xmm3     # xmm3 = xmm3[1,1],xmm2[1,1]
movaps %xmm8, %xmm4
mulss %xmm3, %xmm4
movaps %xmm9, %xmm6
mulss %xmm2, %xmm6
addss %xmm4, %xmm6
movaps %xmm12, %xmm11
mulss %xmm10, %xmm11
addss %xmm6, %xmm11
movaps %xmm1, %xmm4
shufps $0x55, %xmm1, %xmm4     # xmm4 = xmm4[1,1],xmm1[1,1]
movaps %xmm8, %xmm6
mulss %xmm4, %xmm6
movaps %xmm9, %xmm7
mulss %xmm1, %xmm7
addss %xmm6, %xmm7
movaps %xmm12, %xmm6
mulss %xmm15, %xmm6
addss %xmm7, %xmm6
unpcklps %xmm6, %xmm11           # xmm11 = xmm11[0],xmm6[0],xmm11[1],xmm6[1]
movaps %xmm11, 0xa0(%rsp)
mulss %xmm5, %xmm9
movaps 0x80(%rsp), %xmm7
movaps %xmm7, %xmm6
mulss %xmm2, %xmm6
movaps %xmm7, %xmm11
mulss %xmm1, %xmm11
mulss %xmm5, %xmm7
mulss %xmm14, %xmm2
mulss %xmm14, %xmm1
mulss %xmm5, %xmm14
shufps $0x55, %xmm5, %xmm5     # xmm5 = xmm5[1,1,1,1]
mulss %xmm5, %xmm8
addss %xmm8, %xmm9
movss 0x38(%r8), %xmm8
mulss %xmm8, %xmm12
addss %xmm9, %xmm12
movss %xmm12, 0x8(%rsp)
movaps 0x70(%rsp), %xmm13
movaps %xmm13, %xmm9
mulss %xmm3, %xmm9
addss %xmm9, %xmm6
movss 0x10(%rsp), %xmm9
movaps %xmm9, %xmm12
mulss %xmm10, %xmm12
addss %xmm6, %xmm12
movaps %xmm13, %xmm6
mulss %xmm4, %xmm6
addss %xmm6, %xmm11
movaps %xmm9, %xmm6
mulss %xmm15, %xmm6
addss %xmm11, %xmm6
unpcklps %xmm6, %xmm12           # xmm12 = xmm12[0],xmm6[0],xmm12[1],xmm6[1]
mulss %xmm5, %xmm13
addss %xmm13, %xmm7
mulss %xmm8, %xmm9
addss %xmm7, %xmm9
movaps %xmm9, %xmm11
movaps 0x20(%rsp), %xmm6
mulss %xmm6, %xmm3
addss %xmm3, %xmm2
mulss %xmm0, %xmm10
addss %xmm2, %xmm10
mulss %xmm6, %xmm4
addss %xmm4, %xmm1
mulss %xmm0, %xmm15
addss %xmm1, %xmm15
unpcklps %xmm15, %xmm10          # xmm10 = xmm10[0],xmm15[0],xmm10[1],xmm15[1]
movaps %xmm10, %xmm9
mulss %xmm6, %xmm5
addss %xmm5, %xmm14
mulss %xmm8, %xmm0
addss %xmm14, %xmm0
movaps %xmm0, %xmm10
movb $0x1, %al
movss 0x4(%r9), %xmm2
movss 0x1800(%rip), %xmm8     # 0xb004
movss 0x10(%r9), %xmm0
movaps %xmm2, %xmm3
cmpunordss %xmm2, %xmm3
movaps %xmm3, %xmm1
andps %xmm0, %xmm1
movaps %xmm0, %xmm4
minss %xmm2, %xmm4
andnps %xmm4, %xmm3
orps %xmm1, %xmm3
movss 0x1c(%r9), %xmm1
movaps %xmm1, %xmm4
minss %xmm3, %xmm4
cmpunordss %xmm3, %xmm3
movaps %xmm3, %xmm5
andnps %xmm4, %xmm5
andps %xmm1, %xmm3
orps %xmm5, %xmm3
cvttss2si %xmm3, %ecx
ucomiss %xmm2, %xmm2
jp 0x9850
maxss %xmm2, %xmm0
movaps %xmm1, %xmm2
maxss %xmm0, %xmm2
cmpunordss %xmm0, %xmm0
movaps %xmm0, %xmm3
andnps %xmm2, %xmm3
andps %xmm1, %xmm0
orps %xmm3, %xmm0
addss %xmm8, %xmm0
cvttss2si %xmm0, %edx
movl %edx, 0x38(%rsp)
cmpl %edx, %ecx
jge 0x9e49
movss (%r9), %xmm3
movss 0xc(%r9), %xmm2
movaps %xmm3, %xmm0
cmpunordss %xmm3, %xmm0
movaps %xmm2, %xmm1
maxss %xmm3, %xmm1
movaps %xmm0, %xmm4
andps %xmm2, %xmm4
movaps %xmm0, %xmm5
andnps %xmm1, %xmm5
movss 0x18(%r9), %xmm1
orps %xmm4, %xmm5
movaps %xmm1, %xmm6
maxss %xmm5, %xmm6
cmpunordss %xmm5, %xmm5
movq 0x10(%r15), %rdx
movaps %xmm5, %xmm7
andnps %xmm6, %xmm7
andps %xmm1, %xmm5
orps %xmm7, %xmm5
decq %rbp
movslq 0x10(%rdx), %rsi
decq %r13
decq %r11
movq (%rdx), %rdx
imulq %rsi, %rbp
imulq %rsi, %r13
imulq %rsi, %r11
addss %xmm8, %xmm5
movss (%rdx,%rbp), %xmm6
movss %xmm6, 0xb0(%rsp)
movss 0x4(%rdx,%rbp), %xmm6
movss %xmm6, 0x18(%rsp)
movss (%rdx,%r13), %xmm6
movss %xmm6, 0x4c(%rsp)
movss 0x4(%rdx,%r13), %xmm6
movss %xmm6, 0x48(%rsp)
cvttss2si %xmm5, %r13d
minss %xmm3, %xmm2
andnps %xmm2, %xmm0
orps %xmm4, %xmm0
movaps %xmm1, %xmm2
minss %xmm0, %xmm2
cmpunordss %xmm0, %xmm0
movaps %xmm0, %xmm3
andnps %xmm2, %xmm3
andps %xmm1, %xmm0
orps %xmm3, %xmm0
cvttss2si %xmm0, %ebp
movsd (%r9), %xmm0
movsd 0xc(%r9), %xmm1
movsd 0x18(%r9), %xmm3
movaps %xmm3, %xmm2
shufps $0x55, %xmm3, %xmm2     # xmm2 = xmm2[1,1],xmm3[1,1]
movaps %xmm3, %xmm4
subss %xmm1, %xmm4
movaps %xmm1, %xmm5
subps %xmm3, %xmm5
shufps $0x55, %xmm5, %xmm5     # xmm5 = xmm5[1,1,1,1]
movaps %xmm0, %xmm1
subss %xmm3, %xmm1
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movaps %xmm2, %xmm6
subss %xmm0, %xmm6
movaps %xmm2, 0xf0(%rsp)
subss %xmm2, %xmm0
movaps %xmm4, 0xe0(%rsp)
mulss %xmm4, %xmm0
movaps %xmm5, %xmm4
movaps %xmm1, 0xd0(%rsp)
mulss %xmm1, %xmm4
addss %xmm0, %xmm4
movaps 0xa0(%rsp), %xmm2
movaps %xmm2, %xmm0
shufps $0x55, %xmm2, %xmm0     # xmm0 = xmm0[1,1],xmm2[1,1]
movaps 0x33dd(%rip), %xmm1     # 0xcda0
xorps %xmm1, %xmm2
subss %xmm0, %xmm2
movss (%rdx,%r11), %xmm0
movss %xmm0, 0x44(%rsp)
subss 0x8(%rsp), %xmm2
movaps %xmm2, 0xa0(%rsp)
movaps %xmm12, %xmm2
movaps %xmm12, %xmm0
shufps $0x55, %xmm12, %xmm0    # xmm0 = xmm0[1,1],xmm12[1,1]
xorps %xmm1, %xmm2
subss %xmm0, %xmm2
movss 0x4(%rdx,%r11), %xmm0
movss %xmm0, 0x40(%rsp)
cmpl $0x2, %r10d
sete %dl
movl 0x4(%r8), %esi
movl %esi, 0x70(%rsp)
movl 0x8(%r8), %esi
movl %esi, 0x3c(%rsp)
subss %xmm11, %xmm2
movaps %xmm2, 0x100(%rsp)
movaps %xmm9, %xmm2
movaps %xmm9, %xmm0
xorps %xmm1, %xmm2
movss 0x8(%r9), %xmm1
movss %xmm1, 0x8(%rsp)
shufps $0x55, %xmm9, %xmm0     # xmm0 = xmm0[1,1],xmm9[1,1]
subss %xmm0, %xmm2
movss 0x14(%r9), %xmm0
movss %xmm0, 0x10(%rsp)
subss %xmm10, %xmm2
movaps %xmm2, 0x110(%rsp)
movss 0x20(%r9), %xmm0
movss %xmm0, 0x20(%rsp)
andb %al, %dl
movb %dl, 0xf(%rsp)
movslq %ebp, %rax
movslq %ecx, %r15
leaq (%r15,%r15,4), %rcx
shlq $0x8, %rcx
leaq (%rcx,%rax,4), %r12
addq 0x40(%r8), %r12
movss 0x32d2(%rip), %xmm2     # 0xcd64
movl %ebp, 0x34(%rsp)
movaps %xmm3, 0x150(%rsp)
movaps %xmm5, 0x140(%rsp)
movaps %xmm6, 0x130(%rsp)
movaps %xmm4, 0x120(%rsp)
cmpl %r13d, %ebp
jge 0x9e30
xorps %xmm7, %xmm7
cvtsi2ss %r15d, %xmm7
subss 0xf0(%rsp), %xmm7
movaps 0xe0(%rsp), %xmm9
mulss %xmm7, %xmm9
mulss 0xd0(%rsp), %xmm7
movq %r12, %r14
movss %xmm7, 0x14(%rsp)
movaps %xmm9, 0x90(%rsp)
xorps %xmm10, %xmm10
cvtsi2ss %ebp, %xmm10
subss %xmm3, %xmm10
movaps %xmm5, %xmm11
mulss %xmm10, %xmm11
addss %xmm9, %xmm11
divss %xmm4, %xmm11
ucomiss %xmm2, %xmm11
jb 0x9e21
mulss %xmm6, %xmm10
addss %xmm7, %xmm10
divss %xmm4, %xmm10
ucomiss %xmm2, %xmm10
jb 0x9e21
movaps %xmm8, %xmm12
subss %xmm11, %xmm12
subss %xmm10, %xmm12
ucomiss %xmm2, %xmm12
jb 0x9e21
cmpl $0x0, 0x70(%rsp)
je 0x9b91
movaps %xmm10, %xmm0
mulss 0x10(%rsp), %xmm0
movaps %xmm11, %xmm1
mulss 0x8(%rsp), %xmm1
addss %xmm0, %xmm1
movaps %xmm12, %xmm0
mulss 0x20(%rsp), %xmm0
addss %xmm1, %xmm0
ucomiss (%r14), %xmm0
ja 0x9e21
movss %xmm0, (%r14)
movaps %xmm10, %xmm2
movaps %xmm11, %xmm1
movaps %xmm12, %xmm0
cmpl $0x0, 0x3c(%rsp)
je 0x9bd9
movaps %xmm11, %xmm1
divss 0x8(%rsp), %xmm1
movaps %xmm10, %xmm2
divss 0x10(%rsp), %xmm2
movaps %xmm12, %xmm0
divss 0x20(%rsp), %xmm0
movaps %xmm1, %xmm3
addss %xmm2, %xmm3
addss %xmm0, %xmm3
divss %xmm3, %xmm1
divss %xmm3, %xmm2
divss %xmm3, %xmm0
movss %xmm12, 0x80(%rsp)
movss %xmm11, 0x50(%rsp)
movss %xmm10, 0x60(%rsp)
movss 0x4c(%rsp), %xmm3
mulss %xmm2, %xmm3
movaps %xmm1, %xmm4
mulss 0xb0(%rsp), %xmm4
addss %xmm3, %xmm4
movaps %xmm0, %xmm3
mulss 0x44(%rsp), %xmm3
addss %xmm4, %xmm3
mulss 0x48(%rsp), %xmm2
mulss 0x18(%rsp), %xmm1
addss %xmm2, %xmm1
mulss 0x40(%rsp), %xmm0
addss %xmm1, %xmm0
movl (%rdi), %esi
xorps %xmm1, %xmm1
cvtsi2ss %esi, %xmm1
movaps %xmm8, %xmm2
mulss %xmm3, %xmm1
cvttss2si %xmm1, %eax
movl 0x4(%rdi), %r8d
xorps %xmm1, %xmm1
cvtsi2ss %r8d, %xmm1
subss %xmm0, %xmm2
mulss %xmm2, %xmm1
cvttss2si %xmm1, %ecx
cltd
idivl %esi
movl %edx, %esi
movl %ecx, %eax
cltd
idivl %r8d
movq %rdi, %rbx
callq 0x42b9
cmpb $0x0, 0xf(%rsp)
movl 0x1c(%rsp), %edi
je 0x9d7d
movaps 0xa0(%rsp), %xmm2
movaps %xmm2, %xmm0
movss 0x60(%rsp), %xmm8
mulss %xmm8, %xmm0
movss 0x50(%rsp), %xmm9
movaps %xmm9, %xmm1
mulss %xmm2, %xmm1
addss %xmm0, %xmm1
movss 0x80(%rsp), %xmm10
movaps %xmm10, %xmm0
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss 0x3093(%rip), %xmm6     # 0xcd5c
maxss %xmm6, %xmm0
movss 0x132f(%rip), %xmm5     # 0xb004
minss %xmm5, %xmm0
movss 0x1327(%rip), %xmm7     # 0xb008
mulss %xmm7, %xmm0
movaps 0x100(%rsp), %xmm3
movaps %xmm3, %xmm1
mulss %xmm8, %xmm1
movaps %xmm9, %xmm2
mulss %xmm3, %xmm2
addss %xmm1, %xmm2
movaps %xmm10, %xmm1
mulss %xmm3, %xmm1
addss %xmm2, %xmm1
maxss %xmm6, %xmm1
minss %xmm5, %xmm1
mulss %xmm7, %xmm1
movaps 0x110(%rsp), %xmm4
movaps %xmm4, %xmm2
mulss %xmm8, %xmm2
movaps %xmm9, %xmm3
mulss %xmm4, %xmm3
addss %xmm2, %xmm3
movaps %xmm10, %xmm2
mulss %xmm4, %xmm2
addss %xmm3, %xmm2
maxss %xmm6, %xmm2
minss %xmm5, %xmm2
mulss %xmm7, %xmm2
cvttps2dq %xmm0, %xmm0
cvtdq2ps %xmm0, %xmm0
cvttps2dq %xmm1, %xmm1
cvtdq2ps %xmm1, %xmm1
mulss %xmm8, %xmm1
mulss %xmm9, %xmm0
addss %xmm1, %xmm0
cvttps2dq %xmm2, %xmm1
cvtdq2ps %xmm1, %xmm1
mulss %xmm10, %xmm1
addss %xmm0, %xmm1
cvttss2si %xmm1, %edi
movl %eax, %esi
shrl $0x8, %esi
movl %eax, %edx
shrl $0x10, %edx
testl %edi, %edi
movl $0xff, %r8d
movl %edi, 0x1c(%rsp)
movl %eax, %ecx
js 0x9db2
andl %r8d, %ecx
imull %edi, %ecx
shrl $0x8, %ecx
andl %r8d, %esi
imull %edi, %esi
shrl $0x8, %esi
andl %r8d, %edx
imull %edi, %edx
shrl $0x8, %edx
andl $0xff000000, %eax       # imm = 0xFF000000
andl %r8d, %edx
shll $0x10, %edx
orl %eax, %edx
shll $0x8, %esi
movzwl %si, %eax
andl %r8d, %ecx
orl %eax, %ecx
orl %edx, %ecx
movq 0xc8(%rsp), %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x3c26
movq %rbx, %rdi
movss 0x121a(%rip), %xmm8     # 0xb004
movaps 0x150(%rsp), %xmm3
movaps 0x140(%rsp), %xmm5
movaps 0x130(%rsp), %xmm6
movaps 0x120(%rsp), %xmm4
movss 0x2f52(%rip), %xmm2     # 0xcd64
movss 0x14(%rsp), %xmm7
movaps 0x90(%rsp), %xmm9
addq $0x4, %r14
incl %ebp
cmpl %ebp, %r13d
jne 0x9af9
incq %r15
addq $0x500, %r12            # imm = 0x500
cmpl 0x38(%rsp), %r15d
movl 0x34(%rsp), %ebp
jne 0x9ab6
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq