#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void printUsage(FILE *stream, const char *programName) {
  fprintf(stream, "Usage: %s <option(s)> <file>\n", programName);
  fprintf(stream,
          " Disassembles PIC program file <file>. Use - for standard input.\n");
  fprintf(stream, " Written by Vanya A. Sergeev - <vsergeev@gmail.com>.\n\n");
  fprintf(
      stream,
      " Additional Options:\n  -o, --out-file <output file>	Write to "
      "output file instead of standard output.\n  -a, --arch "
      "<architecture>	Specify the 8-bit PIC architecture to use\n	"
      "			during disassembly.\n  -t, --file-type <type>	"
      "Specify the file type of the object file.\n  -l, --address-label "
      "<prefix> 	Create ghetto address labels with\n		"
      "		the specified label prefix.\n  --original                    "
      "Print original opcode data alongside\n				"
      "disassembly.\n  --no-addresses		Do not display the address "
      "alongside\n				disassembly.\n  "
      "--no-destination-comments	Do not display the destination "
      "address\n				comments of relative branch "
      "instructions.\n  --literal-hex			Represent literals in "
      "hexadecimal (default)\n  --literal-bin			Represent "
      "literals in binary\n  --literal-dec			Represent "
      "literals in decimal\n  --literal-ascii		Show ASCII value of "
      "literal operands in a\n				comment\n  -h, "
      "--help			Display this usage/help.\n  -v, "
      "--version			Display the program's version.\n\n");
  fprintf(stream,
          "Supported 8-bit PIC Architectures:\n  Baseline 		"
          "	baseline\n  Mid-Range			midrange (default)\n  "
          "Enhanced Mid-Range		enhanced\n\n");
  fprintf(stream, "Supported file types:\n  Intel HEX8 			ihex\n "
                  " Motorola S-Record 		srecord\n\n");
}


x86 assembly (clang, -O0):
<printUsage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xed1(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xedd(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf0d(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf32(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0x12d8(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0x1342(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printUsage>:
push   %rbx
mov    %rsi,%rdx
mov    %rdi,%rbx
lea    0xed2(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xee2(%rip),%rdi
mov    $0x41,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xf0b(%rip),%rdi
mov    $0x36,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xf29(%rip),%rdi
mov    $0x3b7,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0x12c8(%rip),%rdi
mov    $0x7b,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0x132b(%rip),%rdi
mov    $0x4a,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
pop    %rbx
jmp    1040 <fwrite@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"Usage: %s <option(s)> <file>\0A\00"
@.str.1 = [66 x i8] c" Disassembles PIC program file <file>. Use - for standard input.\0A\00"
@.str.2 = [55 x i8] c" Written by Vanya A. Sergeev - <vsergeev@gmail.com>.\0A\0A\00"
@.str.3 = [952 x i8] c" Additional Options:\0A -o, --out-file <output file>\09Write to output file instead of standard output.\0A -a, --arch <architecture>\09Specify the 8-bit PIC architecture to use\0A\09\09\09\09during disassembly.\0A -t, --file-type <type>\09Specify the file type of the object file.\0A -l, --address-label <prefix> \09Create ghetto address labels with\0A\09\09\09\09the specified label prefix.\0A --original Print original opcode data alongside\0A\09\09\09\09disassembly.\0A --no-addresses\09\09Do not display the address alongside\0A\09\09\09\09disassembly.\0A --no-destination-comments\09Do not display the destination address\0A\09\09\09\09comments of relative branch instructions.\0A --literal-hex\09\09\09Represent literals in hexadecimal (default)\0A --literal-bin\09\09\09Represent literals in binary\0A --literal-dec\09\09\09Represent literals in decimal\0A --literal-ascii\09\09Show ASCII value of literal operands in a\0A\09\09\09\09comment\0A -h, --help\09\09\09Display this usage/help.\0A -v, --version\09\09\09Display the program's version.\0A\0A\00"
@.str.4 = [124 x i8] c"Supported 8-bit PIC Architectures:\0A Baseline \09\09\09baseline\0A Mid-Range\09\09\09midrange (default)\0A Enhanced Mid-Range\09\09enhanced\0A\0A\00"
@.str.5 = [75 x i8] c"Supported file types:\0A Intel HEX8 \09\09\09ihex\0A Motorola S-Record \09\09srecord\0A\0A\00"
define void @printUsage(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%5 = load i32*, i32** %3
%6 = load i8*, i8** %4
%7 = call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i32*, i32** %3
%9 = call i32 (i32*, i8*, ...) @fprintf(i32* %8, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32*, i32** %3
%11 = call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0))
%12 = load i32*, i32** %3
%13 = call i32 (i32*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([952 x i8], [952 x i8]* @.str.3, i64 0, i64 0))
%14 = load i32*, i32** %3
%15 = call i32 (i32*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([124 x i8], [124 x i8]* @.str.4, i64 0, i64 0))
%16 = load i32*, i32** %3
%17 = call i32 (i32*, i8*, ...) @fprintf(i32* %16, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"Usage: %s <option(s)> <file>\0A\00"
@.str.1 = [66 x i8] c" Disassembles PIC program file <file>. Use - for standard input.\0A\00"
@.str.2 = [55 x i8] c" Written by Vanya A. Sergeev - <vsergeev@gmail.com>.\0A\0A\00"
@.str.3 = [952 x i8] c" Additional Options:\0A -o, --out-file <output file>\09Write to output file instead of standard output.\0A -a, --arch <architecture>\09Specify the 8-bit PIC architecture to use\0A\09\09\09\09during disassembly.\0A -t, --file-type <type>\09Specify the file type of the object file.\0A -l, --address-label <prefix> \09Create ghetto address labels with\0A\09\09\09\09the specified label prefix.\0A --original Print original opcode data alongside\0A\09\09\09\09disassembly.\0A --no-addresses\09\09Do not display the address alongside\0A\09\09\09\09disassembly.\0A --no-destination-comments\09Do not display the destination address\0A\09\09\09\09comments of relative branch instructions.\0A --literal-hex\09\09\09Represent literals in hexadecimal (default)\0A --literal-bin\09\09\09Represent literals in binary\0A --literal-dec\09\09\09Represent literals in decimal\0A --literal-ascii\09\09Show ASCII value of literal operands in a\0A\09\09\09\09comment\0A -h, --help\09\09\09Display this usage/help.\0A -v, --version\09\09\09Display the program's version.\0A\0A\00"
@.str.4 = [124 x i8] c"Supported 8-bit PIC Architectures:\0A Baseline \09\09\09baseline\0A Mid-Range\09\09\09midrange (default)\0A Enhanced Mid-Range\09\09enhanced\0A\0A\00"
@.str.5 = [75 x i8] c"Supported file types:\0A Intel HEX8 \09\09\09ihex\0A Motorola S-Record \09\09srecord\0A\0A\00"
define void @printUsage(i32* nocapture %0, i8* %1) {
%3 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %1)
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0), i64 65, i64 1, i32* %0)
%5 = tail call i64 @fwrite(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0), i64 54, i64 1, i32* %0)
%6 = tail call i64 @fwrite(i8* getelementptr inbounds ([952 x i8], [952 x i8]* @.str.3, i64 0, i64 0), i64 951, i64 1, i32* %0)
%7 = tail call i64 @fwrite(i8* getelementptr inbounds ([124 x i8], [124 x i8]* @.str.4, i64 0, i64 0), i64 123, i64 1, i32* %0)
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.5, i64 0, i64 0), i64 74, i64 1, i32* %0)
ret void
}