#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*/ Error(char *, char *);
int /*<<< orphan*/ Print(char *, char *);
char *getenv(char *);
int /*<<< orphan*/ printf(char *, ...);
int tgetent(char *, char *);
int tgetflag(char *);
int tgetnum(char *);
int main(int argc, char *argv[]) {
  char *term;
  static char buffer[1024];
  if (argc > 2)
    Error("Usage: %s [type]\n", argv[0]);
  if (argc == 2)
    term = argv[1];
  else
    term = getenv("TERM");
  if (term == NULL)
    Error("termcap: $TERM is not defined\n", "");
  if (tgetent(buffer, term) != 1)
    Error("termcap: No termcap entry for %s\n", term);
  printf("TERM = %s\n\n", term);
  if (tgetflag("am") == 1)
    printf("End of line wraps to next line   (am)\n");
  if (tgetflag("bs") == 1)
    printf("Ctrl/H performs a backspace      (bs)\n");
  printf("Number of columns                (co) = %d\n", tgetnum("co"));
  printf("Number of lines                  (li) = %d\n", tgetnum("li"));
  Print("Clear to end of line", "ce");
  Print("Clear to end of screen", "cd");
  Print("Clear the whole screen", "cl");
  Print("Start \"stand out\" mode", "so");
  Print("End \"stand out\" mode", "se");
  Print("Start underscore mode", "us");
  Print("End underscore mode", "ue");
  Print("Start blinking mode", "mb");
  Print("Start bold mode", "md");
  Print("Start reverse mode", "mr");
  Print("Return to normal mode", "me");
  Print("Scroll backwards", "sr");
  Print("Cursor motion", "cm");
  Print("Up one line", "up");
  Print("Down one line", "do");
  Print("Left one space", "le");
  Print("Right one space", "nd");
  Print("Move to top left corner", "ho");
  Print("Generated by \"UP\"", "ku");
  Print("Generated by \"DOWN\"", "kd");
  Print("Generated by \"LEFT\"", "kl");
  Print("Generated by \"RIGHT\"", "kr");
  Print("Generated by \"HOME\"", "kh");
  Print("Generated by \"END\"", "k0");
  Print("Generated by \"PGUP\"", "k1");
  Print("Generated by \"PGDN\"", "k2");
  Print("Generated by numeric \"+\"", "k3");
  Print("Generated by numeric \"-\"", "k4");
  Print("Generated by numeric \"5\"", "k5");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    11a3 <main+0x33>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe62(%rip),%rdi
call   1040 <Error@plt>
cmpl   $0x2,-0x8(%rbp)
jne    11be <main+0x4e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    11ce <main+0x5e>
lea    0xe4d(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11ec <main+0x7c>
lea    0xe37(%rip),%rdi
lea    0xe7c(%rip),%rsi
call   1040 <Error@plt>
mov    -0x18(%rbp),%rsi
lea    0x2e79(%rip),%rdi
call   1070 <tgetent@plt>
cmp    $0x1,%eax
je     1215 <main+0xa5>
mov    -0x18(%rbp),%rsi
lea    0xe26(%rip),%rdi
call   1040 <Error@plt>
mov    -0x18(%rbp),%rsi
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe36(%rip),%rdi
call   1060 <tgetflag@plt>
cmp    $0x1,%eax
jne    124a <main+0xda>
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe3d(%rip),%rdi
call   1060 <tgetflag@plt>
cmp    $0x1,%eax
jne    126d <main+0xfd>
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe70(%rip),%rdi
call   1080 <tgetnum@plt>
mov    %eax,%esi
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe83(%rip),%rdi
call   1080 <tgetnum@plt>
mov    %eax,%esi
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe6a(%rip),%rdi
lea    0xfb8(%rip),%rsi
call   1090 <Print@plt>
lea    0xe6c(%rip),%rdi
lea    0xe7c(%rip),%rsi
call   1090 <Print@plt>
lea    0xe73(%rip),%rdi
lea    0xe83(%rip),%rsi
call   1090 <Print@plt>
lea    0xe7a(%rip),%rdi
lea    0xe8a(%rip),%rsi
call   1090 <Print@plt>
lea    0xe81(%rip),%rdi
lea    0xe8f(%rip),%rsi
call   1090 <Print@plt>
lea    0xe86(%rip),%rdi
lea    0xe95(%rip),%rsi
call   1090 <Print@plt>
lea    0xe8c(%rip),%rdi
lea    0xe99(%rip),%rsi
call   1090 <Print@plt>
lea    0xe90(%rip),%rdi
lea    0xe9d(%rip),%rsi
call   1090 <Print@plt>
lea    0xe94(%rip),%rdi
lea    0xe9d(%rip),%rsi
call   1090 <Print@plt>
lea    0xe94(%rip),%rdi
lea    0xea0(%rip),%rsi
call   1090 <Print@plt>
lea    0xe97(%rip),%rdi
lea    0xea6(%rip),%rsi
call   1090 <Print@plt>
lea    0xe9d(%rip),%rdi
lea    0xea7(%rip),%rsi
call   1090 <Print@plt>
lea    0xe9e(%rip),%rdi
lea    0xea5(%rip),%rsi
call   1090 <Print@plt>
lea    0xe9c(%rip),%rdi
lea    0xea1(%rip),%rsi
call   1090 <Print@plt>
lea    0xe98(%rip),%rdi
lea    0xe9f(%rip),%rsi
call   1090 <Print@plt>
lea    0xe96(%rip),%rdi
lea    0xe9e(%rip),%rsi
call   1090 <Print@plt>
lea    0xe95(%rip),%rdi
lea    0xe9e(%rip),%rsi
call   1090 <Print@plt>
lea    0xe95(%rip),%rdi
lea    0xea6(%rip),%rsi
call   1090 <Print@plt>
lea    0xe9d(%rip),%rdi
lea    0xea8(%rip),%rsi
call   1090 <Print@plt>
lea    0xe9f(%rip),%rdi
lea    0xeac(%rip),%rsi
call   1090 <Print@plt>
lea    0xea3(%rip),%rdi
lea    0xeb0(%rip),%rsi
call   1090 <Print@plt>
lea    0xea7(%rip),%rdi
lea    0xeb5(%rip),%rsi
call   1090 <Print@plt>
lea    0xeac(%rip),%rdi
lea    0xeb9(%rip),%rsi
call   1090 <Print@plt>
lea    0xeb0(%rip),%rdi
lea    0xebc(%rip),%rsi
call   1090 <Print@plt>
lea    0xeb3(%rip),%rdi
lea    0xec0(%rip),%rsi
call   1090 <Print@plt>
lea    0xeb7(%rip),%rdi
lea    0xec4(%rip),%rsi
call   1090 <Print@plt>
lea    0xebb(%rip),%rdi
lea    0xecd(%rip),%rsi
call   1090 <Print@plt>
lea    0xec4(%rip),%rdi
lea    0xed6(%rip),%rsi
call   1090 <Print@plt>
lea    0xecd(%rip),%rdi
lea    0xedf(%rip),%rsi
call   1090 <Print@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x3,%edi
jl     1197 <main+0x17>
mov    (%rsi),%rsi
lea    0xe70(%rip),%rdi
call   1050 <Error@plt>
jmp    11a7 <main+0x27>
cmp    $0x2,%edi
jne    11a7 <main+0x27>
mov    0x8(%rsi),%rbx
test   %rbx,%rbx
jne    11ce <main+0x4e>
jmp    11bb <main+0x3b>
lea    0xe64(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbx
test   %rbx,%rbx
jne    11ce <main+0x4e>
lea    0xe55(%rip),%rdi
lea    0xe9a(%rip),%rsi
call   1050 <Error@plt>
lea    0x2e9b(%rip),%rdi
mov    %rbx,%rsi
call   1080 <tgetent@plt>
cmp    $0x1,%eax
je     11f1 <main+0x71>
lea    0xe4d(%rip),%rdi
mov    %rbx,%rsi
call   1050 <Error@plt>
lea    0xe60(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe5b(%rip),%rdi
call   1070 <tgetflag@plt>
cmp    $0x1,%eax
jne    121f <main+0x9f>
lea    0x1167(%rip),%rdi
call   1040 <puts@plt>
lea    0xe41(%rip),%rdi
call   1070 <tgetflag@plt>
cmp    $0x1,%eax
jne    123c <main+0xbc>
lea    0x1124(%rip),%rdi
call   1040 <puts@plt>
lea    0xe53(%rip),%rdi
call   1090 <tgetnum@plt>
lea    0xe1b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe66(%rip),%rdi
call   1090 <tgetnum@plt>
lea    0xe2e(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe4d(%rip),%rdi
lea    0xf9b(%rip),%rsi
call   10a0 <Print@plt>
lea    0xe4f(%rip),%rdi
lea    0xe5f(%rip),%rsi
call   10a0 <Print@plt>
lea    0xe56(%rip),%rdi
lea    0xe66(%rip),%rsi
call   10a0 <Print@plt>
lea    0xe5d(%rip),%rdi
lea    0xe6d(%rip),%rsi
call   10a0 <Print@plt>
lea    0xe64(%rip),%rdi
lea    0xe72(%rip),%rsi
call   10a0 <Print@plt>
lea    0xe69(%rip),%rdi
lea    0xe78(%rip),%rsi
call   10a0 <Print@plt>
lea    0xe6f(%rip),%rdi
lea    0xe7c(%rip),%rsi
call   10a0 <Print@plt>
lea    0xe73(%rip),%rdi
lea    0xe80(%rip),%rsi
call   10a0 <Print@plt>
lea    0xe77(%rip),%rdi
lea    0xe80(%rip),%rsi
call   10a0 <Print@plt>
lea    0xe77(%rip),%rdi
lea    0xe83(%rip),%rsi
call   10a0 <Print@plt>
lea    0xe7a(%rip),%rdi
lea    0xe89(%rip),%rsi
call   10a0 <Print@plt>
lea    0xe80(%rip),%rdi
lea    0xe8a(%rip),%rsi
call   10a0 <Print@plt>
lea    0xe81(%rip),%rdi
lea    0xe88(%rip),%rsi
call   10a0 <Print@plt>
lea    0xe7f(%rip),%rdi
lea    0xe84(%rip),%rsi
call   10a0 <Print@plt>
lea    0xe7b(%rip),%rdi
lea    0xe82(%rip),%rsi
call   10a0 <Print@plt>
lea    0xe79(%rip),%rdi
lea    0xe81(%rip),%rsi
call   10a0 <Print@plt>
lea    0xe78(%rip),%rdi
lea    0xe81(%rip),%rsi
call   10a0 <Print@plt>
lea    0xe78(%rip),%rdi
lea    0xe89(%rip),%rsi
call   10a0 <Print@plt>
lea    0xe80(%rip),%rdi
lea    0xe8b(%rip),%rsi
call   10a0 <Print@plt>
lea    0xe82(%rip),%rdi
lea    0xe8f(%rip),%rsi
call   10a0 <Print@plt>
lea    0xe86(%rip),%rdi
lea    0xe93(%rip),%rsi
call   10a0 <Print@plt>
lea    0xe8a(%rip),%rdi
lea    0xe98(%rip),%rsi
call   10a0 <Print@plt>
lea    0xe8f(%rip),%rdi
lea    0xe9c(%rip),%rsi
call   10a0 <Print@plt>
lea    0xe93(%rip),%rdi
lea    0xe9f(%rip),%rsi
call   10a0 <Print@plt>
lea    0xe96(%rip),%rdi
lea    0xea3(%rip),%rsi
call   10a0 <Print@plt>
lea    0xe9a(%rip),%rdi
lea    0xea7(%rip),%rsi
call   10a0 <Print@plt>
lea    0xe9e(%rip),%rdi
lea    0xeb0(%rip),%rsi
call   10a0 <Print@plt>
lea    0xea7(%rip),%rdi
lea    0xeb9(%rip),%rsi
call   10a0 <Print@plt>
lea    0xeb0(%rip),%rdi
lea    0xec2(%rip),%rsi
call   10a0 <Print@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@main.buffer = internal global [1024 x i8] zeroinitializer
@.str = [18 x i8] c"Usage: %s [type]\0A\00"
@.str.1 = [5 x i8] c"TERM\00"
@.str.2 = [31 x i8] c"termcap: $TERM is not defined\0A\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [34 x i8] c"termcap: No termcap entry for %s\0A\00"
@.str.5 = [12 x i8] c"TERM = %s\0A\0A\00"
@.str.6 = [3 x i8] c"am\00"
@.str.7 = [39 x i8] c"End of line wraps to next line (am)\0A\00"
@.str.8 = [3 x i8] c"bs\00"
@.str.9 = [39 x i8] c"Ctrl/H performs a backspace (bs)\0A\00"
@.str.10 = [44 x i8] c"Number of columns (co) = %d\0A\00"
@.str.11 = [3 x i8] c"co\00"
@.str.12 = [44 x i8] c"Number of lines (li) = %d\0A\00"
@.str.13 = [3 x i8] c"li\00"
@.str.14 = [21 x i8] c"Clear to end of line\00"
@.str.15 = [3 x i8] c"ce\00"
@.str.16 = [23 x i8] c"Clear to end of screen\00"
@.str.17 = [3 x i8] c"cd\00"
@.str.18 = [23 x i8] c"Clear the whole screen\00"
@.str.19 = [3 x i8] c"cl\00"
@.str.20 = [23 x i8] c"Start \22stand out\22 mode\00"
@.str.21 = [3 x i8] c"so\00"
@.str.22 = [21 x i8] c"End \22stand out\22 mode\00"
@.str.23 = [3 x i8] c"se\00"
@.str.24 = [22 x i8] c"Start underscore mode\00"
@.str.25 = [3 x i8] c"us\00"
@.str.26 = [20 x i8] c"End underscore mode\00"
@.str.27 = [3 x i8] c"ue\00"
@.str.28 = [20 x i8] c"Start blinking mode\00"
@.str.29 = [3 x i8] c"mb\00"
@.str.30 = [16 x i8] c"Start bold mode\00"
@.str.31 = [3 x i8] c"md\00"
@.str.32 = [19 x i8] c"Start reverse mode\00"
@.str.33 = [3 x i8] c"mr\00"
@.str.34 = [22 x i8] c"Return to normal mode\00"
@.str.35 = [3 x i8] c"me\00"
@.str.36 = [17 x i8] c"Scroll backwards\00"
@.str.37 = [3 x i8] c"sr\00"
@.str.38 = [14 x i8] c"Cursor motion\00"
@.str.39 = [3 x i8] c"cm\00"
@.str.40 = [12 x i8] c"Up one line\00"
@.str.41 = [3 x i8] c"up\00"
@.str.42 = [14 x i8] c"Down one line\00"
@.str.43 = [3 x i8] c"do\00"
@.str.44 = [15 x i8] c"Left one space\00"
@.str.45 = [3 x i8] c"le\00"
@.str.46 = [16 x i8] c"Right one space\00"
@.str.47 = [3 x i8] c"nd\00"
@.str.48 = [24 x i8] c"Move to top left corner\00"
@.str.49 = [3 x i8] c"ho\00"
@.str.50 = [18 x i8] c"Generated by \22UP\22\00"
@.str.51 = [3 x i8] c"ku\00"
@.str.52 = [20 x i8] c"Generated by \22DOWN\22\00"
@.str.53 = [3 x i8] c"kd\00"
@.str.54 = [20 x i8] c"Generated by \22LEFT\22\00"
@.str.55 = [3 x i8] c"kl\00"
@.str.56 = [21 x i8] c"Generated by \22RIGHT\22\00"
@.str.57 = [3 x i8] c"kr\00"
@.str.58 = [20 x i8] c"Generated by \22HOME\22\00"
@.str.59 = [3 x i8] c"kh\00"
@.str.60 = [19 x i8] c"Generated by \22END\22\00"
@.str.61 = [3 x i8] c"k0\00"
@.str.62 = [20 x i8] c"Generated by \22PGUP\22\00"
@.str.63 = [3 x i8] c"k1\00"
@.str.64 = [20 x i8] c"Generated by \22PGDN\22\00"
@.str.65 = [3 x i8] c"k2\00"
@.str.66 = [25 x i8] c"Generated by numeric \22+\22\00"
@.str.67 = [3 x i8] c"k3\00"
@.str.68 = [25 x i8] c"Generated by numeric \22-\22\00"
@.str.69 = [3 x i8] c"k4\00"
@.str.70 = [25 x i8] c"Generated by numeric \225\22\00"
@.str.71 = [3 x i8] c"k5\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 2
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 @Error(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %14
14: ; preds = %9, %2
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, 2
br i1 %16, label %17, label %21
17: ; preds = %14
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
store i8* %20, i8** %6
br label %23
21: ; preds = %14
%22 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
store i8* %22, i8** %6
br label %23
23: ; preds = %21, %17
%24 = load i8*, i8** %6
%25 = icmp eq i8* %24, null
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 @Error(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
br label %28
28: ; preds = %26, %23
%29 = load i8*, i8** %6
%30 = call i32 @tgetent(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @main.buffer, i64 0, i64 0), i8* %29)
%31 = icmp ne i32 %30, 1
br i1 %31, label %32, label %35
32: ; preds = %28
%33 = load i8*, i8** %6
%34 = call i32 @Error(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i8* %33)
br label %35
35: ; preds = %32, %28
%36 = load i8*, i8** %6
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %36)
%38 = call i32 @tgetflag(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%39 = icmp eq i32 %38, 1
br i1 %39, label %40, label %42
40: ; preds = %35
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0))
br label %42
42: ; preds = %40, %35
%43 = call i32 @tgetflag(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%44 = icmp eq i32 %43, 1
br i1 %44, label %45, label %47
45: ; preds = %42
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.9, i64 0, i64 0))
br label %47
47: ; preds = %45, %42
%48 = call i32 @tgetnum(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.10, i64 0, i64 0), i32 %48)
%50 = call i32 @tgetnum(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.12, i64 0, i64 0), i32 %50)
%52 = call i32 @Print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i64 0, i64 0))
%53 = call i32 @Print(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i64 0, i64 0))
%54 = call i32 @Print(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.19, i64 0, i64 0))
%55 = call i32 @Print(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.20, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.21, i64 0, i64 0))
%56 = call i32 @Print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.22, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.23, i64 0, i64 0))
%57 = call i32 @Print(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.24, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.25, i64 0, i64 0))
%58 = call i32 @Print(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.26, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.27, i64 0, i64 0))
%59 = call i32 @Print(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.28, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.29, i64 0, i64 0))
%60 = call i32 @Print(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.30, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.31, i64 0, i64 0))
%61 = call i32 @Print(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.32, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.33, i64 0, i64 0))
%62 = call i32 @Print(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.34, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.35, i64 0, i64 0))
%63 = call i32 @Print(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.36, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.37, i64 0, i64 0))
%64 = call i32 @Print(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.38, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.39, i64 0, i64 0))
%65 = call i32 @Print(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.40, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.41, i64 0, i64 0))
%66 = call i32 @Print(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.42, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.43, i64 0, i64 0))
%67 = call i32 @Print(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.44, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.45, i64 0, i64 0))
%68 = call i32 @Print(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.46, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.47, i64 0, i64 0))
%69 = call i32 @Print(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.48, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.49, i64 0, i64 0))
%70 = call i32 @Print(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.50, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.51, i64 0, i64 0))
%71 = call i32 @Print(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.52, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.53, i64 0, i64 0))
%72 = call i32 @Print(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.54, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.55, i64 0, i64 0))
%73 = call i32 @Print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.56, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.57, i64 0, i64 0))
%74 = call i32 @Print(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.58, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.59, i64 0, i64 0))
%75 = call i32 @Print(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.60, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.61, i64 0, i64 0))
%76 = call i32 @Print(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.62, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.63, i64 0, i64 0))
%77 = call i32 @Print(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.64, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.65, i64 0, i64 0))
%78 = call i32 @Print(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.66, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.67, i64 0, i64 0))
%79 = call i32 @Print(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.68, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.69, i64 0, i64 0))
%80 = call i32 @Print(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.70, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.71, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@main.buffer = internal global [1024 x i8] zeroinitializer
@.str = [18 x i8] c"Usage: %s [type]\0A\00"
@.str.1 = [5 x i8] c"TERM\00"
@.str.2 = [31 x i8] c"termcap: $TERM is not defined\0A\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [34 x i8] c"termcap: No termcap entry for %s\0A\00"
@.str.5 = [12 x i8] c"TERM = %s\0A\0A\00"
@.str.6 = [3 x i8] c"am\00"
@.str.8 = [3 x i8] c"bs\00"
@.str.10 = [44 x i8] c"Number of columns (co) = %d\0A\00"
@.str.11 = [3 x i8] c"co\00"
@.str.12 = [44 x i8] c"Number of lines (li) = %d\0A\00"
@.str.13 = [3 x i8] c"li\00"
@.str.14 = [21 x i8] c"Clear to end of line\00"
@.str.15 = [3 x i8] c"ce\00"
@.str.16 = [23 x i8] c"Clear to end of screen\00"
@.str.17 = [3 x i8] c"cd\00"
@.str.18 = [23 x i8] c"Clear the whole screen\00"
@.str.19 = [3 x i8] c"cl\00"
@.str.20 = [23 x i8] c"Start \22stand out\22 mode\00"
@.str.21 = [3 x i8] c"so\00"
@.str.22 = [21 x i8] c"End \22stand out\22 mode\00"
@.str.23 = [3 x i8] c"se\00"
@.str.24 = [22 x i8] c"Start underscore mode\00"
@.str.25 = [3 x i8] c"us\00"
@.str.26 = [20 x i8] c"End underscore mode\00"
@.str.27 = [3 x i8] c"ue\00"
@.str.28 = [20 x i8] c"Start blinking mode\00"
@.str.29 = [3 x i8] c"mb\00"
@.str.30 = [16 x i8] c"Start bold mode\00"
@.str.31 = [3 x i8] c"md\00"
@.str.32 = [19 x i8] c"Start reverse mode\00"
@.str.33 = [3 x i8] c"mr\00"
@.str.34 = [22 x i8] c"Return to normal mode\00"
@.str.35 = [3 x i8] c"me\00"
@.str.36 = [17 x i8] c"Scroll backwards\00"
@.str.37 = [3 x i8] c"sr\00"
@.str.38 = [14 x i8] c"Cursor motion\00"
@.str.39 = [3 x i8] c"cm\00"
@.str.40 = [12 x i8] c"Up one line\00"
@.str.41 = [3 x i8] c"up\00"
@.str.42 = [14 x i8] c"Down one line\00"
@.str.43 = [3 x i8] c"do\00"
@.str.44 = [15 x i8] c"Left one space\00"
@.str.45 = [3 x i8] c"le\00"
@.str.46 = [16 x i8] c"Right one space\00"
@.str.47 = [3 x i8] c"nd\00"
@.str.48 = [24 x i8] c"Move to top left corner\00"
@.str.49 = [3 x i8] c"ho\00"
@.str.50 = [18 x i8] c"Generated by \22UP\22\00"
@.str.51 = [3 x i8] c"ku\00"
@.str.52 = [20 x i8] c"Generated by \22DOWN\22\00"
@.str.53 = [3 x i8] c"kd\00"
@.str.54 = [20 x i8] c"Generated by \22LEFT\22\00"
@.str.55 = [3 x i8] c"kl\00"
@.str.56 = [21 x i8] c"Generated by \22RIGHT\22\00"
@.str.57 = [3 x i8] c"kr\00"
@.str.58 = [20 x i8] c"Generated by \22HOME\22\00"
@.str.59 = [3 x i8] c"kh\00"
@.str.60 = [19 x i8] c"Generated by \22END\22\00"
@.str.61 = [3 x i8] c"k0\00"
@.str.62 = [20 x i8] c"Generated by \22PGUP\22\00"
@.str.63 = [3 x i8] c"k1\00"
@.str.64 = [20 x i8] c"Generated by \22PGDN\22\00"
@.str.65 = [3 x i8] c"k2\00"
@.str.66 = [25 x i8] c"Generated by numeric \22+\22\00"
@.str.67 = [3 x i8] c"k3\00"
@.str.68 = [25 x i8] c"Generated by numeric \22-\22\00"
@.str.69 = [3 x i8] c"k4\00"
@.str.70 = [25 x i8] c"Generated by numeric \225\22\00"
@.str.71 = [3 x i8] c"k5\00"
@str = [38 x i8] c"Ctrl/H performs a backspace (bs)\00"
@str.72 = [38 x i8] c"End of line wraps to next line (am)\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @Error(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %12
7: ; preds = %2
%8 = icmp eq i32 %0, 2
br i1 %8, label %9, label %12
9: ; preds = %7
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
br label %14
12: ; preds = %4, %7
%13 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12, %9
%15 = phi i8* [ %11, %9 ], [ %13, %12 ]
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = tail call i32 @Error(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
br label %19
19: ; preds = %17, %14
%20 = tail call i32 @tgetent(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @main.buffer, i64 0, i64 0), i8* %15)
%21 = icmp eq i32 %20, 1
br i1 %21, label %24, label %22
22: ; preds = %19
%23 = tail call i32 @Error(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i8* %15)
br label %24
24: ; preds = %22, %19
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %15)
%26 = tail call i32 @tgetflag(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%27 = icmp eq i32 %26, 1
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.72, i64 0, i64 0))
br label %30
30: ; preds = %28, %24
%31 = tail call i32 @tgetflag(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%32 = icmp eq i32 %31, 1
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
br label %35
35: ; preds = %33, %30
%36 = tail call i32 @tgetnum(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.10, i64 0, i64 0), i32 %36)
%38 = tail call i32 @tgetnum(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.12, i64 0, i64 0), i32 %38)
%40 = tail call i32 @Print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i64 0, i64 0))
%41 = tail call i32 @Print(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i64 0, i64 0))
%42 = tail call i32 @Print(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.19, i64 0, i64 0))
%43 = tail call i32 @Print(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.20, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.21, i64 0, i64 0))
%44 = tail call i32 @Print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.22, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.23, i64 0, i64 0))
%45 = tail call i32 @Print(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.24, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.25, i64 0, i64 0))
%46 = tail call i32 @Print(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.26, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.27, i64 0, i64 0))
%47 = tail call i32 @Print(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.28, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.29, i64 0, i64 0))
%48 = tail call i32 @Print(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.30, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.31, i64 0, i64 0))
%49 = tail call i32 @Print(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.32, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.33, i64 0, i64 0))
%50 = tail call i32 @Print(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.34, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.35, i64 0, i64 0))
%51 = tail call i32 @Print(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.36, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.37, i64 0, i64 0))
%52 = tail call i32 @Print(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.38, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.39, i64 0, i64 0))
%53 = tail call i32 @Print(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.40, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.41, i64 0, i64 0))
%54 = tail call i32 @Print(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.42, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.43, i64 0, i64 0))
%55 = tail call i32 @Print(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.44, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.45, i64 0, i64 0))
%56 = tail call i32 @Print(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.46, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.47, i64 0, i64 0))
%57 = tail call i32 @Print(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.48, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.49, i64 0, i64 0))
%58 = tail call i32 @Print(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.50, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.51, i64 0, i64 0))
%59 = tail call i32 @Print(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.52, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.53, i64 0, i64 0))
%60 = tail call i32 @Print(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.54, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.55, i64 0, i64 0))
%61 = tail call i32 @Print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.56, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.57, i64 0, i64 0))
%62 = tail call i32 @Print(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.58, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.59, i64 0, i64 0))
%63 = tail call i32 @Print(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.60, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.61, i64 0, i64 0))
%64 = tail call i32 @Print(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.62, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.63, i64 0, i64 0))
%65 = tail call i32 @Print(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.64, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.65, i64 0, i64 0))
%66 = tail call i32 @Print(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.66, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.67, i64 0, i64 0))
%67 = tail call i32 @Print(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.68, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.69, i64 0, i64 0))
%68 = tail call i32 @Print(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.70, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.71, i64 0, i64 0))
ret i32 0
}