// File: alan0201tw[P]RayTracer/include/stb_image.h
// Function: stbi__process_marker(stbi__jpeg*, int)
static int stbi__process_marker(stbi__jpeg *z, int m)
{
   int L;
   switch (m) {
      case STBI__MARKER_none: // no marker found
         return stbi__err("expected marker","Corrupt JPEG");

      case 0xDD: // DRI - specify restart interval
         if (stbi__get16be(z->s) != 4) return stbi__err("bad DRI len","Corrupt JPEG");
         z->restart_interval = stbi__get16be(z->s);
         return 1;

      case 0xDB: // DQT - define quantization table
         L = stbi__get16be(z->s)-2;
         while (L > 0) {
            int q = stbi__get8(z->s);
            int p = q >> 4, sixteen = (p != 0);
            int t = q & 15,i;
            if (p != 0 && p != 1) return stbi__err("bad DQT type","Corrupt JPEG");
            if (t > 3) return stbi__err("bad DQT table","Corrupt JPEG");

            for (i=0; i < 64; ++i)
               z->dequant[t][stbi__jpeg_dezigzag[i]] = (stbi__uint16)(sixteen ? stbi__get16be(z->s) : stbi__get8(z->s));
            L -= (sixteen ? 129 : 65);
         }
         return L==0;

      case 0xC4: // DHT - define huffman table
         L = stbi__get16be(z->s)-2;
         while (L > 0) {
            stbi_uc *v;
            int sizes[16],i,n=0;
            int q = stbi__get8(z->s);
            int tc = q >> 4;
            int th = q & 15;
            if (tc > 1 || th > 3) return stbi__err("bad DHT header","Corrupt JPEG");
            for (i=0; i < 16; ++i) {
               sizes[i] = stbi__get8(z->s);
               n += sizes[i];
            }
            L -= 17;
            if (tc == 0) {
               if (!stbi__build_huffman(z->huff_dc+th, sizes)) return 0;
               v = z->huff_dc[th].values;
            } else {
               if (!stbi__build_huffman(z->huff_ac+th, sizes)) return 0;
               v = z->huff_ac[th].values;
            }
            for (i=0; i < n; ++i)
               v[i] = stbi__get8(z->s);
            if (tc != 0)
               stbi__build_fast_ac(z->fast_ac[th], z->huff_ac + th);
            L -= n;
         }
         return L==0;
   }

   // check for comment block or APP blocks
   if ((m >= 0xE0 && m <= 0xEF) || m == 0xFE) {
      L = stbi__get16be(z->s);
      if (L < 2) {
         if (m == 0xFE)
            return stbi__err("bad COM len","Corrupt JPEG");
         else
            return stbi__err("bad APP len","Corrupt JPEG");
      }
      L -= 2;

      if (m == 0xE0 && L >= 5) { // JFIF APP0 segment
         static const unsigned char tag[5] = {'J','F','I','F','\0'};
         int ok = 1;
         int i;
         for (i=0; i < 5; ++i)
            if (stbi__get8(z->s) != tag[i])
               ok = 0;
         L -= 5;
         if (ok)
            z->jfif = 1;
      } else if (m == 0xEE && L >= 12) { // Adobe APP14 segment
         static const unsigned char tag[6] = {'A','d','o','b','e','\0'};
         int ok = 1;
         int i;
         for (i=0; i < 6; ++i)
            if (stbi__get8(z->s) != tag[i])
               ok = 0;
         L -= 6;
         if (ok) {
            stbi__get8(z->s); // version
            stbi__get16be(z->s); // flags0
            stbi__get16be(z->s); // flags1
            z->app14_color_transform = stbi__get8(z->s); // color transform
            L -= 6;
         }
      }

      stbi__skip(z->s, L);
      return 1;
   }

   return stbi__err("unknown marker","Corrupt JPEG");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0xa8(%rbp)
subl $0xc4, %eax
je 0x64f6f
jmp 0x64da8
movl -0xa8(%rbp), %eax
subl $0xdb, %eax
je 0x64e3a
jmp 0x64dbb
movl -0xa8(%rbp), %eax
subl $0xdd, %eax
je 0x64df1
jmp 0x64dca
movl -0xa8(%rbp), %eax
subl $0xff, %eax
jne 0x651b7
jmp 0x64ddd
leaq 0x1c23f(%rip), %rdi     # 0x81023
callq 0x56040
movl %eax, -0x4(%rbp)
jmp 0x653b9
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x65e40
cmpl $0x4, %eax
je 0x64e16
leaq 0x1c22a(%rip), %rdi     # 0x81033
callq 0x56040
movl %eax, -0x4(%rbp)
jmp 0x653b9
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x65e40
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x4868(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x653b9
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x65e40
subl $0x2, %eax
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jle 0x64f5b
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x65d00
movzbl %al, %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
sarl $0x4, %eax
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x24(%rbp)
movl -0x1c(%rbp), %eax
andl $0xf, %eax
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x20(%rbp)
je 0x64ea9
cmpl $0x1, -0x20(%rbp)
je 0x64ea9
leaq 0x1c1a3(%rip), %rdi     # 0x8103f
callq 0x56040
movl %eax, -0x4(%rbp)
jmp 0x653b9
cmpl $0x3, -0x28(%rbp)
jle 0x64ec3
leaq 0x1c196(%rip), %rdi     # 0x8104c
callq 0x56040
movl %eax, -0x4(%rbp)
jmp 0x653b9
movl $0x0, -0x2c(%rbp)
cmpl $0x40, -0x2c(%rbp)
jge 0x64f3b
cmpl $0x0, -0x24(%rbp)
je 0x64eea
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x65e40
movl %eax, -0xac(%rbp)
jmp 0x64eff
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x65d00
movzbl %al, %eax
movl %eax, -0xac(%rbp)
movl -0xac(%rbp), %eax
movw %ax, %dx
movq -0x10(%rbp), %rax
addq $0x3488, %rax           # imm = 0x3488
movslq -0x28(%rbp), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movslq -0x2c(%rbp), %rsi
leaq 0x1a548(%rip), %rcx     # 0x7f470
movzbl (%rcx,%rsi), %ecx
movw %dx, (%rax,%rcx,2)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x64eca
movl -0x24(%rbp), %edx
movl $0x41, %ecx
movl $0x81, %eax
cmpl $0x0, %edx
cmovnel %eax, %ecx
movl -0x18(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x18(%rbp)
jmp 0x64e4c
cmpl $0x0, -0x18(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
jmp 0x653b9
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x65e40
subl $0x2, %eax
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jle 0x651a3
movl $0x0, -0x88(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x65d00
movzbl %al, %eax
movl %eax, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
sarl $0x4, %eax
movl %eax, -0x90(%rbp)
movl -0x8c(%rbp), %eax
andl $0xf, %eax
movl %eax, -0x94(%rbp)
cmpl $0x1, -0x90(%rbp)
jg 0x64fda
cmpl $0x3, -0x94(%rbp)
jle 0x64fee
leaq 0x1c079(%rip), %rdi     # 0x8105a
callq 0x56040
movl %eax, -0x4(%rbp)
jmp 0x653b9
movl $0x0, -0x84(%rbp)
cmpl $0x10, -0x84(%rbp)
jge 0x65043
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x65d00
movzbl %al, %ecx
movslq -0x84(%rbp), %rax
movl %ecx, -0x80(%rbp,%rax,4)
movslq -0x84(%rbp), %rax
movl -0x80(%rbp,%rax,4), %eax
addl -0x88(%rbp), %eax
movl %eax, -0x88(%rbp)
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x64ff8
movl -0x18(%rbp), %eax
subl $0x11, %eax
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x90(%rbp)
jne 0x650ad
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
movslq -0x94(%rbp), %rax
imulq $0x690, %rax, %rax      # imm = 0x690
addq %rax, %rdi
leaq -0x80(%rbp), %rsi
callq 0x65e80
cmpl $0x0, %eax
jne 0x65088
movl $0x0, -0x4(%rbp)
jmp 0x653b9
movq -0x10(%rbp), %rax
addq $0x8, %rax
movslq -0x94(%rbp), %rcx
imulq $0x690, %rcx, %rcx      # imm = 0x690
addq %rcx, %rax
addq $0x400, %rax            # imm = 0x400
movq %rax, -0x38(%rbp)
jmp 0x65108
movq -0x10(%rbp), %rdi
addq $0x1a48, %rdi           # imm = 0x1A48
movslq -0x94(%rbp), %rax
imulq $0x690, %rax, %rax      # imm = 0x690
addq %rax, %rdi
leaq -0x80(%rbp), %rsi
callq 0x65e80
cmpl $0x0, %eax
jne 0x650e3
movl $0x0, -0x4(%rbp)
jmp 0x653b9
movq -0x10(%rbp), %rax
addq $0x1a48, %rax           # imm = 0x1A48
movslq -0x94(%rbp), %rcx
imulq $0x690, %rcx, %rcx      # imm = 0x690
addq %rcx, %rax
addq $0x400, %rax            # imm = 0x400
movq %rax, -0x38(%rbp)
movl $0x0, -0x84(%rbp)
movl -0x84(%rbp), %eax
cmpl -0x88(%rbp), %eax
jge 0x6514d
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x65d00
movb %al, %dl
movq -0x38(%rbp), %rax
movslq -0x84(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x65112
cmpl $0x0, -0x90(%rbp)
je 0x65190
movq -0x10(%rbp), %rdi
addq $0x3688, %rdi           # imm = 0x3688
movslq -0x94(%rbp), %rax
shlq $0xa, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rsi
addq $0x1a48, %rsi           # imm = 0x1A48
movslq -0x94(%rbp), %rax
imulq $0x690, %rax, %rax      # imm = 0x690
addq %rax, %rsi
callq 0x660c0
movl -0x88(%rbp), %ecx
movl -0x18(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x18(%rbp)
jmp 0x64f81
cmpl $0x0, -0x18(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
jmp 0x653b9
cmpl $0xe0, -0x14(%rbp)
jl 0x651c9
cmpl $0xef, -0x14(%rbp)
jle 0x651d6
cmpl $0xfe, -0x14(%rbp)
jne 0x653aa
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x65e40
movl %eax, -0x18(%rbp)
cmpl $0x2, -0x18(%rbp)
jge 0x6521c
cmpl $0xfe, -0x14(%rbp)
jne 0x65208
leaq 0x1be6e(%rip), %rdi     # 0x81069
callq 0x56040
movl %eax, -0x4(%rbp)
jmp 0x653b9
leaq 0x1be66(%rip), %rdi     # 0x81075
callq 0x56040
movl %eax, -0x4(%rbp)
jmp 0x653b9
movl -0x18(%rbp), %eax
subl $0x2, %eax
movl %eax, -0x18(%rbp)
cmpl $0xe0, -0x14(%rbp)
jne 0x652c0
cmpl $0x5, -0x18(%rbp)
jl 0x652c0
movl $0x1, -0x98(%rbp)
movl $0x0, -0x9c(%rbp)
cmpl $0x5, -0x9c(%rbp)
jge 0x6529b
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x65d00
movzbl %al, %eax
movslq -0x9c(%rbp), %rdx
leaq 0x1a249(%rip), %rcx     # 0x7f4bf
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
je 0x65288
movl $0x0, -0x98(%rbp)
jmp 0x6528a
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x65250
movl -0x18(%rbp), %eax
subl $0x5, %eax
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x98(%rbp)
je 0x652bb
movq -0x10(%rbp), %rax
movl $0x1, 0x4848(%rax)
jmp 0x65392
cmpl $0xee, -0x14(%rbp)
jne 0x65390
cmpl $0xc, -0x18(%rbp)
jl 0x65390
movl $0x1, -0xa0(%rbp)
movl $0x0, -0xa4(%rbp)
cmpl $0x6, -0xa4(%rbp)
jge 0x65336
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x65d00
movzbl %al, %eax
movslq -0xa4(%rbp), %rdx
leaq 0x1a1b3(%rip), %rcx     # 0x7f4c4
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
je 0x65323
movl $0x0, -0xa0(%rbp)
jmp 0x65325
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0x652eb
movl -0x18(%rbp), %eax
subl $0x6, %eax
movl %eax, -0x18(%rbp)
cmpl $0x0, -0xa0(%rbp)
je 0x6538e
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x65d00
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x65e40
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x65e40
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x65d00
movzbl %al, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x484c(%rax)
movl -0x18(%rbp), %eax
subl $0x6, %eax
movl %eax, -0x18(%rbp)
jmp 0x65390
jmp 0x65392
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movl -0x18(%rbp), %esi
callq 0x661f0
movl $0x1, -0x4(%rbp)
jmp 0x653b9
leaq 0x1bcd0(%rip), %rdi     # 0x81081
callq 0x56040
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)