#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 *, char const *);
int /*<<< orphan*/ puts(char *);
int usage(const char *name) {
  printf("Usage: %s [ -v | -h ] [ -d tr ] [ -m {c123,c155} ] [ -l "
         "/tmp/osmocom_loader ] COMMAND ...\n",
         name);
  puts("\n  Memory commands:");
  puts("    memget <hex-address> <hex-length>        - Peek at memory");
  puts("    memput <hex-address> <hex-bytes>         - Poke at memory");
  puts("    memdump <hex-address> <hex-length> <file>- Dump memory to file");
  puts("    memload <hex-address> <file>             - Load file into memory");
  puts("\n  Flash commands:");
  puts("    finfo                             - Information about flash chips");
  puts("    funlock <address> <length>        - Unlock flash block");
  puts("    flock <address> <length>          - Lock flash block");
  puts("    flockdown <address> <length>      - Lock down flash block");
  puts("    fgetlock <address> <length>       - Get locking state of block");
  puts("    ferase <address> <length>         - Erase flash range");
  puts("    fprogram <chip> <address> <file>  - Program file into flash");
  puts("\n  Execution commands:");
  puts("    jump <hex-address>                 - Jump to address");
  puts("    jumpflash                          - Jump to flash loader");
  puts("    jumprom                            - Jump to rom loader");
  puts("\n  Device lifecycle:");
  puts("    ping                               - Ping the loader");
  puts("    reset                              - Reset device");
  puts("    off                                - Power off device");
  puts("\n  Debug:");
  puts("    dump                               - Dump loader traffic to "
       "console");
  exit(2);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
lea    0xf08(%rip),%rdi
call   1030 <puts@plt>
lea    0xf10(%rip),%rdi
call   1030 <puts@plt>
lea    0xf42(%rip),%rdi
call   1030 <puts@plt>
lea    0xf74(%rip),%rdi
call   1030 <puts@plt>
lea    0xfab(%rip),%rdi
call   1030 <puts@plt>
lea    0xfe4(%rip),%rdi
call   1030 <puts@plt>
lea    0xfeb(%rip),%rdi
call   1030 <puts@plt>
lea    0x1025(%rip),%rdi
call   1030 <puts@plt>
lea    0x1054(%rip),%rdi
call   1030 <puts@plt>
lea    0x1081(%rip),%rdi
call   1030 <puts@plt>
lea    0x10b3(%rip),%rdi
call   1030 <puts@plt>
lea    0x10ea(%rip),%rdi
call   1030 <puts@plt>
lea    0x1118(%rip),%rdi
call   1030 <puts@plt>
lea    0x114c(%rip),%rdi
call   1030 <puts@plt>
lea    0x1157(%rip),%rdi
call   1030 <puts@plt>
lea    0x1184(%rip),%rdi
call   1030 <puts@plt>
lea    0x11b6(%rip),%rdi
call   1030 <puts@plt>
lea    0x11e6(%rip),%rdi
call   1030 <puts@plt>
lea    0x11ef(%rip),%rdi
call   1030 <puts@plt>
lea    0x121c(%rip),%rdi
call   1030 <puts@plt>
lea    0x1246(%rip),%rdi
call   1030 <puts@plt>
lea    0x1274(%rip),%rdi
call   1030 <puts@plt>
lea    0x1272(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rsi
lea    0xec5(%rip),%rdi
call   1040 <printf@plt>
lea    0xf14(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1c(%rip),%rdi
call   1030 <puts@plt>
lea    0xf4e(%rip),%rdi
call   1030 <puts@plt>
lea    0xf80(%rip),%rdi
call   1030 <puts@plt>
lea    0xfb7(%rip),%rdi
call   1030 <puts@plt>
lea    0xff0(%rip),%rdi
call   1030 <puts@plt>
lea    0xff7(%rip),%rdi
call   1030 <puts@plt>
lea    0x1031(%rip),%rdi
call   1030 <puts@plt>
lea    0x1060(%rip),%rdi
call   1030 <puts@plt>
lea    0x108d(%rip),%rdi
call   1030 <puts@plt>
lea    0x10bf(%rip),%rdi
call   1030 <puts@plt>
lea    0x10f6(%rip),%rdi
call   1030 <puts@plt>
lea    0x1124(%rip),%rdi
call   1030 <puts@plt>
lea    0x1158(%rip),%rdi
call   1030 <puts@plt>
lea    0x1163(%rip),%rdi
call   1030 <puts@plt>
lea    0x1190(%rip),%rdi
call   1030 <puts@plt>
lea    0x11c2(%rip),%rdi
call   1030 <puts@plt>
lea    0x11f2(%rip),%rdi
call   1030 <puts@plt>
lea    0x11fb(%rip),%rdi
call   1030 <puts@plt>
lea    0x1228(%rip),%rdi
call   1030 <puts@plt>
lea    0x1252(%rip),%rdi
call   1030 <puts@plt>
lea    0x1280(%rip),%rdi
call   1030 <puts@plt>
lea    0x127e(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [91 x i8] c"Usage: %s [ -v | -h ] [ -d tr ] [ -m {c123,c155} ] [ -l /tmp/osmocom_loader ] COMMAND ...\0A\00"
@.str.1 = [20 x i8] c"\0A Memory commands:\00"
@.str.2 = [62 x i8] c" memget <hex-address> <hex-length> - Peek at memory\00"
@.str.3 = [62 x i8] c" memput <hex-address> <hex-bytes> - Poke at memory\00"
@.str.4 = [67 x i8] c" memdump <hex-address> <hex-length> <file>- Dump memory to file\00"
@.str.5 = [69 x i8] c" memload <hex-address> <file> - Load file into memory\00"
@.str.6 = [19 x i8] c"\0A Flash commands:\00"
@.str.7 = [70 x i8] c" finfo - Information about flash chips\00"
@.str.8 = [59 x i8] c" funlock <address> <length> - Unlock flash block\00"
@.str.9 = [57 x i8] c" flock <address> <length> - Lock flash block\00"
@.str.10 = [62 x i8] c" flockdown <address> <length> - Lock down flash block\00"
@.str.11 = [67 x i8] c" fgetlock <address> <length> - Get locking state of block\00"
@.str.12 = [58 x i8] c" ferase <address> <length> - Erase flash range\00"
@.str.13 = [64 x i8] c" fprogram <chip> <address> <file> - Program file into flash\00"
@.str.14 = [23 x i8] c"\0A Execution commands:\00"
@.str.15 = [57 x i8] c" jump <hex-address> - Jump to address\00"
@.str.16 = [62 x i8] c" jumpflash - Jump to flash loader\00"
@.str.17 = [60 x i8] c" jumprom - Jump to rom loader\00"
@.str.18 = [21 x i8] c"\0A Device lifecycle:\00"
@.str.19 = [57 x i8] c" ping - Ping the loader\00"
@.str.20 = [54 x i8] c" reset - Reset device\00"
@.str.21 = [58 x i8] c" off - Power off device\00"
@.str.22 = [10 x i8] c"\0A Debug:\00"
@.str.23 = [72 x i8] c" dump - Dump loader traffic to console\00"
define i32 @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @puts(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @puts(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @puts(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @puts(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%11 = call i32 @puts(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.7, i64 0, i64 0))
%12 = call i32 @puts(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.8, i64 0, i64 0))
%13 = call i32 @puts(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.9, i64 0, i64 0))
%14 = call i32 @puts(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.10, i64 0, i64 0))
%15 = call i32 @puts(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.11, i64 0, i64 0))
%16 = call i32 @puts(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.12, i64 0, i64 0))
%17 = call i32 @puts(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.13, i64 0, i64 0))
%18 = call i32 @puts(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0))
%19 = call i32 @puts(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.15, i64 0, i64 0))
%20 = call i32 @puts(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.16, i64 0, i64 0))
%21 = call i32 @puts(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.17, i64 0, i64 0))
%22 = call i32 @puts(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.18, i64 0, i64 0))
%23 = call i32 @puts(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.19, i64 0, i64 0))
%24 = call i32 @puts(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.20, i64 0, i64 0))
%25 = call i32 @puts(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.21, i64 0, i64 0))
%26 = call i32 @puts(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.22, i64 0, i64 0))
%27 = call i32 @puts(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.23, i64 0, i64 0))
%28 = call i32 @exit(i32 2)
unreachable
}

