// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/rar.c
// Function: do_rar5_extrarec_timestamps
static void do_rar5_extrarec_timestamps(deark *c, de_arch_lctx *d, struct rar5_extra_data *ed,
	i64 pos1, i64 len)
{
	UI flags;
	enum de_arch_tstype_enum tstype;
	i64 pos = pos1;
	i64 n;
	double subsec;

	if(len<1) goto done;
	ed->have_timestamps = 1;
	flags = (UI)rar_get_vint_p(d, c->infile, &pos);
	de_dbg(c, "flags: 0x%x", flags);
	tstype = (flags & 0x1) ? DE_ARCH_TSTYPE_UNIX_U : DE_ARCH_TSTYPE_FILETIME;
	if(flags & 0x2) {
		de_arch_read_field_dttm_p(d, &ed->tmstamp[DE_TIMESTAMPIDX_MODIFY], "mod",
			tstype, &pos);
	}
	if(flags & 0x4) {
		de_arch_read_field_dttm_p(d, &ed->tmstamp[DE_TIMESTAMPIDX_CREATE], "create",
			tstype, &pos);
	}
	if(flags & 0x8) {
		de_arch_read_field_dttm_p(d, &ed->tmstamp[DE_TIMESTAMPIDX_ACCESS], "access",
			tstype, &pos);
	}

	// Unix time w/nanosecond precision.
	// FIXME: This ought to be shown in the debug message above.
	if((flags & 0x13)==0x13) {
		n = de_getu32le_p(&pos);
		subsec = ((double)n) / 1000000000.0;
		de_timestamp_set_subsec(&ed->tmstamp[DE_TIMESTAMPIDX_MODIFY], subsec);
	}
	if((flags & 0x15)==0x15) {
		n = de_getu32le_p(&pos);
		subsec = ((double)n) / 1000000000.0;
		de_timestamp_set_subsec(&ed->tmstamp[DE_TIMESTAMPIDX_CREATE], subsec);
	}
	if((flags & 0x19)==0x19) {
		n = de_getu32le_p(&pos);
		subsec = ((double)n) / 1000000000.0;
		de_timestamp_set_subsec(&ed->tmstamp[DE_TIMESTAMPIDX_ACCESS], subsec);
	}

done:
	;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpq $0x1, -0x28(%rbp)
jge 0x152fa0
jmp 0x153158
movq -0x18(%rbp), %rax
movb $0x1, (%rax)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rsi
leaq -0x38(%rbp), %rdx
callq 0x152690
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %edx
leaq 0x7e141(%rip), %rsi     # 0x1d110e
movb $0x0, %al
callq 0x15b0d0
movl -0x2c(%rbp), %edx
andl $0x1, %edx
movl $0x6, %eax
movl $0x2, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x30(%rbp)
movl -0x2c(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x153017
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x8, %rsi
movl -0x30(%rbp), %ecx
leaq 0x50ee5(%rip), %rdx     # 0x1a3ef3
leaq -0x38(%rbp), %r8
callq 0x17c580
movl -0x2c(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x153045
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x8, %rsi
addq $0x10, %rsi
movl -0x30(%rbp), %ecx
leaq 0x50fff(%rip), %rdx     # 0x1a403b
leaq -0x38(%rbp), %r8
callq 0x17c580
movl -0x2c(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x153073
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x8, %rsi
addq $0x20, %rsi
movl -0x30(%rbp), %ecx
leaq 0x4e42a(%rip), %rdx     # 0x1a1494
leaq -0x38(%rbp), %r8
callq 0x17c580
movl -0x2c(%rbp), %eax
andl $0x13, %eax
cmpl $0x13, %eax
jne 0x1530bc
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x38(%rbp), %rsi
callq 0x165580
movq %rax, -0x40(%rbp)
cvtsi2sdq -0x40(%rbp), %xmm0
movsd 0x536bf(%rip), %xmm1    # 0x1a6760
divsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
movsd -0x48(%rbp), %xmm0
callq 0x15d5e0
movl -0x2c(%rbp), %eax
andl $0x15, %eax
cmpl $0x15, %eax
jne 0x153109
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x38(%rbp), %rsi
callq 0x165580
movq %rax, -0x40(%rbp)
cvtsi2sdq -0x40(%rbp), %xmm0
movsd 0x53676(%rip), %xmm1    # 0x1a6760
divsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
addq $0x10, %rdi
movsd -0x48(%rbp), %xmm0
callq 0x15d5e0
movl -0x2c(%rbp), %eax
andl $0x19, %eax
cmpl $0x19, %eax
jne 0x153156
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x38(%rbp), %rsi
callq 0x165580
movq %rax, -0x40(%rbp)
cvtsi2sdq -0x40(%rbp), %xmm0
movsd 0x53629(%rip), %xmm1    # 0x1a6760
divsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
addq $0x20, %rdi
movsd -0x48(%rbp), %xmm0
callq 0x15d5e0
jmp 0x153158
addq $0x50, %rsp
popq %rbp
retq
nop