#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*/ print_banner();
int /*<<< orphan*/ printf(char *, ...);
void print_usage(int argc, char *argv[]) {
  print_banner();
  printf("\nA tool to extract firmware for a Broadcom 43xx device\n");
  printf("from a proprietary Broadcom 43xx device driver file.\n");
  printf("\nUsage: %s [OPTION] [proprietary-driver-file]\n", argv[0]);
  printf("  --unsupported         "
         "Allow working on extractable but unsupported drivers\n");
  printf("  -l|--list             "
         "List supported driver versions\n");
  printf("  -i|--identify         "
         "Only identify the driver file (don't extract)\n");
  printf("  -w|--target-dir DIR   "
         "Extract and write firmware to DIR\n");
  printf("  -v|--version          "
         "Print b43-fwcutter version\n");
  printf("  -h|--help             "
         "Print this help\n");
  printf("\nExample: %s -w /lib/firmware wl_apsta.o\n"
         "         to extract the firmware blobs from wl_apsta.o and store\n"
         "         the resulting firmware in /lib/firmware\n",
         argv[0]);
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <print_banner@plt>
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeed(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xf0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xfd2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xfff(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x1025(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0x1039(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
push   %rbx
mov    %rsi,%rbx
xor    %eax,%eax
call   1050 <print_banner@plt>
lea    0xf89(%rip),%rdi
call   1030 <puts@plt>
lea    0xfb4(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%rsi
lea    0xea3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xfcc(%rip),%rdi
call   1030 <puts@plt>
lea    0x100d(%rip),%rdi
call   1030 <puts@plt>
lea    0x1038(%rip),%rdi
call   1030 <puts@plt>
lea    0x1072(%rip),%rdi
call   1030 <puts@plt>
lea    0x10a0(%rip),%rdi
call   1030 <puts@plt>
lea    0x10c7(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%rsi
lea    0xe79(%rip),%rdi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [56 x i8] c"\0AA tool to extract firmware for a Broadcom 43xx device\0A\00"
@.str.1 = [54 x i8] c"from a proprietary Broadcom 43xx device driver file.\0A\00"
@.str.2 = [47 x i8] c"\0AUsage: %s [OPTION] [proprietary-driver-file]\0A\00"
@.str.3 = [78 x i8] c" --unsupported Allow working on extractable but unsupported drivers\0A\00"
@.str.4 = [56 x i8] c" -l|--list List supported driver versions\0A\00"
@.str.5 = [71 x i8] c" -i|--identify Only identify the driver file (don't extract)\0A\00"
@.str.6 = [59 x i8] c" -w|--target-dir DIR Extract and write firmware to DIR\0A\00"
@.str.7 = [52 x i8] c" -v|--version Print b43-fwcutter version\0A\00"
@.str.8 = [41 x i8] c" -h|--help Print this help\0A\00"
@.str.9 = [156 x i8] c"\0AExample: %s -w /lib/firmware wl_apsta.o\0A to extract the firmware blobs from wl_apsta.o and store\0A the resulting firmware in /lib/firmware\0A\00"
define void @print_usage(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 (...) @print_banner()
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0))
%8 = load i8**, i8*** %4
%9 = getelementptr inbounds i8*, i8** %8, i64 0
%10 = load i8*, i8** %9
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i8* %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.4, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.5, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.6, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.7, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.8, i64 0, i64 0))
%18 = load i8**, i8*** %4
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str.9, i64 0, i64 0), i8* %20)
ret void
}

LLVM IR (-O2):
@.str.2 = [47 x i8] c"\0AUsage: %s [OPTION] [proprietary-driver-file]\0A\00"
@.str.9 = [156 x i8] c"\0AExample: %s -w /lib/firmware wl_apsta.o\0A to extract the firmware blobs from wl_apsta.o and store\0A the resulting firmware in /lib/firmware\0A\00"
@str = [55 x i8] c"\0AA tool to extract firmware for a Broadcom 43xx device\00"
@str.10 = [53 x i8] c"from a proprietary Broadcom 43xx device driver file.\00"
@str.11 = [77 x i8] c" --unsupported Allow working on extractable but unsupported drivers\00"
@str.12 = [55 x i8] c" -l|--list List supported driver versions\00"
@str.13 = [70 x i8] c" -i|--identify Only identify the driver file (don't extract)\00"
@str.14 = [58 x i8] c" -w|--target-dir DIR Extract and write firmware to DIR\00"
@str.15 = [51 x i8] c" -v|--version Print b43-fwcutter version\00"
@str.16 = [40 x i8] c" -h|--help Print this help\00"
define void @print_usage(i32 %0, i8** nocapture %1) {
%3 = tail call i32 (...) @print_banner()
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.10, i64 0, i64 0))
%6 = load i8*, i8** %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @str.11, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.12, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @str.13, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str.14, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.15, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.16, i64 0, i64 0))
%14 = load i8*, i8** %1
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([156 x i8], [156 x i8]* @.str.9, i64 0, i64 0), i8* %14)
ret void
}