#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*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
void usage(char *argv0) {
  printf("To read from flash Memory: \n");
  printf("\tusage: %s --readflash --bytes <n> --startaddr <x>\n", argv0);
  printf("\twhere n specifies the number of bytes to read (max 251)\n");
  printf("\tand x the hexadecimal start address for the read with 0x prefix\n");
  printf("\t  eg: %s --readflash --bytes 100 --startaddr 0x01320\n\n", argv0);
  printf("\nTo write to flash Memory: \n");
  printf("\tusage: %s --writeflash --hexfile <filename>\n", argv0);
  printf("\twhere filename specifies the hexfile that contains the code to be "
         "burned to memory\n");
  printf("\t  eg: %s --writeflash --hexfile test.hex\n\n", argv0);
  printf("\nTo erase to flash Memory: \n");
  printf("\tusage: %s --eraseflash --rows <n> --startaddr <x>\n", argv0);
  printf("\twhere n specifies the number of rows (64 bytes) to delete\n");
  printf(
      "\tand x the hexadecimal start address for the delete with 0x prefix\n");
  printf("\t  eg: %s --eraseflash --rows 3 --startaddr 0x01320\n\n", argv0);
  printf("\nTo reset PIC via bootloader: \n");
  printf("\tusage: %s --reset\n", argv0);
  printf("To read from EEPROM Memory: \n");
  printf("\tusage: %s --readeeprom --bytes <n> --startaddr <x>\n", argv0);
  printf("\twhere n specifies the number of bytes to read\n");
  printf("\tand x the hexadecimal start address for the read with 0x prefix\n");
  printf("\t  eg: %s --readeeprom ---bytes 16 --startaddr 0x80\n\n", argv0);
  exit(-1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xed8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xefe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf2a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xf5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xf8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xfaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xff2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x1010(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0x101b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x1041(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x106f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0x10a1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x10c9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0x10d7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x10dd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0x10e9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x1110(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0x1120(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0x1071(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb6(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x1070(%rip),%rdi
call   1030 <puts@plt>
lea    0x1212(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0xebe(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x107d(%rip),%rdi
call   1030 <puts@plt>
lea    0xed9(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x107c(%rip),%rdi
call   1030 <puts@plt>
lea    0xeea(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10b3(%rip),%rdi
call   1030 <puts@plt>
lea    0xef9(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10b2(%rip),%rdi
call   1030 <puts@plt>
lea    0x10e1(%rip),%rdi
call   1030 <puts@plt>
lea    0xf04(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x1107(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1d(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x1109(%rip),%rdi
call   1030 <puts@plt>
lea    0xf14(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x1109(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0xf24(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"To read from flash Memory: \0A\00"
@.str.1 = [52 x i8] c"\09usage: %s --readflash --bytes <n> --startaddr <x>\0A\00"
@.str.2 = [58 x i8] c"\09where n specifies the number of bytes to read (max 251)\0A\00"
@.str.3 = [66 x i8] c"\09and x the hexadecimal start address for the read with 0x prefix\0A\00"
@.str.4 = [56 x i8] c"\09 eg: %s --readflash --bytes 100 --startaddr 0x01320\0A\0A\00"
@.str.5 = [29 x i8] c"\0ATo write to flash Memory: \0A\00"
@.str.6 = [46 x i8] c"\09usage: %s --writeflash --hexfile <filename>\0A\00"
@.str.7 = [85 x i8] c"\09where filename specifies the hexfile that contains the code to be burned to memory\0A\00"
@.str.8 = [44 x i8] c"\09 eg: %s --writeflash --hexfile test.hex\0A\0A\00"
@.str.9 = [29 x i8] c"\0ATo erase to flash Memory: \0A\00"
@.str.10 = [52 x i8] c"\09usage: %s --eraseflash --rows <n> --startaddr <x>\0A\00"
@.str.11 = [60 x i8] c"\09where n specifies the number of rows (64 bytes) to delete\0A\00"
@.str.12 = [68 x i8] c"\09and x the hexadecimal start address for the delete with 0x prefix\0A\00"
@.str.13 = [54 x i8] c"\09 eg: %s --eraseflash --rows 3 --startaddr 0x01320\0A\0A\00"
@.str.14 = [32 x i8] c"\0ATo reset PIC via bootloader: \0A\00"
@.str.15 = [20 x i8] c"\09usage: %s --reset\0A\00"
@.str.16 = [30 x i8] c"To read from EEPROM Memory: \0A\00"
@.str.17 = [53 x i8] c"\09usage: %s --readeeprom --bytes <n> --startaddr <x>\0A\00"
@.str.18 = [48 x i8] c"\09where n specifies the number of bytes to read\0A\00"
@.str.19 = [54 x i8] c"\09 eg: %s --readeeprom ---bytes 16 --startaddr 0x80\0A\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.3, i64 0, i64 0))
%8 = load i8*, i8** %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.4, i64 0, i64 0), i8* %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%11 = load i8*, i8** %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0), i8* %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str.7, i64 0, i64 0))
%14 = load i8*, i8** %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0), i8* %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0))
%17 = load i8*, i8** %2
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.10, i64 0, i64 0), i8* %17)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.11, i64 0, i64 0))
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.12, i64 0, i64 0))
%21 = load i8*, i8** %2
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.13, i64 0, i64 0), i8* %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.14, i64 0, i64 0))
%24 = load i8*, i8** %2
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0), i8* %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.16, i64 0, i64 0))
%27 = load i8*, i8** %2
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.17, i64 0, i64 0), i8* %27)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.18, i64 0, i64 0))
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.3, i64 0, i64 0))
%31 = load i8*, i8** %2
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.19, i64 0, i64 0), i8* %31)
%33 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@.str.1 = [52 x i8] c"\09usage: %s --readflash --bytes <n> --startaddr <x>\0A\00"
@.str.4 = [56 x i8] c"\09 eg: %s --readflash --bytes 100 --startaddr 0x01320\0A\0A\00"
@.str.6 = [46 x i8] c"\09usage: %s --writeflash --hexfile <filename>\0A\00"
@.str.8 = [44 x i8] c"\09 eg: %s --writeflash --hexfile test.hex\0A\0A\00"
@.str.10 = [52 x i8] c"\09usage: %s --eraseflash --rows <n> --startaddr <x>\0A\00"
@.str.13 = [54 x i8] c"\09 eg: %s --eraseflash --rows 3 --startaddr 0x01320\0A\0A\00"
@.str.15 = [20 x i8] c"\09usage: %s --reset\0A\00"
@.str.17 = [53 x i8] c"\09usage: %s --readeeprom --bytes <n> --startaddr <x>\0A\00"
@.str.19 = [54 x i8] c"\09 eg: %s --readeeprom ---bytes 16 --startaddr 0x80\0A\0A\00"
@str = [28 x i8] c"To read from flash Memory: \00"
@str.20 = [57 x i8] c"\09where n specifies the number of bytes to read (max 251)\00"
@str.22 = [28 x i8] c"\0ATo write to flash Memory: \00"
@str.23 = [84 x i8] c"\09where filename specifies the hexfile that contains the code to be burned to memory\00"
@str.24 = [28 x i8] c"\0ATo erase to flash Memory: \00"
@str.25 = [59 x i8] c"\09where n specifies the number of rows (64 bytes) to delete\00"
@str.26 = [67 x i8] c"\09and x the hexadecimal start address for the delete with 0x prefix\00"
@str.27 = [31 x i8] c"\0ATo reset PIC via bootloader: \00"
@str.28 = [29 x i8] c"To read from EEPROM Memory: \00"
@str.29 = [47 x i8] c"\09where n specifies the number of bytes to read\00"
@str.30 = [65 x i8] c"\09and x the hexadecimal start address for the read with 0x prefix\00"
define void @usage(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str.20, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @str.30, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.4, i64 0, i64 0), i8* %0)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.22, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0), i8* %0)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([84 x i8], [84 x i8]* @str.23, i64 0, i64 0))
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0), i8* %0)
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.24, i64 0, i64 0))
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.10, i64 0, i64 0), i8* %0)
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.25, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @str.26, i64 0, i64 0))
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.13, i64 0, i64 0), i8* %0)
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.27, i64 0, i64 0))
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0), i8* %0)
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.28, i64 0, i64 0))
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.17, i64 0, i64 0), i8* %0)
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.29, i64 0, i64 0))
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @str.30, i64 0, i64 0))
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.19, i64 0, i64 0), i8* %0)
%23 = tail call i32 @exit(i32 -1)
unreachable
}