#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*/ A_BOLD;
int COLS;
int /*<<< orphan*/ attroff(int /*<<< orphan*/);
int /*<<< orphan*/ attron(int /*<<< orphan*/);
int /*<<< orphan*/ box(int /*<<< orphan*/, char, char);
int /*<<< orphan*/ mvaddstr(int, int, char *);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ stdscr;
int strlen(char *);
void drawlogin() {
  char *heads = "login demo system";
  char *user = "user[         ]";
  char *pass = "pass[         ]";
  char *copyright = "design by zzw";
  box(stdscr, '|', '-');
  attron(A_BOLD);
  mvaddstr(3, (COLS - strlen(heads)) / 2, heads);
  attroff(A_BOLD);
  mvaddstr(6, (COLS - strlen(user)) / 2, user);
  mvaddstr(8, (COLS - strlen(pass)) / 2, pass);
  mvaddstr(12, (COLS - strlen(copyright)) / 2 + 14, copyright);
  refresh();
}


x86 assembly (clang, -O0):
<drawlogin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xe91(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xe98(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xe9d(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xea2(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
mov    $0x7c,%esi
mov    $0x2d,%edx
call   1060 <box@plt>
mov    0x2e1d(%rip),%rax
mov    (%rax),%edi
call   1050 <attron@plt>
mov    0x2e1f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
sub    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x8(%rbp),%rdx
mov    $0x3,%edi
call   1080 <mvaddstr@plt>
mov    0x2ddb(%rip),%rax
mov    (%rax),%edi
call   1030 <attroff@plt>
mov    0x2ddd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
sub    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x10(%rbp),%rdx
mov    $0x6,%edi
call   1080 <mvaddstr@plt>
mov    0x2da9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
sub    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x18(%rbp),%rdx
mov    $0x8,%edi
call   1080 <mvaddstr@plt>
mov    0x2d75(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
sub    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
add    $0xe,%esi
mov    -0x20(%rbp),%rdx
mov    $0xc,%edi
call   1080 <mvaddstr@plt>
mov    $0x0,%al
call   1070 <refresh@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawlogin>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
mov    $0x7c,%esi
mov    $0x2d,%edx
call   1060 <box@plt>
mov    0x2e4a(%rip),%r15
mov    (%r15),%edi
call   1050 <attron@plt>
mov    0x2e4b(%rip),%r14
mov    (%r14),%ebp
lea    0xe61(%rip),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
sub    %eax,%ebp
mov    %ebp,%esi
shr    $0x1f,%esi
add    %ebp,%esi
sar    %esi
mov    $0x3,%edi
mov    %rbx,%rdx
call   1080 <mvaddstr@plt>
mov    (%r15),%edi
call   1030 <attroff@plt>
mov    (%r14),%ebp
lea    0xe41(%rip),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
sub    %eax,%ebp
mov    %ebp,%esi
shr    $0x1f,%esi
add    %ebp,%esi
sar    %esi
mov    $0x6,%edi
mov    %rbx,%rdx
call   1080 <mvaddstr@plt>
mov    (%r14),%ebp
lea    0xe27(%rip),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
sub    %eax,%ebp
mov    %ebp,%esi
shr    $0x1f,%esi
add    %ebp,%esi
sar    %esi
mov    $0x8,%edi
mov    %rbx,%rdx
call   1080 <mvaddstr@plt>
mov    (%r14),%ebp
lea    0xe0d(%rip),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
sub    %eax,%ebp
mov    %ebp,%esi
shr    $0x1f,%esi
add    %ebp,%esi
sar    %esi
add    $0xe,%esi
mov    $0xc,%edi
mov    %rbx,%rdx
call   1080 <mvaddstr@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <refresh@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"login demo system\00"
@.str.1 = [16 x i8] c"user[ ]\00"
@.str.2 = [16 x i8] c"pass[ ]\00"
@.str.3 = [14 x i8] c"design by zzw\00"
@stdscr = global i32 0
@A_BOLD = global i32 0
@COLS = global i32 0
define void @drawlogin() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8** %3
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8** %4
%5 = load i32, i32* @stdscr
%6 = call i32 @box(i32 %5, i8 signext 124, i8 signext 45)
%7 = load i32, i32* @A_BOLD
%8 = call i32 @attron(i32 %7)
%9 = load i32, i32* @COLS
%10 = load i8*, i8** %1
%11 = call i32 @strlen(i8* %10)
%12 = sub nsw i32 %9, %11
%13 = sdiv i32 %12, 2
%14 = load i8*, i8** %1
%15 = call i32 @mvaddstr(i32 3, i32 %13, i8* %14)
%16 = load i32, i32* @A_BOLD
%17 = call i32 @attroff(i32 %16)
%18 = load i32, i32* @COLS
%19 = load i8*, i8** %2
%20 = call i32 @strlen(i8* %19)
%21 = sub nsw i32 %18, %20
%22 = sdiv i32 %21, 2
%23 = load i8*, i8** %2
%24 = call i32 @mvaddstr(i32 6, i32 %22, i8* %23)
%25 = load i32, i32* @COLS
%26 = load i8*, i8** %3
%27 = call i32 @strlen(i8* %26)
%28 = sub nsw i32 %25, %27
%29 = sdiv i32 %28, 2
%30 = load i8*, i8** %3
%31 = call i32 @mvaddstr(i32 8, i32 %29, i8* %30)
%32 = load i32, i32* @COLS
%33 = load i8*, i8** %4
%34 = call i32 @strlen(i8* %33)
%35 = sub nsw i32 %32, %34
%36 = sdiv i32 %35, 2
%37 = add nsw i32 %36, 14
%38 = load i8*, i8** %4
%39 = call i32 @mvaddstr(i32 12, i32 %37, i8* %38)
%40 = call i32 (...) @refresh()
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"login demo system\00"
@.str.1 = [16 x i8] c"user[ ]\00"
@.str.2 = [16 x i8] c"pass[ ]\00"
@.str.3 = [14 x i8] c"design by zzw\00"
@stdscr = global i32 0
@A_BOLD = global i32 0
@COLS = global i32 0
define void @drawlogin() {
%1 = load i32, i32* @stdscr
%2 = tail call i32 @box(i32 %1, i8 signext 124, i8 signext 45)
%3 = load i32, i32* @A_BOLD
%4 = tail call i32 @attron(i32 %3)
%5 = load i32, i32* @COLS
%6 = tail call i32 @strlen(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%7 = sub nsw i32 %5, %6
%8 = sdiv i32 %7, 2
%9 = tail call i32 @mvaddstr(i32 3, i32 %8, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @A_BOLD
%11 = tail call i32 @attroff(i32 %10)
%12 = load i32, i32* @COLS
%13 = tail call i32 @strlen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%14 = sub nsw i32 %12, %13
%15 = sdiv i32 %14, 2
%16 = tail call i32 @mvaddstr(i32 6, i32 %15, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%17 = load i32, i32* @COLS
%18 = tail call i32 @strlen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%19 = sub nsw i32 %17, %18
%20 = sdiv i32 %19, 2
%21 = tail call i32 @mvaddstr(i32 8, i32 %20, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%22 = load i32, i32* @COLS
%23 = tail call i32 @strlen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%24 = sub nsw i32 %22, %23
%25 = sdiv i32 %24, 2
%26 = add nsw i32 %25, 14
%27 = tail call i32 @mvaddstr(i32 12, i32 %26, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%28 = tail call i32 (...) @refresh()
ret void
}