// File: /workspace/github_c_makefile_star2_O1/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 %r12
pushq %rbx
subq $0x10, %rsp
movq %rcx, %r14
movl %edx, %r15d
movq %rsi, %rbx
leal -0x5(%r15), %eax
cmpl $-0x3, %eax
ja 0x67f2
movq (%r14), %rdx
leaq 0x2967(%rip), %rsi      # 0x9143
leaq 0x2ee1(%rip), %rcx      # 0x96c4
movq %rbx, %rdi
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x3510
jmp 0x681d
movq %rdi, %rsi
movq 0x8(%r14), %rdx
movq %rsp, %rcx
movq %rbx, %rdi
callq 0x3060
testl %eax, %eax
jne 0x681d
movq 0x10(%r14), %rsi
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x35c0
testl %eax, %eax
je 0x6831
movl $0x1, %ebp
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
movl $0x0, %edx
cmpl $0x4, %r15d
jne 0x68fc
movq 0x18(%r14), %r14
movq %r14, %rdi
callq 0x3190
movq %rax, %r15
movzbl (%r14), %r12d
cmpl $0x63, %r12d
je 0x6889
cmpl $0x65, %r12d
je 0x68a5
cmpl $0x73, %r12d
jne 0x68bb
movslq %r15d, %rdx
leaq 0x35fb(%rip), %rsi      # 0x9e6c
movq %r14, %rdi
callq 0x30b0
testl %eax, %eax
je 0x68ee
cmpl $0x65, %r12d
je 0x68a5
cmpl $0x63, %r12d
jne 0x68bb
movslq %r15d, %rdx
leaq 0x2e4a(%rip), %rsi      # 0x96dd
movq %r14, %rdi
callq 0x30b0
testl %eax, %eax
je 0x68e7
cmpl $0x65, %r12d
jne 0x68bb
movslq %r15d, %rdx
leaq 0x2e63(%rip), %rsi      # 0x9712
movq %r14, %rdi
callq 0x30b0
testl %eax, %eax
je 0x68e0
leaq 0x2e23(%rip), %rsi      # 0x96e5
leaq 0x2e29(%rip), %rcx      # 0x96f2
xorl %r15d, %r15d
movq %rbx, %rdi
movq %r14, %rdx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x3510
xorl %edx, %edx
jmp 0x68f3
movl $0x2, %edx
jmp 0x68f0
movl $0x1, %edx
jmp 0x68f0
xorl %edx, %edx
movb $0x1, %r15b
testb %r15b, %r15b
je 0x681d
movq (%rsp), %rax
movq (%rax), %rdi
movq 0x8(%rsp), %rsi
callq 0x3500
cmpl $-0x1, %eax
jne 0x6822
movq %rbx, %rdi
callq 0x31b0
leaq 0x2df1(%rip), %rsi      # 0x9716
movq %rbx, %rdi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x3510
movq (%rsp), %rax
movq (%rax), %rdi
callq 0x33a0
jmp 0x681d