// File: /workspace/github_c_makefile_star2_O3/haxlang[P]hax/haxUnixAZ.c
// Function: Hax_SeekCmd
int
Hax_SeekCmd(
    ClientData clientData,		/* Unix ClientData */
    Hax_Interp *interp,			/* Current interpreter. */
    int argc,				/* Number of arguments. */
    char **argv				/* Argument strings. */)
{
    UnixClientData *clientDataPtr;
    OpenFile *filePtr;
    long long int offset;
    int mode;

    if ((argc != 3) && (argc != 4)) {
	Hax_AppendResult(interp, "wrong # args: should be \"", argv[0],
		" fileId offset ?origin?\"", (char *) NULL);
	return HAX_ERROR;
    }

    clientDataPtr = (UnixClientData *) clientData;
    if (HaxGetOpenFile(interp, clientDataPtr, argv[1], &filePtr) != HAX_OK) {
	return HAX_ERROR;
    }
    if (Hax_GetLongLong(interp, argv[2], &offset) != HAX_OK) {
	return HAX_ERROR;
    }
    mode = SEEK_SET;
    if (argc == 4) {
	int length;
	char c;

	length = strlen(argv[3]);
	c = argv[3][0];
	if ((c == 's') && (strncmp(argv[3], "start", length) == 0)) {
	    mode = SEEK_SET;
	} else if ((c == 'c') && (strncmp(argv[3], "current", length) == 0)) {
	    mode = SEEK_CUR;
	} else if ((c == 'e') && (strncmp(argv[3], "end", length) == 0)) {
	    mode = SEEK_END;
	} else {
	    Hax_AppendResult(interp, "bad origin \"", argv[3],
		    "\": should be start, current, or end", (char *) NULL);
	    return HAX_ERROR;
	}
    }
    if (fseeko(filePtr->f, offset, mode) == -1) {
	Hax_AppendResult(interp, "error during seek: ",
		Hax_UnixError(interp), (char *) NULL);
	clearerr(filePtr->f);
	return HAX_ERROR;
    }

    return HAX_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r14
movl %edx, %r15d
movq %rsi, %rbx
leal -0x5(%r15), %eax
cmpl $-0x3, %eax
ja 0x66e1
movq (%r14), %rdx
leaq 0x1a7d(%rip), %rsi      # 0x8143
leaq 0x201b(%rip), %rcx      # 0x86e8
movq %rbx, %rdi
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x3510
movl $0x1, %ebp
jmp 0x6713
movq %rdi, %rsi
movq 0x8(%r14), %rdx
leaq 0x8(%rsp), %rcx
movq %rbx, %rdi
callq 0x3060
movl $0x1, %ebp
testl %eax, %eax
jne 0x6713
movq 0x10(%r14), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x35c0
testl %eax, %eax
je 0x6720
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
movl $0x0, %edx
cmpl $0x4, %r15d
jne 0x67be
movq 0x18(%r14), %r14
movq %r14, %rdi
callq 0x3190
movzbl (%r14), %ecx
cmpl $0x63, %ecx
je 0x678a
cmpl $0x65, %ecx
je 0x676d
cmpl $0x73, %ecx
jne 0x67a0
movslq %eax, %rdx
leaq 0x2736(%rip), %rsi      # 0x8e90
movq %r14, %rdi
callq 0x30b0
movl $0x0, %edx
testl %eax, %eax
jne 0x67a0
jmp 0x67be
movslq %eax, %rdx
leaq 0x1fbf(%rip), %rsi      # 0x8736
movq %r14, %rdi
callq 0x30b0
testl %eax, %eax
jne 0x67a0
movl $0x2, %edx
jmp 0x67be
movslq %eax, %rdx
leaq 0x1f6d(%rip), %rsi      # 0x8701
movq %r14, %rdi
callq 0x30b0
testl %eax, %eax
je 0x67b9
leaq 0x1f62(%rip), %rsi      # 0x8709
leaq 0x1f68(%rip), %rcx      # 0x8716
movq %rbx, %rdi
movq %r14, %rdx
jmp 0x66d0
movl $0x1, %edx
movq 0x8(%rsp), %rax
movq (%rax), %rdi
movq 0x10(%rsp), %rsi
callq 0x3500
cmpl $-0x1, %eax
jne 0x6713
movq %rbx, %rdi
callq 0x31b0
leaq 0x1f52(%rip), %rsi      # 0x873a
movq %rbx, %rdi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x3510
movq 0x8(%rsp), %rax
movq (%rax), %rdi
callq 0x33a0
jmp 0x66da