#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 */
typedef struct TYPE_10__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ chtype;
struct TYPE_10__ {
  int _maxy;
  int /*<<< orphan*/ _maxx;
};
typedef TYPE_1__ WINDOW;

/* Variables and functions */
int OK;
int /*<<< orphan*/ getyx(TYPE_1__ *, int, int);
int /*<<< orphan*/ mvwdelch(TYPE_1__ *, int, int);
int /*<<< orphan*/ mvwinch(TYPE_1__ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ mvwinsch(TYPE_1__ *, int, int /*<<< orphan*/,
                            int /*<<< orphan*/);
int /*<<< orphan*/ my_wmove(TYPE_1__ *, int);
int /*<<< orphan*/ wdelch(TYPE_1__ *);
int /*<<< orphan*/ wmove(TYPE_1__ *, int, int);
int my_wdelch(WINDOW *win) {
  chtype c, oc;
  int x, y, savex, savey;
  my_wmove(win, -1);
  getyx(win, savey, savex);
  x = savex;
  y = savey;
  oc = mvwinch(win, savey, win->_maxx);
  mvwdelch(win, savey, savex);
  mvwinsch(win, savey, win->_maxx, oc);
  wmove(win, savex, savey);
  while (y < win->_maxy) {
    oc = mvwinch(win, y + 1, win->_maxx);
    c = mvwinch(win, y + 1, 0);
    wdelch(win);
    mvwinsch(win, y + 1, win->_maxx, oc);
    mvwinsch(win, y + 0, win->_maxx, c);
    y++;
  }
  wmove(win, savey, savex);
  return OK;
}


x86 assembly (clang, -O0):
<my_wdelch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xffffffff,%esi
call   1030 <my_wmove@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1060 <getyx@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edx
call   1070 <mvwinch@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1040 <mvwdelch@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edx
mov    -0x10(%rbp),%ecx
call   1090 <mvwinsch@plt>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1080 <wmove@plt>
mov    -0x18(%rbp),%eax
mov    -0x8(%rbp),%rcx
cmp    (%rcx),%eax
jge    1274 <my_wdelch+0x104>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
add    $0x1,%esi
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edx
call   1070 <mvwinch@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
add    $0x1,%esi
xor    %edx,%edx
call   1070 <mvwinch@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <wdelch@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
add    $0x1,%esi
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edx
mov    -0x10(%rbp),%ecx
call   1090 <mvwinsch@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
add    $0x0,%esi
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edx
mov    -0xc(%rbp),%ecx
call   1090 <mvwinsch@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11ef <my_wdelch+0x7f>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1080 <wmove@plt>
mov    0x2d56(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_wdelch>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0xffffffff,%esi
call   1030 <my_wmove@plt>
mov    %rbx,%rdi
call   1050 <getyx@plt>
mov    0x4(%rbx),%edx
mov    %rbx,%rdi
call   1060 <mvwinch@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <mvwdelch@plt>
mov    0x4(%rbx),%edx
mov    %rbx,%rdi
mov    %ebp,%ecx
call   1080 <mvwinsch@plt>
mov    %rbx,%rdi
call   1070 <wmove@plt>
mov    %rbx,%rdi
call   1070 <wmove@plt>
mov    0x2e2f(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_10__ = type { i32, i32 }
@OK = global i32 0
define i32 @my_wdelch(%struct.TYPE_10__* %0) {
%2 = alloca %struct.TYPE_10__*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store %struct.TYPE_10__* %0, %struct.TYPE_10__** %2
%9 = load %struct.TYPE_10__*, %struct.TYPE_10__** %2
%10 = call i32 @my_wmove(%struct.TYPE_10__* %9, i32 -1)
%11 = load %struct.TYPE_10__*, %struct.TYPE_10__** %2
%12 = load i32, i32* %8
%13 = load i32, i32* %7
%14 = call i32 @getyx(%struct.TYPE_10__* %11, i32 %12, i32 %13)
%15 = load i32, i32* %7
store i32 %15, i32* %5
%16 = load i32, i32* %8
store i32 %16, i32* %6
%17 = load %struct.TYPE_10__*, %struct.TYPE_10__** %2
%18 = load i32, i32* %8
%19 = load %struct.TYPE_10__*, %struct.TYPE_10__** %2
%20 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %19, i32 0, i32 1
%21 = load i32, i32* %20
%22 = call i32 @mvwinch(%struct.TYPE_10__* %17, i32 %18, i32 %21)
store i32 %22, i32* %4
%23 = load %struct.TYPE_10__*, %struct.TYPE_10__** %2
%24 = load i32, i32* %8
%25 = load i32, i32* %7
%26 = call i32 @mvwdelch(%struct.TYPE_10__* %23, i32 %24, i32 %25)
%27 = load %struct.TYPE_10__*, %struct.TYPE_10__** %2
%28 = load i32, i32* %8
%29 = load %struct.TYPE_10__*, %struct.TYPE_10__** %2
%30 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %29, i32 0, i32 1
%31 = load i32, i32* %30
%32 = load i32, i32* %4
%33 = call i32 @mvwinsch(%struct.TYPE_10__* %27, i32 %28, i32 %31, i32 %32)
%34 = load %struct.TYPE_10__*, %struct.TYPE_10__** %2
%35 = load i32, i32* %7
%36 = load i32, i32* %8
%37 = call i32 @wmove(%struct.TYPE_10__* %34, i32 %35, i32 %36)
br label %38
38: ; preds = %44, %1
%39 = load i32, i32* %6
%40 = load %struct.TYPE_10__*, %struct.TYPE_10__** %2
%41 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %40, i32 0, i32 0
%42 = load i32, i32* %41
%43 = icmp slt i32 %39, %42
br i1 %43, label %44, label %76
44: ; preds = %38
%45 = load %struct.TYPE_10__*, %struct.TYPE_10__** %2
%46 = load i32, i32* %6
%47 = add nsw i32 %46, 1
%48 = load %struct.TYPE_10__*, %struct.TYPE_10__** %2
%49 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %48, i32 0, i32 1
%50 = load i32, i32* %49
%51 = call i32 @mvwinch(%struct.TYPE_10__* %45, i32 %47, i32 %50)
store i32 %51, i32* %4
%52 = load %struct.TYPE_10__*, %struct.TYPE_10__** %2
%53 = load i32, i32* %6
%54 = add nsw i32 %53, 1
%55 = call i32 @mvwinch(%struct.TYPE_10__* %52, i32 %54, i32 0)
store i32 %55, i32* %3
%56 = load %struct.TYPE_10__*, %struct.TYPE_10__** %2
%57 = call i32 @wdelch(%struct.TYPE_10__* %56)
%58 = load %struct.TYPE_10__*, %struct.TYPE_10__** %2
%59 = load i32, i32* %6
%60 = add nsw i32 %59, 1
%61 = load %struct.TYPE_10__*, %struct.TYPE_10__** %2
%62 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %61, i32 0, i32 1
%63 = load i32, i32* %62
%64 = load i32, i32* %4
%65 = call i32 @mvwinsch(%struct.TYPE_10__* %58, i32 %60, i32 %63, i32 %64)
%66 = load %struct.TYPE_10__*, %struct.TYPE_10__** %2
%67 = load i32, i32* %6
%68 = add nsw i32 %67, 0
%69 = load %struct.TYPE_10__*, %struct.TYPE_10__** %2
%70 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %69, i32 0, i32 1
%71 = load i32, i32* %70
%72 = load i32, i32* %3
%73 = call i32 @mvwinsch(%struct.TYPE_10__* %66, i32 %68, i32 %71, i32 %72)
%74 = load i32, i32* %6
%75 = add nsw i32 %74, 1
store i32 %75, i32* %6
br label %38
76: ; preds = %38
%77 = load %struct.TYPE_10__*, %struct.TYPE_10__** %2
%78 = load i32, i32* %8
%79 = load i32, i32* %7
%80 = call i32 @wmove(%struct.TYPE_10__* %77, i32 %78, i32 %79)
%81 = load i32, i32* @OK
ret i32 %81
}

LLVM IR (-O2):
%struct.TYPE_10__ = type { i32, i32 }
@OK = global i32 0
define i32 @my_wdelch(%struct.TYPE_10__* %0) {
%2 = tail call i32 @my_wmove(%struct.TYPE_10__* %0, i32 -1)
%3 = tail call i32 @getyx(%struct.TYPE_10__* %0, i32 undef, i32 undef)
%4 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %0, i64 0, i32 1
%5 = load i32, i32* %4
%6 = tail call i32 @mvwinch(%struct.TYPE_10__* %0, i32 undef, i32 %5)
%7 = tail call i32 @mvwdelch(%struct.TYPE_10__* %0, i32 undef, i32 undef)
%8 = load i32, i32* %4
%9 = tail call i32 @mvwinsch(%struct.TYPE_10__* %0, i32 undef, i32 %8, i32 %6)
%10 = tail call i32 @wmove(%struct.TYPE_10__* %0, i32 undef, i32 undef)
%11 = tail call i32 @wmove(%struct.TYPE_10__* %0, i32 undef, i32 undef)
%12 = load i32, i32* @OK
ret i32 %12
}