// File: /workspace/github_c_makefile_star2_O1/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 0x4574
movl %eax, %ebp
leaq 0x1c8bb(%rip), %rax     # 0x58180
xorl %r13d, %r13d
testb $0x4, 0x2(%rax)
je 0x3b92b
leaq 0xce45(%rip), %rdi      # 0x4871a
movq %r15, %rsi
xorl %eax, %eax
callq 0x3120
movzwl %bp, %r14d
cmpq %r15, %r14
je 0x3b921
movl %eax, %edi
callq 0x16b56
movl %eax, %ebp
leaq 0x57e4(%rip), %rcx      # 0x410dc
movl $0x40000, %edi          # imm = 0x40000
movq 0x10(%rsp), %rsi
movl 0xc(%rsp), %edx
callq 0x5605
leaq 0x114db(%rip), %rdi     # 0x4cded
movl %r14d, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0x3120
addl %ebp, %eax
movl %eax, %edi
callq 0x16b56
movl %eax, %r13d
leaq 0x1c84e(%rip), %rax     # 0x58180
testl $0x4003333, (%rax)      # imm = 0x4003333
movq %r15, 0x18(%rsp)
je 0x3bcce
leaq -0x2(%r15), %rbp
cmpq $0x4, %rbp
jb 0x3bcce
shrq $0x2, %rbp
movq 0x10(%rsp), %rax
leaq 0x2(%rax), %r14
cmpq $0x1, %rbp
adcq $0x0, %rbp
movzwl %bx, %ebx
xorl %r15d, %r15d
movq %r12, %rdi
movl %ebx, %esi
movq %r14, %rdx
callq 0x4574
movw %ax, 0xa(%rsp)
leaq 0x2(%r14), %rdx
movq %r12, %rdi
movl %ebx, %esi
callq 0x4574
movw %ax, 0x8(%rsp)
movl $0x4003333, %edi        # imm = 0x4003333
movq %r14, %rsi
movl 0xc(%rsp), %edx
leaq 0x5738(%rip), %rcx      # 0x410dc
callq 0x5605
leaq 0x1c7d0(%rip), %rax     # 0x58180
movzwl (%rax), %eax
testl $0x3003, %eax           # imm = 0x3003
je 0x3b9d0
leaq 0x56d6(%rip), %rdi      # 0x41097
movq 0x20(%rsp), %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %r13d
leaq 0x1c7a9(%rip), %rax     # 0x58180
movq (%rax), %rax
cmpl $0x11, %r15d
ja 0x3bc1a
movl %r15d, %ecx
leaq 0x1126a(%rip), %rdx     # 0x4cc58
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
testl $0x3003, %eax           # imm = 0x3003
je 0x3bc74
leaq 0x124da(%rip), %rdi     # 0x4dee3
xorl %esi, %esi
leaq 0x124e0(%rip), %rdx     # 0x4def2
jmp 0x3bc6a
testl $0x3003, %eax           # imm = 0x3003
je 0x3bc74
leaq 0x124ba(%rip), %rdi     # 0x4dee3
movl $0x10, %esi
leaq 0x125db(%rip), %rdx     # 0x4e010
jmp 0x3bc6a
testl $0x3003, %eax           # imm = 0x3003
je 0x3bc74
leaq 0x12497(%rip), %rdi     # 0x4dee3
movl $0xe, %esi
leaq 0x1259b(%rip), %rdx     # 0x4dff3
jmp 0x3bc6a
testl $0x3003, %eax           # imm = 0x3003
je 0x3bc74
leaq 0x12474(%rip), %rdi     # 0x4dee3
movl $0xb, %esi
leaq 0x12544(%rip), %rdx     # 0x4dfbf
jmp 0x3bc6a
testl $0x3003, %eax           # imm = 0x3003
je 0x3bc74
leaq 0x12451(%rip), %rdi     # 0x4dee3
movl $0x4, %esi
leaq 0x1249a(%rip), %rdx     # 0x4df38
jmp 0x3bc6a
testl $0x3003, %eax           # imm = 0x3003
je 0x3bc74
leaq 0x1242e(%rip), %rdi     # 0x4dee3
movl $0xc, %esi
leaq 0x1250f(%rip), %rdx     # 0x4dfd0
jmp 0x3bc6a
testl $0x3003, %eax           # imm = 0x3003
je 0x3bc74
leaq 0x1240b(%rip), %rdi     # 0x4dee3
movl $0x9, %esi
leaq 0x124b4(%rip), %rdx     # 0x4df98
jmp 0x3bc6a
testl $0x3003, %eax           # imm = 0x3003
je 0x3bc74
leaq 0x123e8(%rip), %rdi     # 0x4dee3
movl $0x2, %esi
leaq 0x1240a(%rip), %rdx     # 0x4df11
jmp 0x3bc6a
testl $0x3003, %eax           # imm = 0x3003
je 0x3bc74
leaq 0x123c5(%rip), %rdi     # 0x4dee3
movl $0xf, %esi
leaq 0x124d7(%rip), %rdx     # 0x4e001
jmp 0x3bc6a
testl $0x3003, %eax           # imm = 0x3003
je 0x3bc74
leaq 0x123a2(%rip), %rdi     # 0x4dee3
movl $0x3, %esi
leaq 0x123d7(%rip), %rdx     # 0x4df24
jmp 0x3bc6a
testl $0x3003, %eax           # imm = 0x3003
je 0x3bc74
leaq 0x1237f(%rip), %rdi     # 0x4dee3
movl $0x7, %esi
leaq 0x123fe(%rip), %rdx     # 0x4df6e
jmp 0x3bc6a
testl $0x3003, %eax           # imm = 0x3003
je 0x3bc74
leaq 0x1235c(%rip), %rdi     # 0x4dee3
movl $0x1, %esi
leaq 0x1236e(%rip), %rdx     # 0x4df01
jmp 0x3bc6a
testl $0x3003, %eax           # imm = 0x3003
je 0x3bc74
leaq 0x12339(%rip), %rdi     # 0x4dee3
movl $0x11, %esi
leaq 0x1246a(%rip), %rdx     # 0x4e020
jmp 0x3bc6a
testl $0x3003, %eax           # imm = 0x3003
je 0x3bc74
leaq 0x12316(%rip), %rdi     # 0x4dee3
movl $0x5, %esi
leaq 0x12370(%rip), %rdx     # 0x4df49
jmp 0x3bc6a
testl $0x3003, %eax           # imm = 0x3003
je 0x3bc74
leaq 0x122f3(%rip), %rdi     # 0x4dee3
movl $0xd, %esi
leaq 0x123e5(%rip), %rdx     # 0x4dfe1
jmp 0x3bc6a
testl $0x3003, %eax           # imm = 0x3003
je 0x3bc74
leaq 0x122d7(%rip), %rdi     # 0x4dee3
movl $0x6, %esi
leaq 0x12343(%rip), %rdx     # 0x4df5b
jmp 0x3bc6a
testl $0x3003, %eax           # imm = 0x3003
je 0x3bc74
leaq 0x122bb(%rip), %rdi     # 0x4dee3
movl %r15d, %esi
leaq 0xcd54(%rip), %rdx      # 0x48986
jmp 0x3bc6a
testl $0x3003, %eax           # imm = 0x3003
je 0x3bc74
leaq 0x122a1(%rip), %rdi     # 0x4dee3
movl $0xa, %esi
leaq 0x12361(%rip), %rdx     # 0x4dfaf
jmp 0x3bc6a
testl $0x3003, %eax           # imm = 0x3003
je 0x3bc74
leaq 0x12285(%rip), %rdi     # 0x4dee3
movl $0x8, %esi
leaq 0x12318(%rip), %rdx     # 0x4df82
xorl %eax, %eax
callq 0x3120
addl %eax, %r13d
leaq 0x1c505(%rip), %rax     # 0x58180
testb $0x30, (%rax)
movl %r13d, %edi
je 0x3bcb6
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 0xcd97(%rip), %rdi      # 0x48a41
movb $0x1, %al
callq 0x3120
movl %eax, %edi
addl %r13d, %edi
callq 0x16b56
movl %eax, %r13d
incq %r15
addq $0x4, %r14
cmpq %r15, %rbp
jne 0x3b96c
movq 0x18(%rsp), %rbx
addq 0x10(%rsp), %rbx
movl %r13d, %edi
callq 0x17530
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq