// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/tiff.c
// Function: find_tagnuminfo
static const struct tagnuminfo *find_tagnuminfo(int tagnum, int filefmt, u8 ifdtype)
{
	size_t i;

	for(i=0; i<DE_ARRAYCOUNT(tagnuminfo_arr); i++) {
		if(tagnuminfo_arr[i].tagnum!=tagnum) {
			continue;
		}

		if(ifdtype==IFDTYPE_EXIFINTEROP) {
			// For interoperability IFDs, allow only special tags
			if(!(tagnuminfo_arr[i].flags&0x20)) {
				continue;
			}
		}
		else if(ifdtype==IFDTYPE_GPS) {
			// For GPS IFDs, allow only special tags
			if(!(tagnuminfo_arr[i].flags&0x40)) {
				continue;
			}
		}
		else if(ifdtype==IFDTYPE_NIKONMN) {
			// For this IFD, allow only special tags
			if(!(tagnuminfo_arr[i].flags&0x1000)) {
				continue;
			}
		}
		else if(ifdtype==IFDTYPE_APPLEMN) {
			// For this IFD, allow only special tags
			if(!(tagnuminfo_arr[i].flags&0x2000)) {
				continue;
			}
		}
		else if(ifdtype==IFDTYPE_FUJIFILMMN) {
			// For this IFD, allow only special tags
			if(!(tagnuminfo_arr[i].flags&0x8000)) {
				continue;
			}
		}
		else if(tagnuminfo_arr[i].flags&0x01) {
			// A special tag not allowed above
			if(filefmt==DE_TIFFFMT_JPEGXR && (tagnuminfo_arr[i].flags&0x0400)) {
				// Allow all JPEG XR tags in normal JPEG XR IFDs.
				// Maybe we should disallow TIFF tags that are not known to be
				// allowed in JPEG XR files, but I suspect a lot of random TIFF
				// tags are occasionally used in JPEG XR, and I'm not aware of
				// any conflicts.
				;
			}
			else if(filefmt==DE_TIFFFMT_MPEXT && (tagnuminfo_arr[i].flags&0x0800)) {
				;
			}
			else if(filefmt==DE_TIFFFMT_NIKONMN && (tagnuminfo_arr[i].flags&0x1000)) {
				;
			}
			else if(filefmt==DE_TIFFFMT_PANASONIC && (tagnuminfo_arr[i].flags&0x4000) &&
				ifdtype==IFDTYPE_NORMAL)
			{
				;
			}
			else {
				// Ignore this tag -- it's in the wrong "namespace".
				continue;
			}
		}

		return &tagnuminfo_arr[i];
	}
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb %dl, %al
movl %edi, -0xc(%rbp)
movl %esi, -0x10(%rbp)
movb %al, -0x11(%rbp)
movq $0x0, -0x20(%rbp)
cmpq $0x279, -0x20(%rbp)     # imm = 0x279
jae 0x12f26f
movq -0x20(%rbp), %rcx
leaq 0xee400(%rip), %rax     # 0x21d460
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
cmpl -0xc(%rbp), %eax
je 0x12f073
jmp 0x12f25e
movzbl -0x11(%rbp), %eax
cmpl $0x3, %eax
jne 0x12f0a3
movq -0x20(%rbp), %rcx
leaq 0xee3d9(%rip), %rax     # 0x21d460
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
jne 0x12f09e
jmp 0x12f25e
jmp 0x12f246
movzbl -0x11(%rbp), %eax
cmpl $0x4, %eax
jne 0x12f0d3
movq -0x20(%rbp), %rcx
leaq 0xee3a9(%rip), %rax     # 0x21d460
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
jne 0x12f0ce
jmp 0x12f25e
jmp 0x12f244
movzbl -0x11(%rbp), %eax
cmpl $0x6, %eax
jne 0x12f105
movq -0x20(%rbp), %rcx
leaq 0xee379(%rip), %rax     # 0x21d460
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
jne 0x12f100
jmp 0x12f25e
jmp 0x12f242
movzbl -0x11(%rbp), %eax
cmpl $0x8, %eax
jne 0x12f137
movq -0x20(%rbp), %rcx
leaq 0xee347(%rip), %rax     # 0x21d460
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
jne 0x12f132
jmp 0x12f25e
jmp 0x12f240
movzbl -0x11(%rbp), %eax
cmpl $0xa, %eax
jne 0x12f169
movq -0x20(%rbp), %rcx
leaq 0xee315(%rip), %rax     # 0x21d460
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
andl $0x8000, %eax           # imm = 0x8000
cmpl $0x0, %eax
jne 0x12f164
jmp 0x12f25e
jmp 0x12f23e
movq -0x20(%rbp), %rcx
leaq 0xee2ec(%rip), %rax     # 0x21d460
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x12f23c
cmpl $0x7, -0x10(%rbp)
jne 0x12f1b4
movq -0x20(%rbp), %rcx
leaq 0xee2c5(%rip), %rax     # 0x21d460
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x12f1b4
jmp 0x12f23a
cmpl $0x8, -0x10(%rbp)
jne 0x12f1db
movq -0x20(%rbp), %rcx
leaq 0xee29b(%rip), %rax     # 0x21d460
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0x12f1db
jmp 0x12f238
cmpl $0x9, -0x10(%rbp)
jne 0x12f202
movq -0x20(%rbp), %rcx
leaq 0xee274(%rip), %rax     # 0x21d460
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
je 0x12f202
jmp 0x12f236
cmpl $0x3, -0x10(%rbp)
jne 0x12f232
movq -0x20(%rbp), %rcx
leaq 0xee24d(%rip), %rax     # 0x21d460
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
andl $0x4000, %eax           # imm = 0x4000
cmpl $0x0, %eax
je 0x12f232
movzbl -0x11(%rbp), %eax
cmpl $0x0, %eax
jne 0x12f232
jmp 0x12f234
jmp 0x12f25e
jmp 0x12f236
jmp 0x12f238
jmp 0x12f23a
jmp 0x12f23c
jmp 0x12f23e
jmp 0x12f240
jmp 0x12f242
jmp 0x12f244
jmp 0x12f246
movq -0x20(%rbp), %rcx
leaq 0xee20f(%rip), %rax     # 0x21d460
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x12f277
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x12f047
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
popq %rbp
retq
nopl (%rax)