// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/tiff.c
// Function: handler_various
static void handler_various(deark *c, lctx *d, const struct taginfo *tg, const struct tagnuminfo *tni)
{
	struct page_ctx *pg = tg->pg;
	i64 val;

	if(tg->valcount<1) return;
	read_tag_value_as_int64(c, d, tg, 0, &val);

	switch(tg->tagnum) {
	case TAG_NEWSUBFILETYPE:
		if(val & 0x1) pg->is_thumb = 1;
		break;
	case TAG_OLDSUBFILETYPE:
		pg->have_oldsubfiletype = 1;
		if(val==2) pg->is_thumb = 1;
		break;
	case TAG_IMAGEWIDTH:
		pg->have_imagewidth = 1;
		pg->imagewidth = val;
		break;
	case TAG_IMAGELENGTH:
		pg->imagelength = val;
		break;
	case TAG_COMPRESSION:
		pg->compression = (u32)val;
		break;
	case TAG_PHOTOMETRIC:
		pg->photometric = (u32)val;
		break;
	case TAG_FILLORDER:
		pg->fill_order = (u32)val;
		break;
	case TAG_SAMPLESPERPIXEL:
		pg->samples_per_pixel = (u32)val;
		break;
	case TAG_ROWSPERSTRIP:
		pg->have_strip_tags = 1;
		pg->rows_per_strip = val;
		break;
	case TAG_TILEWIDTH:
		pg->have_tile_tags = 1;
		pg->tile_width = val;
		break;
	case TAG_TILELENGTH:
		pg->have_tile_tags = 1;
		pg->tile_height = val;
		break;
	case TAG_ORIENTATION:
		if(val>=1 && val<=8) {
			pg->orientation = (u32)val;
		}
		break;
	case TAG_PLANARCONFIG:
		pg->planarconfig = (u32)val;
		break;
	case TAG_T4OPTIONS:
		pg->t4options = (u32)val;
		break;
	case TAG_T6OPTIONS:
		pg->t6options = (u32)val;
		break;
	case TAG_RESOLUTIONUNIT:
		pg->resolution_unit = (u32)val;
		break;
	case TAG_PREDICTOR:
		pg->predictor = (u32)val;
		break;
	case TAG_JPEGINTERCHANGEFORMAT:
		pg->jpegoffset = val;
		break;
	case TAG_JPEGINTERCHANGEFORMATLENGTH:
		pg->have_jpeglength = 1;
		pg->jpeglength = val;
		break;
	case TAG_YCBCRPOSITIONING:
		pg->ycbcrpositioning = (u32)val;
		break;
	case TAG_JPEGTABLES:
		pg->have_jpegtables = 1;
		break;
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpq $0x0, 0x18(%rdx)
jle 0xc58f0
movq %rdx, %rbx
movq (%rdx), %r14
movq %rsp, %r8
xorl %ecx, %ecx
callq 0xc7374
movl 0x8(%rbx), %eax
leal -0xfe(%rax), %ecx
cmpl $0x18, %ecx
jbe 0xc57d7
cmpl $0x11c, %eax            # imm = 0x11C
je 0xc5881
cmpl $0x124, %eax            # imm = 0x124
je 0xc58e0
cmpl $0x125, %eax            # imm = 0x125
je 0xc5891
cmpl $0x128, %eax            # imm = 0x128
je 0xc58e9
cmpl $0x13d, %eax            # imm = 0x13D
je 0xc58b3
cmpl $0x142, %eax            # imm = 0x142
je 0xc58ce
cmpl $0x143, %eax            # imm = 0x143
je 0xc58bc
cmpl $0x15b, %eax            # imm = 0x15B
je 0xc588a
cmpl $0x201, %eax            # imm = 0x201
je 0xc58a9
cmpl $0x202, %eax            # imm = 0x202
je 0xc589a
cmpl $0x213, %eax            # imm = 0x213
jne 0xc58f0
movl (%rsp), %eax
movl %eax, 0x24(%r14)
jmp 0xc58f0
leaq 0x69c82(%rip), %rax     # 0x12f460
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
testb $0x1, (%rsp)
jne 0xc5827
jmp 0xc58f0
movl (%rsp), %eax
movl %eax, 0x1c(%r14)
jmp 0xc58f0
movq (%rsp), %rax
movq %rax, 0x68(%r14)
jmp 0xc58f0
movl (%rsp), %eax
movl %eax, 0x30(%r14)
jmp 0xc58f0
movb $0x1, 0x1a(%r14)
cmpq $0x2, (%rsp)
jne 0xc58f0
movb $0x1, 0x13(%r14)
jmp 0xc58f0
movb $0x1, 0x15(%r14)
movq (%rsp), %rax
movq %rax, 0x80(%r14)
jmp 0xc58f0
movb $0x1, 0x11(%r14)
movq (%rsp), %rax
movq %rax, 0x60(%r14)
jmp 0xc58f0
movl (%rsp), %eax
movl %eax, 0x34(%r14)
jmp 0xc58f0
movq (%rsp), %rax
leaq -0x1(%rax), %rcx
cmpq $0x7, %rcx
ja 0xc58f0
movl %eax, 0x20(%r14)
jmp 0xc58f0
movl (%rsp), %eax
movl %eax, 0x2c(%r14)
jmp 0xc58f0
movl (%rsp), %eax
movl %eax, 0x38(%r14)
jmp 0xc58f0
movb $0x1, 0x18(%r14)
jmp 0xc58f0
movl (%rsp), %eax
movl %eax, 0x4c(%r14)
jmp 0xc58f0
movb $0x1, 0x12(%r14)
movq (%rsp), %rax
movq %rax, 0x78(%r14)
jmp 0xc58f0
movq (%rsp), %rax
movq %rax, 0x70(%r14)
jmp 0xc58f0
movl (%rsp), %eax
movl %eax, 0x3c(%r14)
jmp 0xc58f0
movb $0x1, 0x16(%r14)
movq (%rsp), %rax
movq %rax, 0x90(%r14)
jmp 0xc58f0
movb $0x1, 0x16(%r14)
movq (%rsp), %rax
movq %rax, 0x88(%r14)
jmp 0xc58f0
movl (%rsp), %eax
movl %eax, 0x48(%r14)
jmp 0xc58f0
movl (%rsp), %eax
movl %eax, 0x44(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq