#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 /*<<< orphan*/ A_UNDERLINE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ addstr(char *);
int /*<<< orphan*/ attroff(int /*<<< orphan*/);
int /*<<< orphan*/ attron(int /*<<< orphan*/);
int /*<<< orphan*/ attrset(int /*<<< orphan*/);
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ getch();
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ refresh();
int main(void) {
  initscr();
  attron(A_UNDERLINE);
  addstr("Text formatting with style\n");
  attrset(A_BOLD);
  addstr("nCurses library is a good way to learn UNIX programming\n");
  attrset(0);
  addstr("I\'m working with a lot of nice functions\n");
  attroff(A_BOLD);
  refresh();
  getch();
  endwin();
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <initscr@plt>
mov    0x2e23(%rip),%rax
mov    (%rax),%edi
call   1050 <attron@plt>
lea    0xe45(%rip),%rdi
call   10b0 <addstr@plt>
mov    0x2e11(%rip),%rax
mov    (%rax),%edi
call   1090 <attrset@plt>
lea    0xe47(%rip),%rdi
call   10b0 <addstr@plt>
xor    %edi,%edi
call   1090 <attrset@plt>
lea    0xe6d(%rip),%rdi
call   10b0 <addstr@plt>
mov    0x2de4(%rip),%rax
mov    (%rax),%edi
call   1030 <attroff@plt>
mov    $0x0,%al
call   1060 <refresh@plt>
mov    $0x0,%al
call   1070 <getch@plt>
mov    $0x0,%al
call   1080 <endwin@plt>
mov    0x2dc9(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <initscr@plt>
mov    0x2e31(%rip),%rax
mov    (%rax),%edi
call   1050 <attron@plt>
lea    0xe53(%rip),%rdi
call   10b0 <addstr@plt>
mov    0x2e1f(%rip),%rbx
mov    (%rbx),%edi
call   1090 <attrset@plt>
lea    0xe55(%rip),%rdi
call   10b0 <addstr@plt>
xor    %edi,%edi
call   1090 <attrset@plt>
lea    0xe7b(%rip),%rdi
call   10b0 <addstr@plt>
mov    (%rbx),%edi
call   1030 <attroff@plt>
xor    %eax,%eax
call   1060 <refresh@plt>
xor    %eax,%eax
call   1070 <getch@plt>
xor    %eax,%eax
call   1080 <endwin@plt>
mov    0x2dde(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@A_UNDERLINE = global i32 0
@.str = [28 x i8] c"Text formatting with style\0A\00"
@A_BOLD = global i32 0
@.str.1 = [57 x i8] c"nCurses library is a good way to learn UNIX programming\0A\00"
@.str.2 = [42 x i8] c"I'm working with a lot of nice functions\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @initscr()
%3 = load i32, i32* @A_UNDERLINE
%4 = call i32 @attron(i32 %3)
%5 = call i32 @addstr(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @A_BOLD
%7 = call i32 @attrset(i32 %6)
%8 = call i32 @addstr(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @attrset(i32 0)
%10 = call i32 @addstr(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
%11 = load i32, i32* @A_BOLD
%12 = call i32 @attroff(i32 %11)
%13 = call i32 (...) @refresh()
%14 = call i32 (...) @getch()
%15 = call i32 (...) @endwin()
%16 = load i32, i32* @EXIT_SUCCESS
%17 = call i32 @exit(i32 %16)
unreachable
}

LLVM IR (-O2):
@A_UNDERLINE = global i32 0
@.str = [28 x i8] c"Text formatting with style\0A\00"
@A_BOLD = global i32 0
@.str.1 = [57 x i8] c"nCurses library is a good way to learn UNIX programming\0A\00"
@.str.2 = [42 x i8] c"I'm working with a lot of nice functions\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @initscr()
%2 = load i32, i32* @A_UNDERLINE
%3 = tail call i32 @attron(i32 %2)
%4 = tail call i32 @addstr(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @A_BOLD
%6 = tail call i32 @attrset(i32 %5)
%7 = tail call i32 @addstr(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @attrset(i32 0)
%9 = tail call i32 @addstr(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
%10 = load i32, i32* @A_BOLD
%11 = tail call i32 @attroff(i32 %10)
%12 = tail call i32 (...) @refresh()
%13 = tail call i32 (...) @getch()
%14 = tail call i32 (...) @endwin()
%15 = load i32, i32* @EXIT_SUCCESS
%16 = tail call i32 @exit(i32 %15)
unreachable
}