#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*/ move(int, int);
int /*<<< orphan*/ printw(char *, char *);
int snprintf(char *, int, char *, int, int);
int draw_coordinates(int x, int y, int posx, int posy) {
  int len;
  char buff[512];
  len = snprintf(buff, 511, "(%03i,%03i)", posx, posy);
  move(0, (x - len) / 2);
  printw("%s", buff);
  move(y - 1, x - 1);
  return (0);
}


x86 assembly (clang, -O0):
<draw_coordinates>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
lea    -0x220(%rbp),%rdi
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
mov    $0x1ff,%esi
lea    0xe9f(%rip),%rdx
call   1030 <snprintf@plt>
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
sub    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
xor    %edi,%edi
call   1050 <move@plt>
lea    -0x220(%rbp),%rsi
lea    0xe7e(%rip),%rdi
call   1040 <printw@plt>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x4(%rbp),%esi
sub    $0x1,%esi
call   1050 <move@plt>
xor    %eax,%eax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_coordinates>:
push   %rbp
push   %r14
push   %rbx
sub    $0x200,%rsp
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xeb5(%rip),%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x1ff,%esi
call   1030 <snprintf@plt>
mov    %ebp,%ecx
sub    %eax,%ecx
mov    %ecx,%esi
shr    $0x1f,%esi
add    %ecx,%esi
sar    %esi
xor    %edi,%edi
call   1050 <move@plt>
lea    0xe96(%rip),%rdi
mov    %r14,%rsi
call   1040 <printw@plt>
add    $0xffffffff,%ebx
add    $0xffffffff,%ebp
mov    %ebx,%edi
mov    %ebp,%esi
call   1050 <move@plt>
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"(%03i,%03i)\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @draw_coordinates(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [512 x i8]
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 0
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = call i32 @snprintf(i8* %11, i32 511, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %13)
store i32 %14, i32* %9
%15 = load i32, i32* %5
%16 = load i32, i32* %9
%17 = sub nsw i32 %15, %16
%18 = sdiv i32 %17, 2
%19 = call i32 @move(i32 0, i32 %18)
%20 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 0
%21 = call i32 @printw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %20)
%22 = load i32, i32* %6
%23 = sub nsw i32 %22, 1
%24 = load i32, i32* %5
%25 = sub nsw i32 %24, 1
%26 = call i32 @move(i32 %23, i32 %25)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"(%03i,%03i)\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @draw_coordinates(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca [512 x i8]
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%7 = call i32 @snprintf(i8* %6, i32 511, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %3)
%8 = sub nsw i32 %0, %7
%9 = sdiv i32 %8, 2
%10 = call i32 @move(i32 0, i32 %9)
%11 = call i32 @printw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%12 = add nsw i32 %1, -1
%13 = add nsw i32 %0, -1
%14 = call i32 @move(i32 %12, i32 %13)
ret i32 0
}