#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*/ mvaddch(int, int, char);
void clear_field(int height, int width) {
  int starty = 1;
  int startx = 2;
  int i, j;
  int ch = 3 - 1;
  int cw = 5 - 1;
  for (i = 0; i < height; i++) {
    for (j = 0; j < width; j++) {
      int y = i * ch + starty + 1;
      int x = j * cw + startx + 2;
      mvaddch(y, x, ' ');
    }
  }
}


x86 assembly (clang, -O0):
<clear_field>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x2,-0x10(%rbp)
movl   $0x2,-0x1c(%rbp)
movl   $0x4,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11b1 <clear_field+0xa1>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    119e <clear_field+0x8e>
mov    -0x14(%rbp),%eax
imul   -0x1c(%rbp),%eax
add    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%eax
imul   -0x20(%rbp),%eax
add    -0x10(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    $0x20,%edx
call   1030 <mvaddch@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1154 <clear_field+0x44>
jmp    11a3 <clear_field+0x93>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1141 <clear_field+0x31>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_field>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1169 <clear_field+0x59>
mov    %esi,%r15d
mov    %edi,%r14d
xor    %r12d,%r12d
jmp    1139 <clear_field+0x29>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r12d
cmp    %r14d,%r12d
je     1169 <clear_field+0x59>
test   %r15d,%r15d
jle    1130 <clear_field+0x20>
lea    (%r12,%r12,1),%r13d
add    $0x2,%r13d
mov    $0x4,%ebx
mov    %r15d,%ebp
xchg   %ax,%ax
mov    %r13d,%edi
mov    %ebx,%esi
mov    $0x20,%edx
call   1030 <mvaddch@plt>
add    $0x4,%ebx
add    $0xffffffff,%ebp
jne    1150 <clear_field+0x40>
jmp    1130 <clear_field+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @clear_field(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 1, i32* %5
store i32 2, i32* %6
store i32 2, i32* %9
store i32 4, i32* %10
store i32 0, i32* %7
br label %13
13: ; preds = %42, %2
%14 = load i32, i32* %7
%15 = load i32, i32* %3
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %45
17: ; preds = %13
store i32 0, i32* %8
br label %18
18: ; preds = %38, %17
%19 = load i32, i32* %8
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %41
22: ; preds = %18
%23 = load i32, i32* %7
%24 = load i32, i32* %9
%25 = mul nsw i32 %23, %24
%26 = load i32, i32* %5
%27 = add nsw i32 %25, %26
%28 = add nsw i32 %27, 1
store i32 %28, i32* %11
%29 = load i32, i32* %8
%30 = load i32, i32* %10
%31 = mul nsw i32 %29, %30
%32 = load i32, i32* %6
%33 = add nsw i32 %31, %32
%34 = add nsw i32 %33, 2
store i32 %34, i32* %12
%35 = load i32, i32* %11
%36 = load i32, i32* %12
%37 = call i32 @mvaddch(i32 %35, i32 %36, i8 signext 32)
br label %38
38: ; preds = %22
%39 = load i32, i32* %8
%40 = add nsw i32 %39, 1
store i32 %40, i32* %8
br label %18
41: ; preds = %18
br label %42
42: ; preds = %41
%43 = load i32, i32* %7
%44 = add nsw i32 %43, 1
store i32 %44, i32* %7
br label %13
45: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @clear_field(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %21
4: ; preds = %2
%5 = icmp sgt i32 %1, 0
br label %6
6: ; preds = %4, %18
%7 = phi i32 [ 0, %4 ], [ %19, %18 ]
br i1 %5, label %8, label %18
8: ; preds = %6
%9 = shl nuw nsw i32 %7, 1
%10 = add nuw i32 %9, 2
br label %11
11: ; preds = %8, %11
%12 = phi i32 [ 0, %8 ], [ %16, %11 ]
%13 = shl nsw i32 %12, 2
%14 = add nuw i32 %13, 4
%15 = tail call i32 @mvaddch(i32 %10, i32 %14, i8 signext 32)
%16 = add nuw nsw i32 %12, 1
%17 = icmp eq i32 %16, %1
br i1 %17, label %18, label %11
18: ; preds = %11, %6
%19 = add nuw nsw i32 %7, 1
%20 = icmp eq i32 %19, %0
br i1 %20, label %21, label %6
21: ; preds = %18, %2
ret void
}