// File: /workspace/github_c_makefile_star2_O3/hfiguiere[P]exifprobe/maker_canon.c
// Function: canon_whitebalancetable
unsigned long
canon_whitebalancetable(FILE *inptr,unsigned short byteorder,char *tagprefix,
                            unsigned long offset,unsigned long dirlength,int indent)
{
    unsigned long count;
    unsigned long end_offset;
    unsigned short length;
    unsigned short num,denom;
    float value;
    int i;
    int chpr = 0;

    end_offset = offset + dirlength;
    length = read_ushort(inptr,byteorder,offset);
    if(PRINT_SECTION)
    {
        chpr += printf(" length %lu",dirlength);
        if(length != dirlength)
        {
            chpr = newline(chpr);
            PUSHCOLOR(RED);
            print_tag_address(SECTION,offset,indent,"@");
            chpr += printf("# WARNING: length %u from segment does not match length %lu from directory",
                        length,dirlength);
            POPCOLOR();
        }
        chpr = newline(chpr);
    }

    if((PRINT_ENTRY))
    {
        offset += 2;
        count = (dirlength - 2) / sizeof(float);

        for(i = 0; i < count; ++i)
        {
            num = read_ushort(inptr,byteorder,offset);
            denom = read_ushort(inptr,byteorder,offset+2);
            value = (float)num / (float)denom;
            print_tag_address(ENTRY,offset,indent,"@");
            if((PRINT_TAGINFO))
                chpr += printf("%s",tagprefix);
            switch(i)
            {
                case 0:   
                    if((PRINT_TAGINFO))
                        chpr += printf(".%02d_%-22.22s",i,"RedBalanceAuto");
                    if((PRINT_VALUE))
                        chpr += printf(" = %f",value);
                    break;
                case 1:   
                    if((PRINT_TAGINFO))
                        chpr += printf(".%02d_%-22.22s",i,"BlueBalanceAuto");
                    if((PRINT_VALUE))
                        chpr += printf(" = %f",value);
                    break;
                case 2:   
                    if((PRINT_TAGINFO))
                        chpr += printf(".%02d_%-22.22s",i,"RedBalanceDaylight");
                    if((PRINT_VALUE))
                        chpr += printf(" = %f",value);
                    break;
                case 3:   
                    if((PRINT_TAGINFO))
                        chpr += printf(".%02d_%-22.22s",i,"BlueBalanceDaylight");
                    if((PRINT_VALUE))
                        chpr += printf(" = %f",value);
                    break;
                case 4:   
                    if((PRINT_TAGINFO))
                        chpr += printf(".%02d_%-22.22s",i,"RedBalanceCloudy");
                    if((PRINT_VALUE))
                        chpr += printf(" = %f",value);
                    break;
                case 5:   
                    if((PRINT_TAGINFO))
                        chpr += printf(".%02d_%-22.22s",i,"BlueBalanceCloudy");
                    if((PRINT_VALUE))
                        chpr += printf(" = %f",value);
                    break;
                case 6:   
                    if((PRINT_TAGINFO))
                        chpr += printf(".%02d_%-22.22s",i,"RedBalanceTungsten");
                    if((PRINT_VALUE))
                        chpr += printf(" = %f",value);
                    break;
                case 7:   
                    if((PRINT_TAGINFO))
                        chpr += printf(".%02d_%-22.22s",i,"BlueBalanceTungsten");
                    if((PRINT_VALUE))
                        chpr += printf(" = %f",value);
                    break;
                case 8:   
                    if((PRINT_TAGINFO))
                        chpr += printf(".%02d_%-22.22s",i,"RedBalanceFluorescent");
                    if((PRINT_VALUE))
                        chpr += printf(" = %f",value);
                    break;
                case 9:   
                    if((PRINT_TAGINFO))
                        chpr += printf(".%02d_%-22.22s",i,"BlueBalanceFluorescent");
                    if((PRINT_VALUE))
                        chpr += printf(" = %f",value);
                    break;
                case 10:   
                    if((PRINT_TAGINFO))
                        chpr += printf(".%02d_%-22.22s",i,"RedBalanceFlash");
                    if((PRINT_VALUE))
                        chpr += printf(" = %f",value);
                    break;
                case 11:   
                    if((PRINT_TAGINFO))
                        chpr += printf(".%02d_%-22.22s",i,"BlueBalanceFlash");
                    if((PRINT_VALUE))
                        chpr += printf(" = %f",value);
                    break;
                case 12:   
                    if((PRINT_TAGINFO))
                        chpr += printf(".%02d_%-22.22s",i,"RedBalanceCustom");
                    if((PRINT_VALUE))
                        chpr += printf(" = %f",value);
                    break;
                case 13:   
                    if((PRINT_TAGINFO))
                        chpr += printf(".%02d_%-22.22s",i,"BlueBalanceCustom");
                    if((PRINT_VALUE))
                        chpr += printf(" = %f",value);
                    break;
                case 14:   
                    if((PRINT_TAGINFO))
                        chpr += printf(".%02d_%-22.22s",i,"RedBalanceB&W");
                    if((PRINT_VALUE))
                        chpr += printf(" = %f",value);
                    break;
                case 15:   
                    if((PRINT_TAGINFO))
                        chpr += printf(".%02d_%-22.22s",i,"BlueBalanceB&W");
                    if((PRINT_VALUE))
                        chpr += printf(" = %f",value);
                    break;
                case 16:   
                    if((PRINT_TAGINFO))
                        chpr += printf(".%02d_%-22.22s",i,"RedBalanceShade");
                    if((PRINT_VALUE))
                        chpr += printf(" = %f",value);
                    break;
                case 17:   
                    if((PRINT_TAGINFO))
                        chpr += printf(".%02d_%-22.22s",i,"BlueBalanceShade");
                    if((PRINT_VALUE))
                        chpr += printf(" = %f",value);
                    break;
                default:
                    if((PRINT_TAGINFO))
                        chpr += printf(".%02d_%-22.22s",i,"Undefined");
                    if((PRINT_VALUE))
                        chpr += printf(" = %f",value);
                    break;
            }
            offset += 4;
            chpr = newline(chpr);
        }
    }
    setcharsprinted(chpr);
    return(end_offset);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r9d, 0xc(%rsp)
movq %r8, %r15
movq %rdx, 0x20(%rsp)
movl %esi, %ebx
movq %rdi, %r12
movq %rcx, 0x10(%rsp)
movq %rcx, %rdx
callq 0x45af
movl %eax, %ebp
leaq 0x1bf94(%rip), %rax     # 0x58180
movq (%rax), %rax
xorl %r13d, %r13d
btl $0x12, %eax
jae 0x3c25f
leaq 0xc55b(%rip), %rdi      # 0x4875a
movq %r15, %rsi
xorl %eax, %eax
callq 0x3120
movzwl %bp, %r14d
cmpq %r15, %r14
je 0x3c24b
movl %eax, %edi
callq 0x1707a
movl %eax, %ebp
leaq 0x4eba(%rip), %rcx      # 0x410dc
movl $0x40000, %edi          # imm = 0x40000
movq 0x10(%rsp), %rsi
movl 0xc(%rsp), %edx
callq 0x55eb
leaq 0x10bf1(%rip), %rdi     # 0x4ce2d
movl %r14d, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0x3120
addl %ebp, %eax
movl %eax, %edi
callq 0x1707a
movl %eax, %r13d
leaq 0x1bf24(%rip), %rax     # 0x58180
movq (%rax), %rax
testl $0x4003333, %eax        # imm = 0x4003333
movq %r15, 0x18(%rsp)
je 0x3c5f4
leaq -0x2(%r15), %rbp
cmpq $0x4, %rbp
jb 0x3c5f4
shrq $0x2, %rbp
movq 0x10(%rsp), %rax
leaq 0x2(%rax), %r14
movzwl %bx, %ebx
xorl %r15d, %r15d
movq %r12, %rdi
movl %ebx, %esi
movq %r14, %rdx
callq 0x45af
movw %ax, 0xa(%rsp)
leaq 0x2(%r14), %rdx
movq %r12, %rdi
movl %ebx, %esi
callq 0x45af
movw %ax, 0x8(%rsp)
movl $0x4003333, %edi        # imm = 0x4003333
movq %r14, %rsi
movl 0xc(%rsp), %edx
leaq 0x4e14(%rip), %rcx      # 0x410dc
callq 0x55eb
leaq 0x1beac(%rip), %rax     # 0x58180
movzwl (%rax), %eax
testl $0x3003, %eax           # imm = 0x3003
je 0x3c2f4
leaq 0x4db2(%rip), %rdi      # 0x41097
movq 0x20(%rsp), %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %r13d
leaq 0x1be85(%rip), %rax     # 0x58180
movq (%rax), %rax
cmpl $0x11, %r15d
ja 0x3c53e
movl %r15d, %ecx
leaq 0x10986(%rip), %rdx     # 0x4cc98
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
testl $0x3003, %eax           # imm = 0x3003
je 0x3c5a2
leaq 0x11bf6(%rip), %rdi     # 0x4df23
xorl %esi, %esi
leaq 0x11bfc(%rip), %rdx     # 0x4df32
jmp 0x3c58e
testl $0x3003, %eax           # imm = 0x3003
je 0x3c5a2
leaq 0x11bd6(%rip), %rdi     # 0x4df23
movl $0x10, %esi
leaq 0x11cf7(%rip), %rdx     # 0x4e050
jmp 0x3c58e
testl $0x3003, %eax           # imm = 0x3003
je 0x3c5a2
leaq 0x11bb3(%rip), %rdi     # 0x4df23
movl $0xe, %esi
leaq 0x11cb7(%rip), %rdx     # 0x4e033
jmp 0x3c58e
testl $0x3003, %eax           # imm = 0x3003
je 0x3c5a2
leaq 0x11b90(%rip), %rdi     # 0x4df23
movl $0xb, %esi
leaq 0x11c60(%rip), %rdx     # 0x4dfff
jmp 0x3c58e
testl $0x3003, %eax           # imm = 0x3003
je 0x3c5a2
leaq 0x11b6d(%rip), %rdi     # 0x4df23
movl $0x4, %esi
leaq 0x11bb6(%rip), %rdx     # 0x4df78
jmp 0x3c58e
testl $0x3003, %eax           # imm = 0x3003
je 0x3c5a2
leaq 0x11b4a(%rip), %rdi     # 0x4df23
movl $0xc, %esi
leaq 0x11c2b(%rip), %rdx     # 0x4e010
jmp 0x3c58e
testl $0x3003, %eax           # imm = 0x3003
je 0x3c5a2
leaq 0x11b27(%rip), %rdi     # 0x4df23
movl $0x9, %esi
leaq 0x11bd0(%rip), %rdx     # 0x4dfd8
jmp 0x3c58e
testl $0x3003, %eax           # imm = 0x3003
je 0x3c5a2
leaq 0x11b04(%rip), %rdi     # 0x4df23
movl $0x2, %esi
leaq 0x11b26(%rip), %rdx     # 0x4df51
jmp 0x3c58e
testl $0x3003, %eax           # imm = 0x3003
je 0x3c5a2
leaq 0x11ae1(%rip), %rdi     # 0x4df23
movl $0xf, %esi
leaq 0x11bf3(%rip), %rdx     # 0x4e041
jmp 0x3c58e
testl $0x3003, %eax           # imm = 0x3003
je 0x3c5a2
leaq 0x11abe(%rip), %rdi     # 0x4df23
movl $0x3, %esi
leaq 0x11af3(%rip), %rdx     # 0x4df64
jmp 0x3c58e
testl $0x3003, %eax           # imm = 0x3003
je 0x3c5a2
leaq 0x11a9b(%rip), %rdi     # 0x4df23
movl $0x7, %esi
leaq 0x11b1a(%rip), %rdx     # 0x4dfae
jmp 0x3c58e
testl $0x3003, %eax           # imm = 0x3003
je 0x3c5a2
leaq 0x11a78(%rip), %rdi     # 0x4df23
movl $0x1, %esi
leaq 0x11a8a(%rip), %rdx     # 0x4df41
jmp 0x3c58e
testl $0x3003, %eax           # imm = 0x3003
je 0x3c5a2
leaq 0x11a55(%rip), %rdi     # 0x4df23
movl $0x11, %esi
leaq 0x11b86(%rip), %rdx     # 0x4e060
jmp 0x3c58e
testl $0x3003, %eax           # imm = 0x3003
je 0x3c5a2
leaq 0x11a32(%rip), %rdi     # 0x4df23
movl $0x5, %esi
leaq 0x11a8c(%rip), %rdx     # 0x4df89
jmp 0x3c58e
testl $0x3003, %eax           # imm = 0x3003
je 0x3c5a2
leaq 0x11a0f(%rip), %rdi     # 0x4df23
movl $0xd, %esi
leaq 0x11b01(%rip), %rdx     # 0x4e021
jmp 0x3c58e
testl $0x3003, %eax           # imm = 0x3003
je 0x3c5a2
leaq 0x119f3(%rip), %rdi     # 0x4df23
movl $0x6, %esi
leaq 0x11a5f(%rip), %rdx     # 0x4df9b
jmp 0x3c58e
testl $0x3003, %eax           # imm = 0x3003
je 0x3c5a2
leaq 0x119d7(%rip), %rdi     # 0x4df23
movl %r15d, %esi
leaq 0xc470(%rip), %rdx      # 0x489c6
jmp 0x3c58e
testl $0x3003, %eax           # imm = 0x3003
je 0x3c5a2
leaq 0x119bd(%rip), %rdi     # 0x4df23
movl $0xa, %esi
leaq 0x11a7d(%rip), %rdx     # 0x4dfef
jmp 0x3c58e
testl $0x3003, %eax           # imm = 0x3003
je 0x3c5a2
leaq 0x119a1(%rip), %rdi     # 0x4df23
movl $0x8, %esi
leaq 0x11a34(%rip), %rdx     # 0x4dfc2
xorl %eax, %eax
callq 0x3120
addl %eax, %r13d
leaq 0x1bbe1(%rip), %rax     # 0x58180
movq (%rax), %rax
movl %r13d, %edi
testb $0x30, %al
je 0x3c5dc
movzwl 0xa(%rsp), %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movzwl 0x8(%rsp), %eax
xorps %xmm1, %xmm1
cvtsi2ss %eax, %xmm1
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0xc4b1(%rip), %rdi      # 0x48a81
movb $0x1, %al
callq 0x3120
movl %eax, %edi
addl %r13d, %edi
callq 0x1707a
movl %eax, %r13d
incq %r15
addq $0x4, %r14
cmpq %r15, %rbp
jne 0x3c290
movq 0x18(%rsp), %rbx
addq 0x10(%rsp), %rbx
movl %r13d, %edi
callq 0x17a82
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq