#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 *, ...);
int /*<<< orphan*/ version(int /*<<< orphan*/ *);
void usage(FILE *f, char *errmsg) {
  char *info = "Purpose:\n  Create RTEMS nios2 BSP configuration from Altera "
               "SOPC description\n";
  if (errmsg)
    info = errmsg;
  version(f);
  fprintf(f,
          "\n%s\nUsage: nios2gen [OPTIONS] <SOPC PTF> [CONFIG PTF] [CONFIG "
          "PTF]...\n",
          info);
  fprintf(f, "   -h         --help               Print help and exit\n");
  fprintf(f, "   -V         --version            Print version and exit\n");
  fprintf(f, "   -bFILENAME --bspheader=FILENAME Output BSP configuration "
             "header file (default='sopc.h')\n");
  fprintf(f, "   -B         --no-bspheader       Do not output BSP "
             "configuration header file\n");
  fprintf(f, "   -lFILENAME --linkcmds=FILENAME  Output linker script "
             "(default='linkcmds')\n");
  fprintf(f,
          "   -L         --no-linkcmds        Do not output linker script\n");
  fprintf(f, "   -pFILENAME --parsed=FILENAME    Output PTF contents as long "
             "list (default: don't)\n");
  fprintf(f, "   -P         --no-parsed          Do not output PTF contents as "
             "long list\n");
  fprintf(f, "   -q         --quiet              Do not print progress info to "
             "stdout\n\n");
  fprintf(f, "Using \"-\" as the FILENAME means standard output (stdout).\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec9(%rip),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114e <usage+0x2e>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <version@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xee8(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf1d(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf43(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf6c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xfb6(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xff4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0x1030(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0x105e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0x10a2(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0x10dc(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0x1114(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
test   %rsi,%rsi
lea    0xebf(%rip),%rbx
cmovne %rsi,%rbx
call   1040 <version@plt>
lea    0xefd(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xf30(%rip),%rdi
mov    $0x37,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1050 <fwrite@plt>
lea    0xf4f(%rip),%rdi
mov    $0x3a,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1050 <fwrite@plt>
lea    0xf71(%rip),%rdi
mov    $0x5b,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1050 <fwrite@plt>
lea    0xfb4(%rip),%rdi
mov    $0x4f,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1050 <fwrite@plt>
lea    0xfeb(%rip),%rdi
mov    $0x4d,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1050 <fwrite@plt>
lea    0x1020(%rip),%rdi
mov    $0x3f,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1050 <fwrite@plt>
lea    0x1047(%rip),%rdi
mov    $0x55,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1050 <fwrite@plt>
lea    0x1084(%rip),%rdi
mov    $0x4b,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1050 <fwrite@plt>
lea    0x10b7(%rip),%rdi
mov    $0x49,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1050 <fwrite@plt>
lea    0x10e8(%rip),%rdi
mov    $0x3a,%esi
mov    $0x1,%edx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <fwrite@plt>

LLVM IR (-O0):
@.str = [78 x i8] c"Purpose:\0A Create RTEMS nios2 BSP configuration from Altera SOPC description\0A\00"
@.str.1 = [71 x i8] c"\0A%s\0AUsage: nios2gen [OPTIONS] <SOPC PTF> [CONFIG PTF] [CONFIG PTF]...\0A\00"
@.str.2 = [56 x i8] c" -h --help Print help and exit\0A\00"
@.str.3 = [59 x i8] c" -V --version Print version and exit\0A\00"
@.str.4 = [92 x i8] c" -bFILENAME --bspheader=FILENAME Output BSP configuration header file (default='sopc.h')\0A\00"
@.str.5 = [80 x i8] c" -B --no-bspheader Do not output BSP configuration header file\0A\00"
@.str.6 = [78 x i8] c" -lFILENAME --linkcmds=FILENAME Output linker script (default='linkcmds')\0A\00"
@.str.7 = [64 x i8] c" -L --no-linkcmds Do not output linker script\0A\00"
@.str.8 = [86 x i8] c" -pFILENAME --parsed=FILENAME Output PTF contents as long list (default: don't)\0A\00"
@.str.9 = [76 x i8] c" -P --no-parsed Do not output PTF contents as long list\0A\00"
@.str.10 = [74 x i8] c" -q --quiet Do not print progress info to stdout\0A\0A\00"
@.str.11 = [59 x i8] c"Using \22-\22 as the FILENAME means standard output (stdout).\0A\00"
define void @usage(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
store i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0), i8** %5
%6 = load i8*, i8** %4
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i8*, i8** %4
store i8* %9, i8** %5
br label %10
10: ; preds = %8, %2
%11 = load i32*, i32** %3
%12 = call i32 @version(i32* %11)
%13 = load i32*, i32** %3
%14 = load i8*, i8** %5
%15 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = load i32*, i32** %3
%17 = call i32 (i32*, i8*, ...) @fprintf(i32* %16, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0))
%18 = load i32*, i32** %3
%19 = call i32 (i32*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0))
%20 = load i32*, i32** %3
%21 = call i32 (i32*, i8*, ...) @fprintf(i32* %20, i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str.4, i64 0, i64 0))
%22 = load i32*, i32** %3
%23 = call i32 (i32*, i8*, ...) @fprintf(i32* %22, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.5, i64 0, i64 0))
%24 = load i32*, i32** %3
%25 = call i32 (i32*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.6, i64 0, i64 0))
%26 = load i32*, i32** %3
%27 = call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.7, i64 0, i64 0))
%28 = load i32*, i32** %3
%29 = call i32 (i32*, i8*, ...) @fprintf(i32* %28, i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.8, i64 0, i64 0))
%30 = load i32*, i32** %3
%31 = call i32 (i32*, i8*, ...) @fprintf(i32* %30, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.9, i64 0, i64 0))
%32 = load i32*, i32** %3
%33 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.10, i64 0, i64 0))
%34 = load i32*, i32** %3
%35 = call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.11, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [78 x i8] c"Purpose:\0A Create RTEMS nios2 BSP configuration from Altera SOPC description\0A\00"
@.str.1 = [71 x i8] c"\0A%s\0AUsage: nios2gen [OPTIONS] <SOPC PTF> [CONFIG PTF] [CONFIG PTF]...\0A\00"
@.str.2 = [56 x i8] c" -h --help Print help and exit\0A\00"
@.str.3 = [59 x i8] c" -V --version Print version and exit\0A\00"
@.str.4 = [92 x i8] c" -bFILENAME --bspheader=FILENAME Output BSP configuration header file (default='sopc.h')\0A\00"
@.str.5 = [80 x i8] c" -B --no-bspheader Do not output BSP configuration header file\0A\00"
@.str.6 = [78 x i8] c" -lFILENAME --linkcmds=FILENAME Output linker script (default='linkcmds')\0A\00"
@.str.7 = [64 x i8] c" -L --no-linkcmds Do not output linker script\0A\00"
@.str.8 = [86 x i8] c" -pFILENAME --parsed=FILENAME Output PTF contents as long list (default: don't)\0A\00"
@.str.9 = [76 x i8] c" -P --no-parsed Do not output PTF contents as long list\0A\00"
@.str.10 = [74 x i8] c" -q --quiet Do not print progress info to stdout\0A\0A\00"
@.str.11 = [59 x i8] c"Using \22-\22 as the FILENAME means standard output (stdout).\0A\00"
define void @usage(i32* %0, i8* %1) {
%3 = icmp eq i8* %1, null
%4 = select i1 %3, i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0), i8* %1
%5 = tail call i32 @version(i32* %0)
%6 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%7 = tail call i64 @fwrite(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0), i64 55, i64 1, i32* %0)
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0), i64 58, i64 1, i32* %0)
%9 = tail call i64 @fwrite(i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str.4, i64 0, i64 0), i64 91, i64 1, i32* %0)
%10 = tail call i64 @fwrite(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.5, i64 0, i64 0), i64 79, i64 1, i32* %0)
%11 = tail call i64 @fwrite(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.6, i64 0, i64 0), i64 77, i64 1, i32* %0)
%12 = tail call i64 @fwrite(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.7, i64 0, i64 0), i64 63, i64 1, i32* %0)
%13 = tail call i64 @fwrite(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.8, i64 0, i64 0), i64 85, i64 1, i32* %0)
%14 = tail call i64 @fwrite(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.9, i64 0, i64 0), i64 75, i64 1, i32* %0)
%15 = tail call i64 @fwrite(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.10, i64 0, i64 0), i64 73, i64 1, i32* %0)
%16 = tail call i64 @fwrite(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.11, i64 0, i64 0), i64 58, i64 1, i32* %0)
ret void
}