// File: /workspace/github_c_makefile_star2_O1/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 0xce295
movq %rdx, %rbx
movq (%rdx), %r14
movq %rsp, %r8
xorl %ecx, %ecx
callq 0xd03d8
movl 0x8(%rbx), %eax
cmpl $0x123, %eax            # imm = 0x123
jg 0xce0fa
leal -0xfe(%rax), %ecx
cmpl $0x18, %ecx
ja 0xce1b4
leaq 0x6e29e(%rip), %rax     # 0x13c380
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
testb $0x1, (%rsp)
jne 0xce216
jmp 0xce295
cmpl $0x142, %eax            # imm = 0x142
jg 0xce13e
cmpl $0x127, %eax            # imm = 0x127
jle 0xce172
cmpl $0x128, %eax            # imm = 0x128
je 0xce251
cmpl $0x13d, %eax            # imm = 0x13D
je 0xce264
cmpl $0x142, %eax            # imm = 0x142
jne 0xce295
movb $0x1, 0x16(%r14)
movq (%rsp), %rax
movq %rax, 0x88(%r14)
jmp 0xce295
cmpl $0x200, %eax            # imm = 0x200
jle 0xce194
cmpl $0x201, %eax            # imm = 0x201
je 0xce25a
cmpl $0x202, %eax            # imm = 0x202
je 0xce26d
cmpl $0x213, %eax            # imm = 0x213
jne 0xce295
movl (%rsp), %eax
movl %eax, 0x24(%r14)
jmp 0xce295
cmpl $0x124, %eax            # imm = 0x124
je 0xce27c
cmpl $0x125, %eax            # imm = 0x125
jne 0xce295
movl (%rsp), %eax
movl %eax, 0x4c(%r14)
jmp 0xce295
cmpl $0x143, %eax            # imm = 0x143
je 0xce285
cmpl $0x15b, %eax            # imm = 0x15B
jne 0xce295
movb $0x1, 0x18(%r14)
jmp 0xce295
cmpl $0x11c, %eax            # imm = 0x11C
jne 0xce295
movl (%rsp), %eax
movl %eax, 0x38(%r14)
jmp 0xce295
movl (%rsp), %eax
movl %eax, 0x2c(%r14)
jmp 0xce295
movq (%rsp), %rax
leaq -0x1(%rax), %rcx
cmpq $0x7, %rcx
ja 0xce295
movl %eax, 0x20(%r14)
jmp 0xce295
movl (%rsp), %eax
movl %eax, 0x1c(%r14)
jmp 0xce295
movl (%rsp), %eax
movl %eax, 0x34(%r14)
jmp 0xce295
movb $0x1, 0x1a(%r14)
cmpq $0x2, (%rsp)
jne 0xce295
movb $0x1, 0x13(%r14)
jmp 0xce295
movb $0x1, 0x11(%r14)
movq (%rsp), %rax
movq %rax, 0x60(%r14)
jmp 0xce295
movl (%rsp), %eax
movl %eax, 0x30(%r14)
jmp 0xce295
movq (%rsp), %rax
movq %rax, 0x68(%r14)
jmp 0xce295
movb $0x1, 0x15(%r14)
movq (%rsp), %rax
movq %rax, 0x80(%r14)
jmp 0xce295
movl (%rsp), %eax
movl %eax, 0x44(%r14)
jmp 0xce295
movq (%rsp), %rax
movq %rax, 0x70(%r14)
jmp 0xce295
movl (%rsp), %eax
movl %eax, 0x3c(%r14)
jmp 0xce295
movb $0x1, 0x12(%r14)
movq (%rsp), %rax
movq %rax, 0x78(%r14)
jmp 0xce295
movl (%rsp), %eax
movl %eax, 0x48(%r14)
jmp 0xce295
movb $0x1, 0x16(%r14)
movq (%rsp), %rax
movq %rax, 0x90(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq