// File: /workspace/github_c_makefile_star2_O0/salextpuru[P]speccy-toochain/src/unsorted0/attranim-ppm2frame.c
// Function: main
int main()
{
int a,x,y,f,r,g,b;
int col,dark,light;
unsigned char *ptr;
int i,n,v,sy;
int addr=0x5800+10;
unsigned char buf[32];

for(f=0;f<14;f++) getchar();

fread(image,1,64*24*3,stdin);

for(y=0;y<24;y++)
  {
  for(x=0;x<64;x+=2)
    {
    r=image[(y*64+x)*3  ];
    g=image[(y*64+x)*3+1];
    b=image[(y*64+x)*3+2];
    if(r==0 && g==0 && b==0) col=0;
    if(r==0 && g==0 && b!=0) col=1;
    if(r!=0 && g==0 && b==0) col=2;
    if(r!=0 && g==0 && b!=0) col=3;
    if(r==0 && g!=0 && b==0) col=4;
    if(r==0 && g!=0 && b!=0) col=5;
    if(r!=0 && g!=0 && b==0) col=6;
    if(r!=0 && g!=0 && b!=0) col=7;
    i=col;
    r=image[(y*64+x+1)*3  ];
    g=image[(y*64+x+1)*3+1];
    b=image[(y*64+x+1)*3+2];
    if(r==0 && g==0 && b==0) col=0;
    if(r==0 && g==0 && b!=0) col=1;
    if(r!=0 && g==0 && b==0) col=2;
    if(r!=0 && g==0 && b!=0) col=3;
    if(r==0 && g!=0 && b==0) col=4;
    if(r==0 && g!=0 && b!=0) col=5;
    if(r!=0 && g!=0 && b==0) col=6;
    if(r!=0 && g!=0 && b!=0) col=7;
    /* paper left, ink right */
    buf[x/2]=(i*8+col);
    }
  
  for(x=0;x<32;x+=4)
    {
    putchar((buf[x+0]<<2)|(buf[x+1]>>4));
    putchar((buf[x+1]<<4)|(buf[x+2]>>2));
    putchar((buf[x+2]<<2)|(buf[x+3]));
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movl $0x0, -0x4(%rbp)
movl $0x580a, -0x4c(%rbp)    # imm = 0x580A
movl $0x0, -0x14(%rbp)
cmpl $0xe, -0x14(%rbp)
jge 0x1193
callq 0x1030
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x117d
movq 0x2e46(%rip), %rax      # 0x3fe0
movq (%rax), %rcx
leaq 0x2f0c(%rip), %rdi      # 0x40b0
movl $0x1, %esi
movl $0x1200, %edx           # imm = 0x1200
callq 0x1050
movl $0x0, -0x10(%rbp)
cmpl $0x18, -0x10(%rbp)
jge 0x14f9
movl $0x0, -0xc(%rbp)
cmpl $0x40, -0xc(%rbp)
jge 0x1458
movl -0x10(%rbp), %eax
shll $0x6, %eax
addl -0xc(%rbp), %eax
imull $0x3, %eax, %eax
movslq %eax, %rcx
leaq 0x2ec5(%rip), %rax      # 0x40b0
movzbl (%rax,%rcx), %eax
movl %eax, -0x18(%rbp)
movl -0x10(%rbp), %eax
shll $0x6, %eax
addl -0xc(%rbp), %eax
imull $0x3, %eax, %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq 0x2ea5(%rip), %rax      # 0x40b0
movzbl (%rax,%rcx), %eax
movl %eax, -0x1c(%rbp)
movl -0x10(%rbp), %eax
shll $0x6, %eax
addl -0xc(%rbp), %eax
imull $0x3, %eax, %eax
addl $0x2, %eax
movslq %eax, %rcx
leaq 0x2e85(%rip), %rax      # 0x40b0
movzbl (%rax,%rcx), %eax
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x18(%rbp)
jne 0x124b
cmpl $0x0, -0x1c(%rbp)
jne 0x124b
cmpl $0x0, -0x20(%rbp)
jne 0x124b
movl $0x0, -0x24(%rbp)
cmpl $0x0, -0x18(%rbp)
jne 0x1264
cmpl $0x0, -0x1c(%rbp)
jne 0x1264
cmpl $0x0, -0x20(%rbp)
je 0x1264
movl $0x1, -0x24(%rbp)
cmpl $0x0, -0x18(%rbp)
je 0x127d
cmpl $0x0, -0x1c(%rbp)
jne 0x127d
cmpl $0x0, -0x20(%rbp)
jne 0x127d
movl $0x2, -0x24(%rbp)
cmpl $0x0, -0x18(%rbp)
je 0x1296
cmpl $0x0, -0x1c(%rbp)
jne 0x1296
cmpl $0x0, -0x20(%rbp)
je 0x1296
movl $0x3, -0x24(%rbp)
cmpl $0x0, -0x18(%rbp)
jne 0x12af
cmpl $0x0, -0x1c(%rbp)
je 0x12af
cmpl $0x0, -0x20(%rbp)
jne 0x12af
movl $0x4, -0x24(%rbp)
cmpl $0x0, -0x18(%rbp)
jne 0x12c8
cmpl $0x0, -0x1c(%rbp)
je 0x12c8
cmpl $0x0, -0x20(%rbp)
je 0x12c8
movl $0x5, -0x24(%rbp)
cmpl $0x0, -0x18(%rbp)
je 0x12e1
cmpl $0x0, -0x1c(%rbp)
je 0x12e1
cmpl $0x0, -0x20(%rbp)
jne 0x12e1
movl $0x6, -0x24(%rbp)
cmpl $0x0, -0x18(%rbp)
je 0x12fa
cmpl $0x0, -0x1c(%rbp)
je 0x12fa
cmpl $0x0, -0x20(%rbp)
je 0x12fa
movl $0x7, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x10(%rbp), %eax
shll $0x6, %eax
addl -0xc(%rbp), %eax
addl $0x1, %eax
imull $0x3, %eax, %eax
movslq %eax, %rcx
leaq 0x2d97(%rip), %rax      # 0x40b0
movzbl (%rax,%rcx), %eax
movl %eax, -0x18(%rbp)
movl -0x10(%rbp), %eax
shll $0x6, %eax
addl -0xc(%rbp), %eax
addl $0x1, %eax
imull $0x3, %eax, %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq 0x2d74(%rip), %rax      # 0x40b0
movzbl (%rax,%rcx), %eax
movl %eax, -0x1c(%rbp)
movl -0x10(%rbp), %eax
shll $0x6, %eax
addl -0xc(%rbp), %eax
addl $0x1, %eax
imull $0x3, %eax, %eax
addl $0x2, %eax
movslq %eax, %rcx
leaq 0x2d51(%rip), %rax      # 0x40b0
movzbl (%rax,%rcx), %eax
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x18(%rbp)
jne 0x137f
cmpl $0x0, -0x1c(%rbp)
jne 0x137f
cmpl $0x0, -0x20(%rbp)
jne 0x137f
movl $0x0, -0x24(%rbp)
cmpl $0x0, -0x18(%rbp)
jne 0x1398
cmpl $0x0, -0x1c(%rbp)
jne 0x1398
cmpl $0x0, -0x20(%rbp)
je 0x1398
movl $0x1, -0x24(%rbp)
cmpl $0x0, -0x18(%rbp)
je 0x13b1
cmpl $0x0, -0x1c(%rbp)
jne 0x13b1
cmpl $0x0, -0x20(%rbp)
jne 0x13b1
movl $0x2, -0x24(%rbp)
cmpl $0x0, -0x18(%rbp)
je 0x13ca
cmpl $0x0, -0x1c(%rbp)
jne 0x13ca
cmpl $0x0, -0x20(%rbp)
je 0x13ca
movl $0x3, -0x24(%rbp)
cmpl $0x0, -0x18(%rbp)
jne 0x13e3
cmpl $0x0, -0x1c(%rbp)
je 0x13e3
cmpl $0x0, -0x20(%rbp)
jne 0x13e3
movl $0x4, -0x24(%rbp)
cmpl $0x0, -0x18(%rbp)
jne 0x13fc
cmpl $0x0, -0x1c(%rbp)
je 0x13fc
cmpl $0x0, -0x20(%rbp)
je 0x13fc
movl $0x5, -0x24(%rbp)
cmpl $0x0, -0x18(%rbp)
je 0x1415
cmpl $0x0, -0x1c(%rbp)
je 0x1415
cmpl $0x0, -0x20(%rbp)
jne 0x1415
movl $0x6, -0x24(%rbp)
cmpl $0x0, -0x18(%rbp)
je 0x142e
cmpl $0x0, -0x1c(%rbp)
je 0x142e
cmpl $0x0, -0x20(%rbp)
je 0x142e
movl $0x7, -0x24(%rbp)
movl -0x3c(%rbp), %eax
shll $0x3, %eax
addl -0x24(%rbp), %eax
movb %al, %cl
movl -0xc(%rbp), %eax
movl $0x2, %esi
cltd
idivl %esi
cltq
movb %cl, -0x70(%rbp,%rax)
movl -0xc(%rbp), %eax
addl $0x2, %eax
movl %eax, -0xc(%rbp)
jmp 0x11cb
movl $0x0, -0xc(%rbp)
cmpl $0x20, -0xc(%rbp)
jge 0x14e9
movl -0xc(%rbp), %eax
addl $0x0, %eax
cltq
movzbl -0x70(%rbp,%rax), %edi
shll $0x2, %edi
movl -0xc(%rbp), %eax
addl $0x1, %eax
cltq
movzbl -0x70(%rbp,%rax), %eax
sarl $0x4, %eax
orl %eax, %edi
callq 0x1040
movl -0xc(%rbp), %eax
addl $0x1, %eax
cltq
movzbl -0x70(%rbp,%rax), %edi
shll $0x4, %edi
movl -0xc(%rbp), %eax
addl $0x2, %eax
cltq
movzbl -0x70(%rbp,%rax), %eax
sarl $0x2, %eax
orl %eax, %edi
callq 0x1040
movl -0xc(%rbp), %eax
addl $0x2, %eax
cltq
movzbl -0x70(%rbp,%rax), %edi
shll $0x2, %edi
movl -0xc(%rbp), %eax
addl $0x3, %eax
cltq
movzbl -0x70(%rbp,%rax), %eax
orl %eax, %edi
callq 0x1040
movl -0xc(%rbp), %eax
addl $0x4, %eax
movl %eax, -0xc(%rbp)
jmp 0x145f
jmp 0x14eb
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x11ba
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq