#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*/ printf(char *, ...);
void location(char *what, short x, short y) {
  printf("%sColumn(X): %d%s (chars) or %hdp (pixels)", what, x / 8 + 1,
         x % 8 ? "+" : "", x);
  printf("   Row(Y): %d%s (chars) or %hdp (pixels)\n", y / 16 + 1,
         y % 16 ? "+" : "", y);
}


x86 assembly (clang, -O0):
<location>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dx,%ax
mov    %si,%cx
mov    %rdi,-0x8(%rbp)
mov    %cx,-0xa(%rbp)
mov    %ax,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
movswl -0xa(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
movswl -0xa(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
mov    -0x10(%rbp),%edx
lea    0xefe(%rip),%rcx
lea    0xecc(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%rcx
movswl -0xa(%rbp),%r8d
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movswl -0xc(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
add    $0x1,%esi
movswl -0xc(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
lea    0xeb7(%rip),%rdx
lea    0xe85(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
movswl -0xc(%rbp),%ecx
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<location>:
push   %r15
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%r8d
mov    %rdi,%rsi
lea    0x7(%r8),%eax
test   %r8w,%r8w
cmovns %r8d,%eax
cwtl
sar    $0x3,%eax
add    $0x1,%eax
movswl %ax,%edx
test   $0x7,%r8b
lea    0xf17(%rip),%r15
lea    0xee5(%rip),%rbx
mov    %rbx,%rcx
cmove  %r15,%rcx
lea    0xeac(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf(%r14),%eax
test   %r14w,%r14w
cmovns %r14d,%eax
cwtl
sar    $0x4,%eax
add    $0x1,%eax
movswl %ax,%esi
test   $0xf,%r14b
cmove  %r15,%rbx
lea    0xead(%rip),%rdi
mov    %rbx,%rdx
mov    %r14d,%ecx
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [43 x i8] c"%sColumn(X): %d%s (chars) or %hdp (pixels)\00"
@.str.1 = [2 x i8] c"+\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [42 x i8] c" Row(Y): %d%s (chars) or %hdp (pixels)\0A\00"
define void @location(i8* %0, i16 signext %1, i16 signext %2) {
%4 = alloca i8*
%5 = alloca i16
%6 = alloca i16
store i8* %0, i8** %4
store i16 %1, i16* %5
store i16 %2, i16* %6
%7 = load i8*, i8** %4
%8 = load i16, i16* %5
%9 = sext i16 %8 to i32
%10 = sdiv i32 %9, 8
%11 = add nsw i32 %10, 1
%12 = load i16, i16* %5
%13 = sext i16 %12 to i32
%14 = srem i32 %13, 8
%15 = icmp ne i32 %14, 0
%16 = zext i1 %15 to i64
%17 = select i1 %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%18 = load i16, i16* %5
%19 = sext i16 %18 to i32
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %11, i8* %17, i32 %19)
%21 = load i16, i16* %6
%22 = sext i16 %21 to i32
%23 = sdiv i32 %22, 16
%24 = add nsw i32 %23, 1
%25 = load i16, i16* %6
%26 = sext i16 %25 to i32
%27 = srem i32 %26, 16
%28 = icmp ne i32 %27, 0
%29 = zext i1 %28 to i64
%30 = select i1 %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%31 = load i16, i16* %6
%32 = sext i16 %31 to i32
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i32 %24, i8* %30, i32 %32)
ret void
}

LLVM IR (-O2):
@.str = [43 x i8] c"%sColumn(X): %d%s (chars) or %hdp (pixels)\00"
@.str.1 = [2 x i8] c"+\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [42 x i8] c" Row(Y): %d%s (chars) or %hdp (pixels)\0A\00"
define void @location(i8* %0, i16 signext %1, i16 signext %2) {
%4 = sext i16 %1 to i32
%5 = sdiv i16 %1, 8
%6 = add nsw i16 %5, 1
%7 = sext i16 %6 to i32
%8 = and i32 %4, 7
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %7, i8* %10, i32 %4)
%12 = sext i16 %2 to i32
%13 = sdiv i16 %2, 16
%14 = add nsw i16 %13, 1
%15 = sext i16 %14 to i32
%16 = and i32 %12, 15
%17 = icmp eq i32 %16, 0
%18 = select i1 %17, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i32 %15, i8* %18, i32 %12)
ret void
}