#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ hil_xy_from_s_64(unsigned long long, unsigned int,
                                    unsigned long long *, unsigned long long *);
void tile_serial_to_coordinate_64(unsigned long long serial, unsigned *pz,
                                  unsigned *px, unsigned *py) {
  unsigned n = (serial & 0x7c00000000000000ULL) >> 58;
  unsigned long long s = serial & 0x3ffffffffffffffULL;
  unsigned long long xp, yp;
  hil_xy_from_s_64(s, n, &xp, &yp);
  *pz = n;
  *px = (unsigned)xp;
  *py = (unsigned)yp;
}


x86 assembly (clang, -O0):
<tile_serial_to_coordinate_64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movabs $0x7c00000000000000,%rax
and    -0x8(%rbp),%rax
shr    $0x3a,%rax
mov    %eax,-0x24(%rbp)
movabs $0x3ffffffffffffff,%rax
ff ff 03
and    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x24(%rbp),%esi
lea    -0x38(%rbp),%rdx
lea    -0x40(%rbp),%rcx
call   1030 <hil_xy_from_s_64@plt>
mov    -0x24(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x38(%rbp),%rax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x40(%rbp),%rax
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tile_serial_to_coordinate_64>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
shr    $0x3a,%rbx
and    $0x1f,%ebx
movabs $0x3ffffffffffffff,%rax
ff ff 03
and    %rax,%rdi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %ebx,%esi
call   1030 <hil_xy_from_s_64@plt>
mov    %ebx,(%r12)
mov    0x10(%rsp),%eax
mov    %eax,(%r15)
mov    0x8(%rsp),%eax
mov    %eax,(%r14)
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @tile_serial_to_coordinate_64(i64 %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i64
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
store i64 %0, i64* %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%13 = load i64, i64* %5
%14 = and i64 %13, 8935141660703064064
%15 = lshr i64 %14, 58
%16 = trunc i64 %15 to i32
store i32 %16, i32* %9
%17 = load i64, i64* %5
%18 = and i64 %17, 288230376151711743
store i64 %18, i64* %10
%19 = load i64, i64* %10
%20 = load i32, i32* %9
%21 = call i32 @hil_xy_from_s_64(i64 %19, i32 %20, i64* %11, i64* %12)
%22 = load i32, i32* %9
%23 = load i32*, i32** %6
store i32 %22, i32* %23
%24 = load i64, i64* %11
%25 = trunc i64 %24 to i32
%26 = load i32*, i32** %7
store i32 %25, i32* %26
%27 = load i64, i64* %12
%28 = trunc i64 %27 to i32
%29 = load i32*, i32** %8
store i32 %28, i32* %29
ret void
}

LLVM IR (-O2):
define void @tile_serial_to_coordinate_64(i64 %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3) {
%5 = alloca i64
%6 = alloca i64
%7 = lshr i64 %0, 58
%8 = trunc i64 %7 to i32
%9 = and i32 %8, 31
%10 = and i64 %0, 288230376151711743
%11 = bitcast i64* %5 to i8*
%12 = bitcast i64* %6 to i8*
%13 = call i32 @hil_xy_from_s_64(i64 %10, i32 %9, i64* %5, i64* %6)
store i32 %9, i32* %1
%14 = load i64, i64* %5
%15 = trunc i64 %14 to i32
store i32 %15, i32* %2
%16 = load i64, i64* %6
%17 = trunc i64 %16 to i32
store i32 %17, i32* %3
ret void
}