LLVM IR (-O2):
@.str = [91 x i8] c"Usage: %s [ -v | -h ] [ -d tr ] [ -m {c123,c155} ] [ -l /tmp/osmocom_loader ] COMMAND ...\0A\00"
@.str.1 = [20 x i8] c"\0A Memory commands:\00"
@.str.2 = [62 x i8] c" memget <hex-address> <hex-length> - Peek at memory\00"
@.str.3 = [62 x i8] c" memput <hex-address> <hex-bytes> - Poke at memory\00"
@.str.4 = [67 x i8] c" memdump <hex-address> <hex-length> <file>- Dump memory to file\00"
@.str.5 = [69 x i8] c" memload <hex-address> <file> - Load file into memory\00"
@.str.6 = [19 x i8] c"\0A Flash commands:\00"
@.str.7 = [70 x i8] c" finfo - Information about flash chips\00"
@.str.8 = [59 x i8] c" funlock <address> <length> - Unlock flash block\00"
@.str.9 = [57 x i8] c" flock <address> <length> - Lock flash block\00"
@.str.10 = [62 x i8] c" flockdown <address> <length> - Lock down flash block\00"
@.str.11 = [67 x i8] c" fgetlock <address> <length> - Get locking state of block\00"
@.str.12 = [58 x i8] c" ferase <address> <length> - Erase flash range\00"
@.str.13 = [64 x i8] c" fprogram <chip> <address> <file> - Program file into flash\00"
@.str.14 = [23 x i8] c"\0A Execution commands:\00"
@.str.15 = [57 x i8] c" jump <hex-address> - Jump to address\00"
@.str.16 = [62 x i8] c" jumpflash - Jump to flash loader\00"
@.str.17 = [60 x i8] c" jumprom - Jump to rom loader\00"
@.str.18 = [21 x i8] c"\0A Device lifecycle:\00"
@.str.19 = [57 x i8] c" ping - Ping the loader\00"
@.str.20 = [54 x i8] c" reset - Reset device\00"
@.str.21 = [58 x i8] c" off - Power off device\00"
@.str.22 = [10 x i8] c"\0A Debug:\00"
@.str.23 = [72 x i8] c" dump - Dump loader traffic to console\00"
define i32 @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str.3, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @.str.4, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @.str.5, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @.str.7, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.8, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.9, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str.10, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @.str.11, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.12, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @.str.13, i64 0, i64 0))
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0))
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.15, i64 0, i64 0))
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str.16, i64 0, i64 0))
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.17, i64 0, i64 0))
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.18, i64 0, i64 0))
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.19, i64 0, i64 0))
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.20, i64 0, i64 0))
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.21, i64 0, i64 0))
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.22, i64 0, i64 0))
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @.str.23, i64 0, i64 0))
%26 = tail call i32 @exit(i32 2)
unreachable
}