// File: /workspace/github_c_makefile_star2_O0/findstr[P]version-database/diff.c
// Function: verify
static void
verify(dr_t a, dr_t b, dr_t p)
{
	char *s, *e, buf[1024];
	dr_t apath, bpath;
	dr_t fingera, fingerb;
	struct patch_args args;
	snprintf(buf, sizeof(buf), "_temp/%s/", str(a));
	apath = dr_newstr(buf);
	snprintf(buf, sizeof(buf), "_temp/%s/", str(b));
	bpath = dr_newstr(buf);
	//checkout
	checkout(a, apath);
	checkout(b, bpath);
	args.hash = a;
	args.patch = p;
	args.output = apath;
	patch(&args);
	//verify finger
	snprintf(buf, sizeof(buf), "%s/"FINGERPRINT_NAME, str(apath));
	fingera = dir_readfile(buf, NULL);
	snprintf(buf, sizeof(buf), "%s/"FINGERPRINT_NAME, str(bpath));
	fingerb = dir_readfile(buf, NULL);
	assert(dr_cmp(fingera, fingerb) == 0);
	//verify file
	s = e = str(fingera);
	e += fingera->size;
	while (s < e) {
		dr_t data, dhash;
		char *hash, *path;
		hash = s; s = strchr(s, '\t'); *s = 0;
		path = ++s; s = strchr(s, '\n'); *s++ = 0;
		data = dir_readfile(path, apath);
		dhash = db_hash(data);
		if (strcmp(str(dhash), hash) != 0) {
			fprintf(stderr, "%s != %s", hash, str(dhash));
			exit(EINVAL);
		}
		dr_unref(data);
		dr_unref(dhash);
	}
	dr_unref(fingera);
	dr_unref(fingerb);
	dr_unref(apath);
	dr_unref(bpath);
	system("rm -rf _temp");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x490, %rsp            # imm = 0x490
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
leaq -0x430(%rbp), %rdi
movq -0x8(%rbp), %rcx
addq $0x8, %rcx
movl $0x400, %esi            # imm = 0x400
leaq 0x8260(%rip), %rdx      # 0xc372
movb $0x0, %al
callq 0x2110
leaq -0x430(%rbp), %rdi
callq 0x40a0
movq %rax, -0x438(%rbp)
leaq -0x430(%rbp), %rdi
movq -0x10(%rbp), %rcx
addq $0x8, %rcx
movl $0x400, %esi            # imm = 0x400
leaq 0x822b(%rip), %rdx      # 0xc372
movb $0x0, %al
callq 0x2110
leaq -0x430(%rbp), %rdi
callq 0x40a0
movq %rax, -0x440(%rbp)
movq -0x8(%rbp), %rdi
movq -0x438(%rbp), %rsi
callq 0x4e70
movq -0x10(%rbp), %rdi
movq -0x440(%rbp), %rsi
callq 0x4e70
movq -0x8(%rbp), %rax
movq %rax, -0x468(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x460(%rbp)
movq -0x438(%rbp), %rax
movq %rax, -0x458(%rbp)
leaq -0x468(%rbp), %rdi
callq 0x4710
leaq -0x430(%rbp), %rdi
movq -0x438(%rbp), %rcx
addq $0x8, %rcx
movl $0x400, %esi            # imm = 0x400
leaq 0x81ad(%rip), %rdx      # 0xc37c
movb $0x0, %al
callq 0x2110
leaq -0x430(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x5390
movq %rax, -0x448(%rbp)
leaq -0x430(%rbp), %rdi
movq -0x440(%rbp), %rcx
addq $0x8, %rcx
movl $0x400, %esi            # imm = 0x400
leaq 0x8171(%rip), %rdx      # 0xc37c
movb $0x0, %al
callq 0x2110
leaq -0x430(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x5390
movq %rax, -0x450(%rbp)
movq -0x448(%rbp), %rdi
movq -0x450(%rbp), %rsi
callq 0x3e20
cmpl $0x0, %eax
jne 0x4243
jmp 0x4262
leaq 0x8142(%rip), %rdi      # 0xc38c
leaq 0x80a9(%rip), %rsi      # 0xc2fa
movl $0x90, %edx
leaq 0x814d(%rip), %rcx      # 0xc3aa
callq 0x2120
movq -0x448(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x28(%rbp)
movq %rax, -0x20(%rbp)
movq -0x448(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x28(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0x4390
movq -0x20(%rbp), %rax
movq %rax, -0x480(%rbp)
movq -0x20(%rbp), %rdi
movl $0x9, %esi
callq 0x20f0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movb $0x0, (%rax)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq %rax, -0x488(%rbp)
movq -0x20(%rbp), %rdi
movl $0xa, %esi
callq 0x20f0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movb $0x0, (%rax)
movq -0x488(%rbp), %rdi
movq -0x438(%rbp), %rsi
callq 0x5390
movq %rax, -0x470(%rbp)
movq -0x470(%rbp), %rdi
callq 0x59b0
movq %rax, -0x478(%rbp)
movq -0x478(%rbp), %rdi
addq $0x8, %rdi
movq -0x480(%rbp), %rsi
callq 0x2190
cmpl $0x0, %eax
je 0x4373
movq 0xbcb2(%rip), %rax      # 0xfff8
movq (%rax), %rdi
movq -0x480(%rbp), %rdx
movq -0x478(%rbp), %rcx
addq $0x8, %rcx
leaq 0x8066(%rip), %rsi      # 0xc3c8
movb $0x0, %al
callq 0x21a0
movl $0x16, %edi
callq 0x2270
movq -0x470(%rbp), %rdi
callq 0x3d80
movq -0x478(%rbp), %rdi
callq 0x3d80
jmp 0x428d
movq -0x448(%rbp), %rdi
callq 0x3d80
movq -0x450(%rbp), %rdi
callq 0x3d80
movq -0x438(%rbp), %rdi
callq 0x3d80
movq -0x440(%rbp), %rdi
callq 0x3d80
leaq 0x800a(%rip), %rdi      # 0xc3d1
callq 0x20e0
addq $0x490, %rsp            # imm = 0x490
popq %rbp
retq
nopw %cs:(%rax,%rax)