// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/fglut/freeglut_font.c
// Function: glutBitmapString
void FGAPIENTRY glutBitmapString( void* fontID, const unsigned char *string )
{
    unsigned char c;
    float x = 0.0f ;
    SFG_Font* font;
    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutBitmapString" );
    font = fghFontByID( fontID );
    freeglut_return_if_fail( font );
    if ( !string || ! *string )
        return;

    glPushClientAttrib( GL_CLIENT_PIXEL_STORE_BIT );
    glPixelStorei( GL_UNPACK_SWAP_BYTES,  GL_FALSE );
    glPixelStorei( GL_UNPACK_LSB_FIRST,   GL_FALSE );
    glPixelStorei( GL_UNPACK_ROW_LENGTH,  0        );
    glPixelStorei( GL_UNPACK_SKIP_ROWS,   0        );
    glPixelStorei( GL_UNPACK_SKIP_PIXELS, 0        );
    glPixelStorei( GL_UNPACK_ALIGNMENT,   1        );

    /*
     * Step through the string, drawing each character.
     * A newline will simply translate the next character's insertion
     * point back to the start of the line and down one line.
     */
    while( ( c = *string++) )
        if( c == '\n' )
        {
            glBitmap ( 0, 0, 0, 0, -x, (float) -font->Height, NULL );
            x = 0.0f;
        }
        else  /* Not an EOL, draw the bitmap character */
        {
            const GLubyte* face = font->Characters[ c ];

            glBitmap(
                face[ 0 ], font->Height,     /* Bitmap's width and height    */
                font->xorig, font->yorig,    /* The origin in the font glyph */
                ( float )( face[ 0 ] ), 0.0, /* The raster advance; inc. x,y */
                ( face + 1 )                 /* The packed bitmap data...    */
            );

            x += ( float )( face[ 0 ] );
        }

    glPopClientAttrib( );
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x7496d(%rip), %rax     # 0x1421c0
cmpb $0x0, 0x1c(%rax)
jne 0xcd86e
leaq 0x1bd56(%rip), %rdi     # 0xe95b6
leaq 0x1c151(%rip), %rsi     # 0xe99b8
xorl %eax, %eax
callq 0xcfe73
movq %r14, %rdi
callq 0xcd7a6
movq %rax, %r14
testq %rax, %rax
sete %al
testq %rbx, %rbx
sete %cl
orb %al, %cl
jne 0xcd96f
cmpb $0x0, (%rbx)
je 0xcd96f
movl $0x1, %edi
callq 0x21620
movl $0xcf0, %edi            # imm = 0xCF0
xorl %esi, %esi
callq 0x21410
movl $0xcf1, %edi            # imm = 0xCF1
xorl %esi, %esi
callq 0x21410
movl $0xcf2, %edi            # imm = 0xCF2
xorl %esi, %esi
callq 0x21410
movl $0xcf3, %edi            # imm = 0xCF3
xorl %esi, %esi
callq 0x21410
movl $0xcf4, %edi            # imm = 0xCF4
xorl %esi, %esi
callq 0x21410
movl $0xcf5, %edi            # imm = 0xCF5
movl $0x1, %esi
callq 0x21410
xorps %xmm2, %xmm2
movzbl (%rbx), %eax
incq %rbx
cmpl $0xa, %eax
je 0xcd945
testl %eax, %eax
je 0xcd979
movq 0x10(%r14), %rcx
movq (%rcx,%rax,8), %r15
movzbl (%r15), %edi
movl 0xc(%r14), %esi
movss 0x18(%r14), %xmm0
movss 0x1c(%r14), %xmm1
movaps %xmm2, (%rsp)
xorps %xmm2, %xmm2
cvtsi2ss %edi, %xmm2
leaq 0x1(%r15), %rdx
xorps %xmm3, %xmm3
callq 0x21860
movaps (%rsp), %xmm2
movzbl (%r15), %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
addss %xmm0, %xmm2
jmp 0xcd8ee
xorl %eax, %eax
subl 0xc(%r14), %eax
xorps 0xe39e(%rip), %xmm2     # 0xdbcf0
xorps %xmm3, %xmm3
cvtsi2ss %eax, %xmm3
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x21860
jmp 0xcd8eb
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x21ac0