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

/* Variables and functions */
int /*<<< orphan*/ mvwaddch(int /*<<< orphan*/ *, int, int, char);
void draw_numbers(WINDOW *board) {
  for (short i = 0; i < 9; ++i)
    mvwaddch(board, ((8 / 2) + (8 * (i / 3))), ((16 / 2) + (16 * (i % 3))),
             '1' + i);
}


x86 assembly (clang, -O0):
<draw_numbers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movw   $0x0,-0xa(%rbp)
movswl -0xa(%rbp),%eax
cmp    $0x9,%eax
jge    1179 <draw_numbers+0x69>
mov    -0x8(%rbp),%rdi
movswl -0xa(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
shl    $0x3,%esi
add    $0x4,%esi
movswl -0xa(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
shl    $0x4,%edx
add    $0x8,%edx
movswl -0xa(%rbp),%eax
add    $0x31,%eax
movsbl %al,%ecx
call   1030 <mvwaddch@plt>
mov    -0xa(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0xa(%rbp)
jmp    1122 <draw_numbers+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_numbers>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
mov    $0x8,%bp
xor    %ebx,%ebx
nopl   (%rax)
movzwl %bx,%eax
imul   $0xaaab,%eax,%eax
shr    $0x11,%eax
lea    0x4(,%rax,8),%esi
shl    $0x4,%eax
lea    (%rax,%rax,2),%eax
mov    %ebp,%ecx
sub    %eax,%ecx
movzwl %cx,%edx
lea    0x31(%rbx),%eax
movsbl %al,%ecx
mov    %r14,%rdi
call   1030 <mvwaddch@plt>
add    $0x1,%ebx
add    $0x10,%ebp
cmp    $0x9,%bx
jne    1120 <draw_numbers+0x10>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @draw_numbers(i32* %0) {
%2 = alloca i32*
%3 = alloca i16
store i32* %0, i32** %2
store i16 0, i16* %3
br label %4
4: ; preds = %25, %1
%5 = load i16, i16* %3
%6 = sext i16 %5 to i32
%7 = icmp slt i32 %6, 9
br i1 %7, label %8, label %28
8: ; preds = %4
%9 = load i32*, i32** %2
%10 = load i16, i16* %3
%11 = sext i16 %10 to i32
%12 = sdiv i32 %11, 3
%13 = mul nsw i32 8, %12
%14 = add nsw i32 4, %13
%15 = load i16, i16* %3
%16 = sext i16 %15 to i32
%17 = srem i32 %16, 3
%18 = mul nsw i32 16, %17
%19 = add nsw i32 8, %18
%20 = load i16, i16* %3
%21 = sext i16 %20 to i32
%22 = add nsw i32 49, %21
%23 = trunc i32 %22 to i8
%24 = call i32 @mvwaddch(i32* %9, i32 %14, i32 %19, i8 signext %23)
br label %25
25: ; preds = %8
%26 = load i16, i16* %3
%27 = add i16 %26, 1
store i16 %27, i16* %3
br label %4
28: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @draw_numbers(i32* %0) {
br label %3
2: ; preds = %3
ret void
3: ; preds = %1, %3
%4 = phi i16 [ 0, %1 ], [ %16, %3 ]
%5 = udiv i16 %4, 3
%6 = zext i16 %5 to i32
%7 = shl nuw nsw i32 %6, 3
%8 = or i32 %7, 4
%9 = urem i16 %4, 3
%10 = shl nuw nsw i16 %9, 4
%11 = or i16 %10, 8
%12 = zext i16 %11 to i32
%13 = trunc i16 %4 to i8
%14 = add i8 %13, 49
%15 = tail call i32 @mvwaddch(i32* %0, i32 %8, i32 %12, i8 signext %14)
%16 = add nuw nsw i16 %4, 1
%17 = icmp eq i16 %16, 9
br i1 %17, label %2, label %3
}