#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*/ EXIT_SUCCESS;
int /*<<< orphan*/ addnstr(char *, int /*<<< orphan*/);
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ getch();
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ strlen(char *);
int main(void) {
  char message[] = "Unix addicted\n";
  char msg_help[] = "(type something to exit)\n";
  initscr();
  addnstr(message, strlen(message));
  addnstr(msg_help, strlen(msg_help));
  refresh();
  getch();
  endwin();
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe7a(%rip),%rax
mov    %rax,-0x13(%rbp)
mov    0xe78(%rip),%eax
mov    %eax,-0xb(%rbp)
mov    0xe72(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xe6a(%rip),%al
mov    %al,-0x5(%rbp)
mov    0xe62(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe5f(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xe5c(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe59(%rip),%ax
mov    %ax,-0x18(%rbp)
mov    $0x0,%al
call   1040 <initscr@plt>
lea    -0x13(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    -0x13(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x40(%rbp),%rdi
mov    %eax,%esi
call   1080 <addnstr@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x38(%rbp),%rdi
mov    %eax,%esi
call   1080 <addnstr@plt>
mov    $0x0,%al
call   1050 <refresh@plt>
mov    $0x0,%al
call   1060 <getch@plt>
mov    $0x0,%al
call   1070 <endwin@plt>
mov    0x2db2(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
movabs $0xa646574636964,%rax
mov    %rax,0x7(%rsp)
movabs $0x6464612078696e55,%rax
61 64 64
mov    %rax,(%rsp)
movups 0xe81(%rip),%xmm0
movups %xmm0,0x1a(%rsp)
movaps 0xe6b(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1040 <initscr@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1080 <addnstr@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1080 <addnstr@plt>
xor    %eax,%eax
call   1050 <refresh@plt>
xor    %eax,%eax
call   1060 <getch@plt>
xor    %eax,%eax
call   1070 <endwin@plt>
mov    0x2de7(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@__const.main.message = [15 x i8] c"Unix addicted\0A\00"
@__const.main.msg_help = [26 x i8] c"(type something to exit)\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [15 x i8]
%3 = alloca [26 x i8]
store i32 0, i32* %1
%4 = bitcast [15 x i8]* %2 to i8*
%5 = bitcast [26 x i8]* %3 to i8*
%6 = call i32 (...) @initscr()
%7 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%9 = call i32 @strlen(i8* %8)
%10 = call i32 @addnstr(i8* %7, i32 %9)
%11 = getelementptr inbounds [26 x i8], [26 x i8]* %3, i64 0, i64 0
%12 = getelementptr inbounds [26 x i8], [26 x i8]* %3, i64 0, i64 0
%13 = call i32 @strlen(i8* %12)
%14 = call i32 @addnstr(i8* %11, i32 %13)
%15 = call i32 (...) @refresh()
%16 = call i32 (...) @getch()
%17 = call i32 (...) @endwin()
%18 = load i32, i32* @EXIT_SUCCESS
%19 = call i32 @exit(i32 %18)
unreachable
}

LLVM IR (-O2):
@__const.main.message = [15 x i8] c"Unix addicted\0A\00"
@__const.main.msg_help = [26 x i8] c"(type something to exit)\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [15 x i8]
%2 = alloca [26 x i8]
%3 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [26 x i8], [26 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (...) @initscr()
%6 = call i32 @strlen(i8* %3)
%7 = call i32 @addnstr(i8* %3, i32 %6)
%8 = call i32 @strlen(i8* %4)
%9 = call i32 @addnstr(i8* %4, i32 %8)
%10 = call i32 (...) @refresh()
%11 = call i32 (...) @getch()
%12 = call i32 (...) @endwin()
%13 = load i32, i32* @EXIT_SUCCESS
%14 = call i32 @exit(i32 %13)
unreachable
}