#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*/ memcpy(char *, char const *, size_t);
size_t strlen(char const *);
int load_embedded_page(char *buffer, char *selector) {
  static const char *welcome =
      "i\n"
      "i          ***  Gopherus v"
      "1.1dev"
      " Copyright (C) Mateusz Viste "
      "2015"
      "  ***\n"
      "i                                           .---.           _....._\n"
      "i Welcome to Gopherus, a multiplatform,    /  p  `\\     .-\"\"`:     "
      ":`\"-.\n"
      "i console-mode gopher client.              |__   - |  ,'     .     '    "
      "',\n"
      "i                                           ._>    \\ /:      :     ;   "
      "   :,\n"
      "i You'll find below a few gopher links that  '-.    '\\`.     .     :   "
      "  '  \\\n"
      "i might help you start your journey in the      `.   | .'._.' '._.' "
      "'._.'.  |\n"
      "i gopher world, as well as a few documents        `;-\\.   :     :     "
      "'   '/,__,\n"
      "i related to Gopherus.                            .-'`'._ '     .     : "
      "_.'.__.'\n"
      "i If you wish to go to a location you already    ((((-'/ "
      "`\";--..:..--;\"` \\\n"
      "i know, enter its URL into the URL bar above         .'   /       jgs "
      "\\   \\\n"
      "i (press TAB to switch to the URL bar).             ((((-'           "
      "((((-'\n"
      "i\n"
      "1Veronica - A gopher search engine\t/v2\tgopher.floodgap.com\t70\n"
      "1Super Dimension Fortress (non-profit gopher hosting)\t\tsdf.org\t70\n"
      "1The Online Book Initiative\t1/The Online Book "
      "Initiative\tgopher.std.com\t70\n"
      "1The Gopherus home gopher "
      "hole\t/projects/gopherus\tgopher.viste-family.net\t70\n"
      "i\n"
      "iGopherus (offline) documentation:\n"
      "0The Gopherus manual\t\t#manual\t70\n"
      "0Read the Gopherus licensing rules (GNU GPL v3)\t\t#license\t70\n";
  static const char *license =
      "\n"
      " Gopherus v"
      "1.1dev"
      " Copyright (C) Mateusz Viste "
      "2015"
      "\n"
      "\n"
      " This program is free software: you can redistribute it and/or modify "
      "it under\n"
      " the terms of the GNU General Public License as published by the Free "
      "Software\n"
      " Foundation, either version 3 of the License, or (at your option) any "
      "later\n"
      " version.\n"
      "\n"
      " This program is distributed in the hope that it will be useful, but "
      "WITHOUT\n"
      " ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or "
      "FITNESS\n"
      " FOR A PARTICULAR PURPOSE. See the GNU General Public License for more "
      "details.\n"
      "\n"
      " You should have received a copy of the GNU General Public License "
      "along with\n"
      " this program. If not, see <http://www.gnu.org/licenses/>.";
  static const char *manual =
      "\n"
      " Gopherus v"
      "1.1dev"
      " Copyright (C) Mateusz Viste "
      "2015"
      "\n"
      "\n"
      "\n"
      " ** Key bindings **\n"
      "\n"
      " Gopherus is a console-mode gopher client. It's entirely "
      "keyboard-driven, thus\n"
      " knowing its key bindings is mandatory for comfortable gopher "
      "browsing.\n"
      "\n"
      " Key bindings:\n"
      "   TAB       - Switch to/from URL bar edition\n"
      "   ESC       - Quit Gopherus (requires a confirmation)\n"
      "   UP/DOWN   - Scroll the screen's content up/down by one line\n"
      "   PGUP/PGDW - Scroll the screen's content up/down by one page\n"
      "   HOME/END  - Go to the begin/end of the document\n"
      "   BACKSPC   - Go back to the previous location\n"
      "   F1        - Show help (this manual)\n"
      "   F5        - Refresh current location\n"
      "   F9        - Download location on disk\n"
      "\n"
      "\n"
      " ** Customizing the color scheme **\n"
      "\n"
      " The Gopherus color scheme can be customized, if the default one is not "
      "suiting\n"
      " you. To customize the color scheme of Gopherus, you will have to set "
      "an\n"
      " environnment variable 'GOPHERUSCOLOR' prior to Gopherus launching. "
      "This\n"
      " variable have to contain exacty 6 color attributes. Each attribute is\n"
      " describing the foreground/background color for a given element of the "
      "Gopherus\n"
      " user interface. An attribute is composed from two hexadecimal digits: "
      "XY,\n"
      " where X is the background color, and Y is the foreground color. Colors "
      "are\n"
      " indexed as in the classic CGA palette, that is:\n"
      "\n"
      " Index - Color\n"
      "   0   -  black\n"
      "   1   -  low blue\n"
      "   2   -  low green\n"
      "   3   -  low cyan\n"
      "   4   -  low red\n"
      "   5   -  low magenta\n"
      "   6   -  low brown\n"
      "   7   -  light gray\n"
      "   8   -  dark gray\n"
      "   9   -  high blue\n"
      "   A   -  high green\n"
      "   B   -  high cyan\n"
      "   C   -  high red\n"
      "   D   -  high magenta\n"
      "   E   -  yellow\n"
      "   F   -  high intensity white\n"
      "\n"
      " GOPHERUSCOLOR=aabbccddeeffgghhii\n"
      "                | | | | | | | | |\n"
      "                | | | | | | | | |\n"
      "                | | | | | | | | +- Selected item in menu\n"
      "                | | | | | | | |\n"
      "                | | | | | | | +--- Selectable items in menu\n"
      "                | | | | | | |\n"
      "                | | | | | | +----- Error item in menu\n"
      "                | | | | | |\n"
      "                | | | | | +------- Itemtype column in menus\n"
      "                | | | | |\n"
      "                | | | | +--------- URL bar side decorations\n"
      "                | | | |\n"
      "                | | | +----------- URL bar\n"
      "                | | |\n"
      "                | | +------------- Status bar (warning)\n"
      "                | |\n"
      "                | +--------------- Status bar (information)\n"
      "                |\n"
      "                +----------------- Normal text (text files or menu 'i' "
      "items)\n"
      "\n"
      " Example:\n"
      "  The default palette used by Gopherus is.......: "
      "\"177047707818141220\"\n"
      "  For a black & white mode, use.................: "
      "\"077070707808070770\"\n"
      "  Missing those green 1980-like phosphor CRTs?..: "
      "\"022020202002020220\"\n"
      "\n"
      "\n"
      " ** Final notes **\n"
      "\n"
      " Gopherus has been written with care to behave nicely and follow "
      "standards.\n"
      " It conforms closely to following guidelines:\n"
      "   RFC 1436: The Internet Gopher Protocol\n"
      "   RFC 4266: The gopher URI Scheme\n";
  const char *page;
  size_t len;
  switch (selector[0]) {
  case 'l':
    page = license;
    break;
  case 'm':
    page = manual;
    break;
  default:
    page = welcome;
  }
  len = strlen(page);
  memcpy(buffer, page, len);
  return len;
}


