#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*/ getmaxyx(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ mvwprintw(int /*<<< orphan*/ *, int /*<<< orphan*/,
                             int /*<<< orphan*/, char *, int /*<<< orphan*/);
int /*<<< orphan*/ padstr(char *, int);
int /*<<< orphan*/ werase(int /*<<< orphan*/ *);
int /*<<< orphan*/ wmove(int /*<<< orphan*/ *, int /*<<< orphan*/, int);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
void repainteditbox(WINDOW *win, int x, char *buf) {
  int maxy;
  int maxx;
  getmaxyx(win, maxy, maxx);
  werase(win);
  mvwprintw(win, 0, 0, "%s", padstr(buf, maxx));
  wmove(win, 0, x);
  wrefresh(win);
}


x86 assembly (clang, -O0):
<repainteditbox>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1040 <getmaxyx@plt>
mov    -0x8(%rbp),%rdi
call   1080 <werase@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%esi
call   1050 <padstr@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%r8d
xor    %edx,%edx
lea    0xe51(%rip),%rcx
mov    %edx,%esi
call   1060 <mvwprintw@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
xor    %esi,%esi
call   1070 <wmove@plt>
mov    -0x8(%rbp),%rdi
call   1030 <wrefresh@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<repainteditbox>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %esi,%r14d
mov    %rdi,%rbp
call   1040 <getmaxyx@plt>
mov    %rbp,%rdi
call   1080 <werase@plt>
mov    %rbx,%rdi
call   1050 <padstr@plt>
lea    0xe77(%rip),%rcx
mov    %rbp,%rdi
xor    %esi,%esi
xor    %edx,%edx
mov    %eax,%r8d
call   1060 <mvwprintw@plt>
mov    %rbp,%rdi
xor    %esi,%esi
mov    %r14d,%edx
call   1070 <wmove@plt>
mov    %rbp,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <wrefresh@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @repainteditbox(i32* %0, i32 %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%9 = load i32*, i32** %4
%10 = load i32, i32* %7
%11 = load i32, i32* %8
%12 = call i32 @getmaxyx(i32* %9, i32 %10, i32 %11)
%13 = load i32*, i32** %4
%14 = call i32 @werase(i32* %13)
%15 = load i32*, i32** %4
%16 = load i8*, i8** %6
%17 = load i32, i32* %8
%18 = call i32 @padstr(i8* %16, i32 %17)
%19 = call i32 @mvwprintw(i32* %15, i32 0, i32 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = load i32*, i32** %4
%21 = load i32, i32* %5
%22 = call i32 @wmove(i32* %20, i32 0, i32 %21)
%23 = load i32*, i32** %4
%24 = call i32 @wrefresh(i32* %23)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @repainteditbox(i32* %0, i32 %1, i8* %2) {
%4 = tail call i32 @getmaxyx(i32* %0, i32 undef, i32 undef)
%5 = tail call i32 @werase(i32* %0)
%6 = tail call i32 @padstr(i8* %2, i32 undef)
%7 = tail call i32 @mvwprintw(i32* %0, i32 0, i32 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = tail call i32 @wmove(i32* %0, i32 0, i32 %1)
%9 = tail call i32 @wrefresh(i32* %0)
ret void
}