#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 */
typedef char chtype;
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
double abs(int);
int /*<<< orphan*/ move(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mvwaddch(int /*<<< orphan*/ *, int, int, char);
int nearbyint(double);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
void draw_X(WINDOW *board, int y_position, int x_position) {
  chtype ch = 'X';
  signed int delta_y, delta_x;
  double ddel_y;
  for (delta_x = 1 - (16 / 2); delta_x < (16 / 2); ++delta_x) {
    if (delta_x == 0)
      continue;
    ddel_y = (((double)(8 - 1)) / (16 - 1)) * abs(delta_x);
    delta_y = nearbyint(ddel_y);
    mvwaddch(board, y_position + delta_y, x_position + delta_x, ch);
    ddel_y = -(((double)(8 - 1)) / (16 - 1)) * abs(delta_x);
    delta_y = nearbyint(ddel_y);
    mvwaddch(board, y_position + delta_y, x_position + delta_x, ch);
  }
  move(0, 0);
  wrefresh(board);
}


x86 assembly (clang, -O0):
<draw_X>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movb   $0x58,-0x11(%rbp)
movl   $0xfffffff9,-0x1c(%rbp)
cmpl   $0x8,-0x1c(%rbp)
jge    1218 <draw_X+0xc8>
cmpl   $0x0,-0x1c(%rbp)
jne    1186 <draw_X+0x36>
jmp    120a <draw_X+0xba>
mov    -0x1c(%rbp),%edi
call   1030 <abs@plt>
movaps %xmm0,%xmm1
movsd  0xe6f(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1050 <nearbyint@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    -0x18(%rbp),%esi
mov    -0x10(%rbp),%edx
add    -0x1c(%rbp),%edx
movsbl -0x11(%rbp),%ecx
call   1060 <mvwaddch@plt>
mov    -0x1c(%rbp),%edi
call   1030 <abs@plt>
movaps %xmm0,%xmm1
movsd  0xe25(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1050 <nearbyint@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    -0x18(%rbp),%esi
mov    -0x10(%rbp),%edx
add    -0x1c(%rbp),%edx
movsbl -0x11(%rbp),%ecx
call   1060 <mvwaddch@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    116d <draw_X+0x1d>
xor    %esi,%esi
mov    %esi,%edi
call   1070 <move@plt>
mov    -0x8(%rbp),%rdi
call   1040 <wrefresh@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_X>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r14d
mov    %esi,%r12d
mov    %rdi,%r15
mov    $0xfffffff9,%ebx
jmp    1178 <draw_X+0x28>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
cmp    $0x8,%ebx
je     11d0 <draw_X+0x80>
test   %ebx,%ebx
je     1170 <draw_X+0x20>
mov    %ebx,%edi
call   1030 <abs@plt>
mulsd  0xe75(%rip),%xmm0
call   1050 <nearbyint@plt>
lea    (%rax,%r12,1),%esi
lea    (%r14,%rbx,1),%ebp
mov    %r15,%rdi
mov    %ebp,%edx
mov    $0x58,%ecx
call   1060 <mvwaddch@plt>
mov    %ebx,%edi
call   1030 <abs@plt>
mulsd  0xe52(%rip),%xmm0
call   1050 <nearbyint@plt>
lea    (%rax,%r12,1),%esi
mov    %r15,%rdi
mov    %ebp,%edx
mov    $0x58,%ecx
call   1060 <mvwaddch@plt>
jmp    1170 <draw_X+0x20>
xor    %edi,%edi
xor    %esi,%esi
call   1070 <move@plt>
mov    %r15,%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <wrefresh@plt>

LLVM IR (-O0):
define void @draw_X(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
%8 = alloca i32
%9 = alloca i32
%10 = alloca double
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i8 88, i8* %7
store i32 -7, i32* %9
br label %11
11: ; preds = %47, %3
%12 = load i32, i32* %9
%13 = icmp slt i32 %12, 8
br i1 %13, label %14, label %50
14: ; preds = %11
%15 = load i32, i32* %9
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %14
br label %47
18: ; preds = %14
%19 = load i32, i32* %9
%20 = call double @abs(i32 %19)
%21 = fmul double 0x3FDDDDDDDDDDDDDE, %20
store double %21, double* %10
%22 = load double, double* %10
%23 = call i32 @nearbyint(double %22)
store i32 %23, i32* %8
%24 = load i32*, i32** %4
%25 = load i32, i32* %5
%26 = load i32, i32* %8
%27 = add nsw i32 %25, %26
%28 = load i32, i32* %6
%29 = load i32, i32* %9
%30 = add nsw i32 %28, %29
%31 = load i8, i8* %7
%32 = call i32 @mvwaddch(i32* %24, i32 %27, i32 %30, i8 signext %31)
%33 = load i32, i32* %9
%34 = call double @abs(i32 %33)
%35 = fmul double 0xBFDDDDDDDDDDDDDE, %34
store double %35, double* %10
%36 = load double, double* %10
%37 = call i32 @nearbyint(double %36)
store i32 %37, i32* %8
%38 = load i32*, i32** %4
%39 = load i32, i32* %5
%40 = load i32, i32* %8
%41 = add nsw i32 %39, %40
%42 = load i32, i32* %6
%43 = load i32, i32* %9
%44 = add nsw i32 %42, %43
%45 = load i8, i8* %7
%46 = call i32 @mvwaddch(i32* %38, i32 %41, i32 %44, i8 signext %45)
br label %47
47: ; preds = %18, %17
%48 = load i32, i32* %9
%49 = add nsw i32 %48, 1
store i32 %49, i32* %9
br label %11
50: ; preds = %11
%51 = call i32 @move(i32 0, i32 0)
%52 = load i32*, i32** %4
%53 = call i32 @wrefresh(i32* %52)
ret void
}

LLVM IR (-O2):
define void @draw_X(i32* %0, i32 %1, i32 %2) {
br label %4
4: ; preds = %3, %19
%5 = phi i32 [ -7, %3 ], [ %20, %19 ]
%6 = icmp eq i32 %5, 0
br i1 %6, label %19, label %7
7: ; preds = %4
%8 = tail call double @abs(i32 %5)
%9 = fmul double %8, 0x3FDDDDDDDDDDDDDE
%10 = tail call i32 @nearbyint(double %9)
%11 = add nsw i32 %10, %1
%12 = add nsw i32 %5, %2
%13 = tail call i32 @mvwaddch(i32* %0, i32 %11, i32 %12, i8 signext 88)
%14 = tail call double @abs(i32 %5)
%15 = fmul double %14, 0xBFDDDDDDDDDDDDDE
%16 = tail call i32 @nearbyint(double %15)
%17 = add nsw i32 %16, %1
%18 = tail call i32 @mvwaddch(i32* %0, i32 %17, i32 %12, i8 signext 88)
br label %19
19: ; preds = %4, %7
%20 = add nsw i32 %5, 1
%21 = icmp eq i32 %20, 8
br i1 %21, label %22, label %4
22: ; preds = %19
%23 = tail call i32 @move(i32 0, i32 0)
%24 = tail call i32 @wrefresh(i32* %0)
ret void
}