// File: /workspace/github_c_makefile_star2_O2/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, 0x4(%rsp)
movq %r8, %r15
movq %rcx, %r14
movq %rdx, 0x18(%rsp)
movl %esi, %ebx
movq %rdi, %r12
movq %rcx, %rdx
callq 0x416a
movl %eax, %ebp
leaq 0x1ce8b(%rip), %rax     # 0x57180
movq (%rax), %rax
xorl %r13d, %r13d
btl $0x12, %eax
movq %r14, 0x8(%rsp)
jae 0x3a372
leaq 0xc3fd(%rip), %rdi      # 0x4670a
movq %r15, %rsi
xorl %eax, %eax
callq 0x3120
movzwl %bp, %r14d
cmpq %r15, %r14
je 0x3a359
movl %eax, %edi
callq 0x160f7
movl %eax, %ebp
leaq 0x4dac(%rip), %rcx      # 0x3f0dc
movl $0x40000, %edi          # imm = 0x40000
movq 0x8(%rsp), %rsi
movl 0x4(%rsp), %edx
callq 0x5100
leaq 0x10a93(%rip), %rdi     # 0x4addd
movl %r14d, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0x3120
addl %ebp, %eax
movl %eax, %edi
callq 0x160f7
movl %eax, %r13d
leaq 0x1ce16(%rip), %rax     # 0x57180
movq (%rax), %rax
movq 0x8(%rsp), %r14
testl $0x4003333, %eax        # imm = 0x4003333
je 0x3a6ca
addq $0x2, %r14
movq %r15, 0x10(%rsp)
leaq -0x2(%r15), %rax
shrq $0x2, %rax
movq %rax, 0x20(%rsp)
movzwl %bx, %ebx
xorl %r15d, %r15d
cmpq %r15, 0x20(%rsp)
je 0x3a6c0
movq %r12, %rdi
movl %ebx, %esi
movq %r14, %rdx
callq 0x416a
movw %ax, 0x2(%rsp)
leaq 0x2(%r14), %rdx
movq %r12, %rdi
movl %ebx, %esi
callq 0x416a
movl %eax, %ebp
movl $0x4003333, %edi        # imm = 0x4003333
movq %r14, %rsi
movl 0x4(%rsp), %edx
leaq 0x4d03(%rip), %rcx      # 0x3f0dc
callq 0x5100
leaq 0x1cd9b(%rip), %rax     # 0x57180
movzwl (%rax), %eax
testw $0x3003, %ax            # imm = 0x3003
je 0x3a404
leaq 0x4ca2(%rip), %rdi      # 0x3f097
movq 0x18(%rsp), %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %r13d
leaq 0x1cd75(%rip), %rax     # 0x57180
movq (%rax), %rax
cmpl $0x11, %r15d
ja 0x3a61d
movl %r15d, %ecx
leaq 0x10826(%rip), %rdx     # 0x4ac48
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
testw $0x3003, %ax            # imm = 0x3003
je 0x3a67a
leaq 0x11a97(%rip), %rdi     # 0x4bed3
xorl %esi, %esi
leaq 0x11a9d(%rip), %rdx     # 0x4bee2
jmp 0x3a666
testw $0x3003, %ax            # imm = 0x3003
je 0x3a67a
leaq 0x11a78(%rip), %rdi     # 0x4bed3
pushq $0x10
popq %rsi
leaq 0x11b9b(%rip), %rdx     # 0x4c000
jmp 0x3a666
testw $0x3003, %ax            # imm = 0x3003
je 0x3a67a
leaq 0x11a58(%rip), %rdi     # 0x4bed3
pushq $0xe
popq %rsi
leaq 0x11b5e(%rip), %rdx     # 0x4bfe3
jmp 0x3a666
testw $0x3003, %ax            # imm = 0x3003
je 0x3a67a
leaq 0x11a38(%rip), %rdi     # 0x4bed3
pushq $0xb
popq %rsi
leaq 0x11b0a(%rip), %rdx     # 0x4bfaf
jmp 0x3a666
testw $0x3003, %ax            # imm = 0x3003
je 0x3a67a
leaq 0x11a18(%rip), %rdi     # 0x4bed3
pushq $0x4
popq %rsi
leaq 0x11a63(%rip), %rdx     # 0x4bf28
jmp 0x3a666
testw $0x3003, %ax            # imm = 0x3003
je 0x3a67a
leaq 0x119f8(%rip), %rdi     # 0x4bed3
pushq $0xc
popq %rsi
leaq 0x11adb(%rip), %rdx     # 0x4bfc0
jmp 0x3a666
testw $0x3003, %ax            # imm = 0x3003
je 0x3a67a
leaq 0x119d8(%rip), %rdi     # 0x4bed3
pushq $0x9
popq %rsi
leaq 0x11a83(%rip), %rdx     # 0x4bf88
jmp 0x3a666
testw $0x3003, %ax            # imm = 0x3003
je 0x3a67a
leaq 0x119b8(%rip), %rdi     # 0x4bed3
pushq $0x2
popq %rsi
leaq 0x119dc(%rip), %rdx     # 0x4bf01
jmp 0x3a666
testw $0x3003, %ax            # imm = 0x3003
je 0x3a67a
leaq 0x11998(%rip), %rdi     # 0x4bed3
pushq $0xf
popq %rsi
leaq 0x11aac(%rip), %rdx     # 0x4bff1
jmp 0x3a666
testw $0x3003, %ax            # imm = 0x3003
je 0x3a67a
leaq 0x11978(%rip), %rdi     # 0x4bed3
pushq $0x3
popq %rsi
leaq 0x119af(%rip), %rdx     # 0x4bf14
jmp 0x3a666
testw $0x3003, %ax            # imm = 0x3003
je 0x3a67a
leaq 0x11958(%rip), %rdi     # 0x4bed3
pushq $0x7
popq %rsi
leaq 0x119d9(%rip), %rdx     # 0x4bf5e
jmp 0x3a666
testw $0x3003, %ax            # imm = 0x3003
je 0x3a67a
leaq 0x11938(%rip), %rdi     # 0x4bed3
pushq $0x1
popq %rsi
leaq 0x1194c(%rip), %rdx     # 0x4bef1
jmp 0x3a666
testw $0x3003, %ax            # imm = 0x3003
je 0x3a67a
leaq 0x11918(%rip), %rdi     # 0x4bed3
pushq $0x11
popq %rsi
leaq 0x11a4b(%rip), %rdx     # 0x4c010
jmp 0x3a666
testw $0x3003, %ax            # imm = 0x3003
je 0x3a67a
leaq 0x118f8(%rip), %rdi     # 0x4bed3
pushq $0x5
popq %rsi
leaq 0x11954(%rip), %rdx     # 0x4bf39
jmp 0x3a666
testw $0x3003, %ax            # imm = 0x3003
je 0x3a67a
leaq 0x118db(%rip), %rdi     # 0x4bed3
pushq $0xd
popq %rsi
leaq 0x119cf(%rip), %rdx     # 0x4bfd1
jmp 0x3a666
testw $0x3003, %ax            # imm = 0x3003
je 0x3a67a
leaq 0x118c2(%rip), %rdi     # 0x4bed3
pushq $0x6
popq %rsi
leaq 0x11930(%rip), %rdx     # 0x4bf4b
jmp 0x3a666
testw $0x3003, %ax            # imm = 0x3003
je 0x3a67a
leaq 0x118a9(%rip), %rdi     # 0x4bed3
movl %r15d, %esi
leaq 0xc342(%rip), %rdx      # 0x46976
jmp 0x3a666
testw $0x3003, %ax            # imm = 0x3003
je 0x3a67a
leaq 0x11890(%rip), %rdi     # 0x4bed3
pushq $0xa
popq %rsi
leaq 0x11952(%rip), %rdx     # 0x4bf9f
jmp 0x3a666
testw $0x3003, %ax            # imm = 0x3003
je 0x3a67a
leaq 0x11877(%rip), %rdi     # 0x4bed3
pushq $0x8
popq %rsi
leaq 0x1190c(%rip), %rdx     # 0x4bf72
xorl %eax, %eax
callq 0x3120
addl %eax, %r13d
leaq 0x1cb09(%rip), %rax     # 0x57180
movq (%rax), %rax
movl %r13d, %edi
testb $0x30, %al
je 0x3a6ac
movzwl 0x2(%rsp), %eax
cvtsi2ss %eax, %xmm0
movzwl %bp, %eax
cvtsi2ss %eax, %xmm1
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0xc391(%rip), %rdi      # 0x46a31
movb $0x1, %al
callq 0x3120
movl %eax, %edi
addl %r13d, %edi
callq 0x160f7
movl %eax, %r13d
incq %r15
addq $0x4, %r14
jmp 0x3a399
movq 0x10(%rsp), %r15
movq 0x8(%rsp), %r14
addq %r14, %r15
movl %r13d, %edi
callq 0x16a4f
movq %r15, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq