#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 */
char *libbootimg_version_str();
int /*<<< orphan*/ printf(char *, char *, char const *, char const *,
                          char const *, char const *, char const *,
                          char const *);
void print_help(const char *prog_name) {
  printf(
      "bbootimg %s\n"
      "Manipulate Android Boot Images.\n"
      "This is abootimg-compatible implementation using libbootimg.\n"
      "\n"
      "%s [-h,--help]     - print usage\n"
      "\n"
      "%s -i <bootimg>    - print image information\n"
      "\n"
      "%s -j <bootimg>    - print image information in JSON\n"
      "\n"
      "%s -x <bootimg> [<bootimg.cfg> [<kernel> [<ramdisk> [<secondstage> "
      "[<dtb>]]]]]\n"
      "    extract objects from boot image:\n"
      "    - config file (bootimg.cfg)\n"
      "    - kernel image (zImage)\n"
      "    - ramdisk image (initrd.img)\n"
      "    - second stage image (stage2.img)\n"
      "\n"
      "%s -u <bootimg> [-c \"param=value\"] [-f <bootimg.cfg>] [-k <kernel>] "
      "[-r <ramdisk>] [-s <secondstage>] [-d <dtb> ] [-m]\n"
      "    update current boot image with objects given in command line\n"
      "    - header informations given in arguments (several can be provided)\n"
      "    - header informations given in config file\n"
      "    - kernel image\n"
      "    - ramdisk image\n"
      "    - second stage image\n"
      "    - device tree blob\n"
      "    - -m means that bootsize is used as \"maximum\", i.e. the image "
      "will not be padded with 0 to this size\n"
      "\n"
      "%s --create <bootimg> [-c \"param=value\"] [-f <bootimg.cfg>] -k "
      "<kernel> -r <ramdisk> [-s <secondstage>] [-d <dtb> ] [-m]\n"
      "    create a new image from scratch.\n"
      "    arguments are the same as for -u.\n"
      "    kernel and ramdisk are mandatory.\n"
      "\n"
      "Config params:\n"
      "    bootsize = 0x1234                   - target size in B, image will "
      "always be this big  unless -m is used (0 means ignore)\n"
      "    pagesize = 0x1234                   - Page size in bytes\n"
      "    kerneladdr = 0x1234                 - kernel load address\n"
      "    ramdiskaddr = 0x1234                - ramdisk load address\n"
      "    secondaddr = 0x1234                 - 2nd stage load address\n"
      "    tagsaddr = 0x1234                   - atags address\n"
      "    name = string without quotes        - name of the image, max 16 "
      "characters\n"
      "    cmdline = string without quotes     - cmdline, max 512 characters\n",
      libbootimg_version_str(), prog_name, prog_name, prog_name, prog_name,
      prog_name, prog_name);
}


x86 assembly (clang, -O0):
<print_help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <libbootimg_version_str@plt>
mov    %rax,%rsi
mov    -0x8(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    -0x8(%rbp),%r8
mov    -0x8(%rbp),%r9
mov    -0x8(%rbp),%r10
mov    -0x8(%rbp),%rax
lea    0xeab(%rip),%rdi
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_help>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <libbootimg_version_str@plt>
lea    0xece(%rip),%rdi
mov    %rax,%rsi
mov    %rbx,%rdx
mov    %rbx,%rcx
mov    %rbx,%r8
mov    %rbx,%r9
push   %rbx
push   %rbx
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [1816 x i8] c"bbootimg %s\0AManipulate Android Boot Images.\0AThis is abootimg-compatible implementation using libbootimg.\0A\0A%s [-h,--help] - print usage\0A\0A%s -i <bootimg> - print image information\0A\0A%s -j <bootimg> - print image information in JSON\0A\0A%s -x <bootimg> [<bootimg.cfg> [<kernel> [<ramdisk> [<secondstage> [<dtb>]]]]]\0A extract objects from boot image:\0A - config file (bootimg.cfg)\0A - kernel image (zImage)\0A - ramdisk image (initrd.img)\0A - second stage image (stage2.img)\0A\0A%s -u <bootimg> [-c \22param=value\22] [-f <bootimg.cfg>] [-k <kernel>] [-r <ramdisk>] [-s <secondstage>] [-d <dtb> ] [-m]\0A update current boot image with objects given in command line\0A - header informations given in arguments (several can be provided)\0A - header informations given in config file\0A - kernel image\0A - ramdisk image\0A - second stage image\0A - device tree blob\0A - -m means that bootsize is used as \22maximum\22, i.e. the image will not be padded with 0 to this size\0A\0A%s --create <bootimg> [-c \22param=value\22] [-f <bootimg.cfg>] -k <kernel> -r <ramdisk> [-s <secondstage>] [-d <dtb> ] [-m]\0A create a new image from scratch.\0A arguments are the same as for -u.\0A kernel and ramdisk are mandatory.\0A\0AConfig params:\0A bootsize = 0x1234 - target size in B, image will always be this big unless -m is used (0 means ignore)\0A pagesize = 0x1234 - Page size in bytes\0A kerneladdr = 0x1234 - kernel load address\0A ramdiskaddr = 0x1234 - ramdisk load address\0A secondaddr = 0x1234 - 2nd stage load address\0A tagsaddr = 0x1234 - atags address\0A name = string without quotes - name of the image, max 16 characters\0A cmdline = string without quotes - cmdline, max 512 characters\0A\00"
define void @print_help(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i8* (...) @libbootimg_version_str()
%4 = load i8*, i8** %2
%5 = load i8*, i8** %2
%6 = load i8*, i8** %2
%7 = load i8*, i8** %2
%8 = load i8*, i8** %2
%9 = load i8*, i8** %2
%10 = call i32 @printf(i8* getelementptr inbounds ([1816 x i8], [1816 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %4, i8* %5, i8* %6, i8* %7, i8* %8, i8* %9)
ret void
}

LLVM IR (-O2):
@.str = [1816 x i8] c"bbootimg %s\0AManipulate Android Boot Images.\0AThis is abootimg-compatible implementation using libbootimg.\0A\0A%s [-h,--help] - print usage\0A\0A%s -i <bootimg> - print image information\0A\0A%s -j <bootimg> - print image information in JSON\0A\0A%s -x <bootimg> [<bootimg.cfg> [<kernel> [<ramdisk> [<secondstage> [<dtb>]]]]]\0A extract objects from boot image:\0A - config file (bootimg.cfg)\0A - kernel image (zImage)\0A - ramdisk image (initrd.img)\0A - second stage image (stage2.img)\0A\0A%s -u <bootimg> [-c \22param=value\22] [-f <bootimg.cfg>] [-k <kernel>] [-r <ramdisk>] [-s <secondstage>] [-d <dtb> ] [-m]\0A update current boot image with objects given in command line\0A - header informations given in arguments (several can be provided)\0A - header informations given in config file\0A - kernel image\0A - ramdisk image\0A - second stage image\0A - device tree blob\0A - -m means that bootsize is used as \22maximum\22, i.e. the image will not be padded with 0 to this size\0A\0A%s --create <bootimg> [-c \22param=value\22] [-f <bootimg.cfg>] -k <kernel> -r <ramdisk> [-s <secondstage>] [-d <dtb> ] [-m]\0A create a new image from scratch.\0A arguments are the same as for -u.\0A kernel and ramdisk are mandatory.\0A\0AConfig params:\0A bootsize = 0x1234 - target size in B, image will always be this big unless -m is used (0 means ignore)\0A pagesize = 0x1234 - Page size in bytes\0A kerneladdr = 0x1234 - kernel load address\0A ramdiskaddr = 0x1234 - ramdisk load address\0A secondaddr = 0x1234 - 2nd stage load address\0A tagsaddr = 0x1234 - atags address\0A name = string without quotes - name of the image, max 16 characters\0A cmdline = string without quotes - cmdline, max 512 characters\0A\00"
define void @print_help(i8* %0) {
%2 = tail call i8* (...) @libbootimg_version_str()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([1816 x i8], [1816 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %0, i8* %0, i8* %0, i8* %0, i8* %0, i8* %0)
ret void
}