x86 assembly (clang, -O0):
<load_embedded_page>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x24(%rbp)
sub    $0x6c,%eax
je     1159 <load_embedded_page+0x39>
jmp    1148 <load_embedded_page+0x28>
mov    -0x24(%rbp),%eax
sub    $0x6d,%eax
je     1169 <load_embedded_page+0x49>
jmp    1179 <load_embedded_page+0x59>
mov    0x3ed8(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1184 <load_embedded_page+0x64>
mov    0x3ed0(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1184 <load_embedded_page+0x64>
mov    0x3eb0(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_embedded_page>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
mov    (%rsi),%al
cmp    $0x6d,%al
lea    0x169a(%rip),%rcx
lea    0xec6(%rip),%rdx
cmove  %rcx,%rdx
cmp    $0x6c,%al
lea    0x13e6(%rip),%rbx
cmovne %rdx,%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rax,%r15
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1040 <memcpy@plt>
mov    %r15d,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@load_embedded_page.welcome = internal global i8* getelementptr inbounds ([1325 x i8], [1325 x i8]* @.str, i32 0, i32 0)
@.str = [1325 x i8] c"i\0Ai *** Gopherus v1.1dev Copyright (C) Mateusz Viste 2015 ***\0Ai .---. _....._\0Ai Welcome to Gopherus, a multiplatform, / p `\\ .-\22\22`: :`\22-.\0Ai console-mode gopher client. |__ - | ,' . ' ',\0Ai ._> \\ /: : ; :,\0Ai You'll find below a few gopher links that '-. '\\`. . : ' \\\0Ai might help you start your journey in the `. | .'._.' '._.' '._.'. |\0Ai gopher world, as well as a few documents `;-\\. : : ' '/,__,\0Ai related to Gopherus. .-'`'._ ' . : _.'.__.'\0Ai If you wish to go to a location you already ((((-'/ `\22;--..:..--;\22` \\\0Ai know, enter its URL into the URL bar above .' / jgs \\ \\\0Ai (press TAB to switch to the URL bar). ((((-' ((((-'\0Ai\0A1Veronica - A gopher search engine\09/v2\09gopher.floodgap.com\0970\0A1Super Dimension Fortress (non-profit gopher hosting)\09\09sdf.org\0970\0A1The Online Book Initiative\091/The Online Book Initiative\09gopher.std.com\0970\0A1The Gopherus home gopher hole\09/projects/gopherus\09gopher.viste-family.net\0970\0Ai\0AiGopherus (offline) documentation:\0A0The Gopherus manual\09\09#manual\0970\0A0Read the Gopherus licensing rules (GNU GPL v3)\09\09#license\0970\0A\00"
@load_embedded_page.license = internal global i8* getelementptr inbounds ([672 x i8], [672 x i8]* @.str.1, i32 0, i32 0)
@.str.1 = [672 x i8] c"\0A Gopherus v1.1dev Copyright (C) Mateusz Viste 2015\0A\0A This program is free software: you can redistribute it and/or modify it under\0A the terms of the GNU General Public License as published by the Free Software\0A Foundation, either version 3 of the License, or (at your option) any later\0A version.\0A\0A This program is distributed in the hope that it will be useful, but WITHOUT\0A ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\0A FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\0A\0A You should have received a copy of the GNU General Public License along with\0A this program. If not, see <http://www.gnu.org/licenses/>.\00"
@load_embedded_page.manual = internal global i8* getelementptr inbounds ([2923 x i8], [2923 x i8]* @.str.2, i32 0, i32 0)
@.str.2 = [2923 x i8] c"\0A Gopherus v1.1dev Copyright (C) Mateusz Viste 2015\0A\0A\0A ** Key bindings **\0A\0A Gopherus is a console-mode gopher client. It's entirely keyboard-driven, thus\0A knowing its key bindings is mandatory for comfortable gopher browsing.\0A\0A Key bindings:\0A TAB - Switch to/from URL bar edition\0A ESC - Quit Gopherus (requires a confirmation)\0A UP/DOWN - Scroll the screen's content up/down by one line\0A PGUP/PGDW - Scroll the screen's content up/down by one page\0A HOME/END - Go to the begin/end of the document\0A BACKSPC - Go back to the previous location\0A F1 - Show help (this manual)\0A F5 - Refresh current location\0A F9 - Download location on disk\0A\0A\0A ** Customizing the color scheme **\0A\0A The Gopherus color scheme can be customized, if the default one is not suiting\0A you. To customize the color scheme of Gopherus, you will have to set an\0A environnment variable 'GOPHERUSCOLOR' prior to Gopherus launching. This\0A variable have to contain exacty 6 color attributes. Each attribute is\0A describing the foreground/background color for a given element of the Gopherus\0A user interface. An attribute is composed from two hexadecimal digits: XY,\0A where X is the background color, and Y is the foreground color. Colors are\0A indexed as in the classic CGA palette, that is:\0A\0A Index - Color\0A 0 - black\0A 1 - low blue\0A 2 - low green\0A 3 - low cyan\0A 4 - low red\0A 5 - low magenta\0A 6 - low brown\0A 7 - light gray\0A 8 - dark gray\0A 9 - high blue\0A A - high green\0A B - high cyan\0A C - high red\0A D - high magenta\0A E - yellow\0A F - high intensity white\0A\0A GOPHERUSCOLOR=aabbccddeeffgghhii\0A | | | | | | | | |\0A | | | | | | | | |\0A | | | | | | | | +- Selected item in menu\0A | | | | | | | |\0A | | | | | | | +--- Selectable items in menu\0A | | | | | | |\0A | | | | | | +----- Error item in menu\0A | | | | | |\0A | | | | | +------- Itemtype column in menus\0A | | | | |\0A | | | | +--------- URL bar side decorations\0A | | | |\0A | | | +----------- URL bar\0A | | |\0A | | +------------- Status bar (warning)\0A | |\0A | +--------------- Status bar (information)\0A |\0A +----------------- Normal text (text files or menu 'i' items)\0A\0A Example:\0A The default palette used by Gopherus is.......: \22177047707818141220\22\0A For a black & white mode, use.................: \22077070707808070770\22\0A Missing those green 1980-like phosphor CRTs?..: \22022020202002020220\22\0A\0A\0A ** Final notes **\0A\0A Gopherus has been written with care to behave nicely and follow standards.\0A It conforms closely to following guidelines:\0A RFC 1436: The Internet Gopher Protocol\0A RFC 4266: The gopher URI Scheme\0A\00"
define i32 @load_embedded_page(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %4
%8 = getelementptr inbounds i8, i8* %7, i64 0
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
switch i32 %10, label %15 [
i32 108, label %11
i32 109, label %13
]
11: ; preds = %2
%12 = load i8*, i8** @load_embedded_page.license
store i8* %12, i8** %5
br label %17
13: ; preds = %2
%14 = load i8*, i8** @load_embedded_page.manual
store i8* %14, i8** %5
br label %17
15: ; preds = %2
%16 = load i8*, i8** @load_embedded_page.welcome
store i8* %16, i8** %5
br label %17
17: ; preds = %15, %13, %11
%18 = load i8*, i8** %5
%19 = call i64 @strlen(i8* %18)
store i64 %19, i64* %6
%20 = load i8*, i8** %3
%21 = load i8*, i8** %5
%22 = load i64, i64* %6
%23 = call i32 @memcpy(i8* %20, i8* %21, i64 %22)
%24 = load i64, i64* %6
%25 = trunc i64 %24 to i32
ret i32 %25
}

LLVM IR (-O2):
@.str = [1325 x i8] c"i\0Ai *** Gopherus v1.1dev Copyright (C) Mateusz Viste 2015 ***\0Ai .---. _....._\0Ai Welcome to Gopherus, a multiplatform, / p `\\ .-\22\22`: :`\22-.\0Ai console-mode gopher client. |__ - | ,' . ' ',\0Ai ._> \\ /: : ; :,\0Ai You'll find below a few gopher links that '-. '\\`. . : ' \\\0Ai might help you start your journey in the `. | .'._.' '._.' '._.'. |\0Ai gopher world, as well as a few documents `;-\\. : : ' '/,__,\0Ai related to Gopherus. .-'`'._ ' . : _.'.__.'\0Ai If you wish to go to a location you already ((((-'/ `\22;--..:..--;\22` \\\0Ai know, enter its URL into the URL bar above .' / jgs \\ \\\0Ai (press TAB to switch to the URL bar). ((((-' ((((-'\0Ai\0A1Veronica - A gopher search engine\09/v2\09gopher.floodgap.com\0970\0A1Super Dimension Fortress (non-profit gopher hosting)\09\09sdf.org\0970\0A1The Online Book Initiative\091/The Online Book Initiative\09gopher.std.com\0970\0A1The Gopherus home gopher hole\09/projects/gopherus\09gopher.viste-family.net\0970\0Ai\0AiGopherus (offline) documentation:\0A0The Gopherus manual\09\09#manual\0970\0A0Read the Gopherus licensing rules (GNU GPL v3)\09\09#license\0970\0A\00"
@.str.1 = [672 x i8] c"\0A Gopherus v1.1dev Copyright (C) Mateusz Viste 2015\0A\0A This program is free software: you can redistribute it and/or modify it under\0A the terms of the GNU General Public License as published by the Free Software\0A Foundation, either version 3 of the License, or (at your option) any later\0A version.\0A\0A This program is distributed in the hope that it will be useful, but WITHOUT\0A ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\0A FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\0A\0A You should have received a copy of the GNU General Public License along with\0A this program. If not, see <http://www.gnu.org/licenses/>.\00"
@.str.2 = [2923 x i8] c"\0A Gopherus v1.1dev Copyright (C) Mateusz Viste 2015\0A\0A\0A ** Key bindings **\0A\0A Gopherus is a console-mode gopher client. It's entirely keyboard-driven, thus\0A knowing its key bindings is mandatory for comfortable gopher browsing.\0A\0A Key bindings:\0A TAB - Switch to/from URL bar edition\0A ESC - Quit Gopherus (requires a confirmation)\0A UP/DOWN - Scroll the screen's content up/down by one line\0A PGUP/PGDW - Scroll the screen's content up/down by one page\0A HOME/END - Go to the begin/end of the document\0A BACKSPC - Go back to the previous location\0A F1 - Show help (this manual)\0A F5 - Refresh current location\0A F9 - Download location on disk\0A\0A\0A ** Customizing the color scheme **\0A\0A The Gopherus color scheme can be customized, if the default one is not suiting\0A you. To customize the color scheme of Gopherus, you will have to set an\0A environnment variable 'GOPHERUSCOLOR' prior to Gopherus launching. This\0A variable have to contain exacty 6 color attributes. Each attribute is\0A describing the foreground/background color for a given element of the Gopherus\0A user interface. An attribute is composed from two hexadecimal digits: XY,\0A where X is the background color, and Y is the foreground color. Colors are\0A indexed as in the classic CGA palette, that is:\0A\0A Index - Color\0A 0 - black\0A 1 - low blue\0A 2 - low green\0A 3 - low cyan\0A 4 - low red\0A 5 - low magenta\0A 6 - low brown\0A 7 - light gray\0A 8 - dark gray\0A 9 - high blue\0A A - high green\0A B - high cyan\0A C - high red\0A D - high magenta\0A E - yellow\0A F - high intensity white\0A\0A GOPHERUSCOLOR=aabbccddeeffgghhii\0A | | | | | | | | |\0A | | | | | | | | |\0A | | | | | | | | +- Selected item in menu\0A | | | | | | | |\0A | | | | | | | +--- Selectable items in menu\0A | | | | | | |\0A | | | | | | +----- Error item in menu\0A | | | | | |\0A | | | | | +------- Itemtype column in menus\0A | | | | |\0A | | | | +--------- URL bar side decorations\0A | | | |\0A | | | +----------- URL bar\0A | | |\0A | | +------------- Status bar (warning)\0A | |\0A | +--------------- Status bar (information)\0A |\0A +----------------- Normal text (text files or menu 'i' items)\0A\0A Example:\0A The default palette used by Gopherus is.......: \22177047707818141220\22\0A For a black & white mode, use.................: \22077070707808070770\22\0A Missing those green 1980-like phosphor CRTs?..: \22022020202002020220\22\0A\0A\0A ** Final notes **\0A\0A Gopherus has been written with care to behave nicely and follow standards.\0A It conforms closely to following guidelines:\0A RFC 1436: The Internet Gopher Protocol\0A RFC 4266: The gopher URI Scheme\0A\00"
define i32 @load_embedded_page(i8* %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 109
%5 = select i1 %4, i8* getelementptr inbounds ([2923 x i8], [2923 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1325 x i8], [1325 x i8]* @.str, i64 0, i64 0)
%6 = icmp eq i8 %3, 108
%7 = select i1 %6, i8* getelementptr inbounds ([672 x i8], [672 x i8]* @.str.1, i64 0, i64 0), i8* %5
%8 = tail call i64 @strlen(i8* dereferenceable(1) %7)
%9 = tail call i32 @memcpy(i8* %0, i8* %7, i64 %8)
%10 = trunc i64 %8 to i32
ret i32 %10
}