// File: /workspace/github_c_makefile_star2_O0/jogolden[P]ps4flashtool/flashtool.c
// Function: print_usage
void print_usage() {
    char strbuffer[1024];

    printf("Usage: flashtool [option(s)]\n");
    printf("Examples:\n");
    printf("\tflashtool -k CXD42G.keys --extract dumps -i flashdump.bin\n");
    printf("\tflashtool --emcipl patchedipl.bin -k CXD44G.keys --input flashdump.bin --output flashout.bin\n");
    printf("\tflashtool --eapkbl patchedkbl.bin -k cec_h4x_sram_dmp_CXD36G.keys --input flashdump.bin --output flashout.bin\n");
    printf("\tflashtool -k CXD42G.keys -v -n --input flashdump.bin\n");
    printf("\tflashtool --extract dumps -n --input flashdump.bin\n");
    printf("\tflashtool --eapkern eapkern_hdd_enc.bin,eapkern_hdd_dec.bin\n");
    printf("Options:\n");

    #define PRINT_OPTION(short, long, hasarg, arg, comment) if(hasarg) { \
                snprintf(strbuffer, sizeof(strbuffer), "\t-%s [%s], --%s [%s]", short, arg, long, arg); \
            } else { \
                snprintf(strbuffer, sizeof(strbuffer), "\t-%s, --%s", short, long); \
            } printf("%s %*s\n", strbuffer, (int)(80 - strlen(strbuffer)), comment);
    #define PRINT_LONG_OPTION(long, hasarg, arg, comment) if(hasarg) { \
                snprintf(strbuffer, sizeof(strbuffer), "\t--%s [%s]", long, arg); \
            } else { \
                snprintf(strbuffer, sizeof(strbuffer), "\t--%s", long); \
            } printf("%s %*s\n", strbuffer, (int)(80 - strlen(strbuffer)), comment);

    PRINT_OPTION("h", "help", 0, "", "show this help message")
    PRINT_OPTION("v", "verbose", 0, "", "verbose output")
    PRINT_OPTION("i", "input", 1, "flash", "flash file input")
    PRINT_OPTION("o", "output", 1, "flash", "flash file output")
    PRINT_OPTION("n", "noverify", 0, "", "do not verify the flash signatures")
    PRINT_OPTION("k", "keyfile", 0, "", "override the default key file")
    PRINT_LONG_OPTION("extract", 1, "dir", "extract files to directory")
    PRINT_LONG_OPTION("rawextract", 1, "dir", "raw extract files to directory")
    PRINT_LONG_OPTION("emcipl", 1, "emcipl", "replace EMC IPL (initial program loader)")
    PRINT_LONG_OPTION("eapkbl", 1, "eapkbl", "replace EAP KBL (kernel boot loader)")
    PRINT_LONG_OPTION("eapkern", 1, "input,output", "decrypt the EAP kernel")

    printf("\n");
    printf("Everything you can replace in the flash is resigned when you replace it.\n");
    printf("Also, when the extract option is enabled, the files will be extracted after the replacement/resigning.\n");
    printf("!! This tool will never overwrite your existing flash dump file! You must specify an output. !!\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x460, %rsp            # imm = 0x460
leaq 0x67ff(%rip), %rdi      # 0xc661
movb $0x0, %al
callq 0x2080
leaq 0x680f(%rip), %rdi      # 0xc67f
movb $0x0, %al
callq 0x2080
leaq 0x680c(%rip), %rdi      # 0xc68a
movb $0x0, %al
callq 0x2080
leaq 0x683a(%rip), %rdi      # 0xc6c6
movb $0x0, %al
callq 0x2080
leaq 0x688b(%rip), %rdi      # 0xc725
movb $0x0, %al
callq 0x2080
leaq 0x68ed(%rip), %rdi      # 0xc795
movb $0x0, %al
callq 0x2080
leaq 0x6916(%rip), %rdi      # 0xc7cc
movb $0x0, %al
callq 0x2080
leaq 0x693d(%rip), %rdi      # 0xc801
movb $0x0, %al
callq 0x2080
leaq 0x696d(%rip), %rdi      # 0xc83f
movb $0x0, %al
callq 0x2080
leaq -0x400(%rbp), %rdi
movl $0x400, %esi            # imm = 0x400
leaq 0x695d(%rip), %rdx      # 0xc849
leaq 0x69b9(%rip), %rcx      # 0xc8ac
leaq 0x695a(%rip), %r8       # 0xc854
movb $0x0, %al
callq 0x2090
leaq -0x400(%rbp), %rax
movq %rax, -0x458(%rbp)
leaq -0x400(%rbp), %rdi
callq 0x2070
movq -0x458(%rbp), %rsi
movq %rax, %rcx
movl $0x50, %eax
subq %rcx, %rax
movl %eax, %edx
leaq 0x6923(%rip), %rdi      # 0xc859
leaq 0x6924(%rip), %rcx      # 0xc861
movb $0x0, %al
callq 0x2080
leaq -0x400(%rbp), %rdi
movl $0x400, %esi            # imm = 0x400
leaq 0x68f2(%rip), %rdx      # 0xc849
leaq 0x691a(%rip), %rcx      # 0xc878
leaq 0x6915(%rip), %r8       # 0xc87a
movb $0x0, %al
callq 0x2090
leaq -0x400(%rbp), %rax
movq %rax, -0x450(%rbp)
leaq -0x400(%rbp), %rdi
callq 0x2070
movq -0x450(%rbp), %rsi
movq %rax, %rcx
movl $0x50, %eax
subq %rcx, %rax
movl %eax, %edx
leaq 0x68b8(%rip), %rdi      # 0xc859
leaq 0x68da(%rip), %rcx      # 0xc882
movb $0x0, %al
callq 0x2080
leaq -0x400(%rbp), %rdi
movl $0x400, %esi            # imm = 0x400
leaq 0x68cf(%rip), %rdx      # 0xc891
leaq 0x68dd(%rip), %rcx      # 0xc8a6
leaq 0x68d8(%rip), %rax      # 0xc8a8
leaq 0x68e2(%rip), %r9       # 0xc8b9
movq %rax, %r8
movq %rax, (%rsp)
movb $0x0, %al
callq 0x2090
leaq -0x400(%rbp), %rax
movq %rax, -0x448(%rbp)
leaq -0x400(%rbp), %rdi
callq 0x2070
movq -0x448(%rbp), %rsi
movq %rax, %rcx
movl $0x50, %eax
subq %rcx, %rax
movl %eax, %edx
leaq 0x683f(%rip), %rdi      # 0xc859
leaq 0x688d(%rip), %rcx      # 0xc8ae
movb $0x0, %al
callq 0x2080
leaq -0x400(%rbp), %rdi
movl $0x400, %esi            # imm = 0x400
leaq 0x6856(%rip), %rdx      # 0xc891
leaq 0x687d(%rip), %rcx      # 0xc8bf
leaq 0x685f(%rip), %rax      # 0xc8a8
leaq 0x687c(%rip), %r9       # 0xc8cc
movq %rax, %r8
movq %rax, (%rsp)
movb $0x0, %al
callq 0x2090
leaq -0x400(%rbp), %rax
movq %rax, -0x440(%rbp)
leaq -0x400(%rbp), %rdi
callq 0x2070
movq -0x440(%rbp), %rsi
movq %rax, %rcx
movl $0x50, %eax
subq %rcx, %rax
movl %eax, %edx
leaq 0x67c6(%rip), %rdi      # 0xc859
leaq 0x6827(%rip), %rcx      # 0xc8c1
movb $0x0, %al
callq 0x2080
leaq -0x400(%rbp), %rdi
movl $0x400, %esi            # imm = 0x400
leaq 0x6795(%rip), %rdx      # 0xc849
leaq 0x6a4a(%rip), %rcx      # 0xcb05
leaq 0x6811(%rip), %r8       # 0xc8d3
movb $0x0, %al
callq 0x2090
leaq -0x400(%rbp), %rax
movq %rax, -0x438(%rbp)
leaq -0x400(%rbp), %rdi
callq 0x2070
movq -0x438(%rbp), %rsi
movq %rax, %rcx
movl $0x50, %eax
subq %rcx, %rax
movl %eax, %edx
leaq 0x675b(%rip), %rdi      # 0xc859
leaq 0x67d7(%rip), %rcx      # 0xc8dc
movb $0x0, %al
callq 0x2080
leaq -0x400(%rbp), %rdi
movl $0x400, %esi            # imm = 0x400
leaq 0x672a(%rip), %rdx      # 0xc849
leaq 0x67d9(%rip), %rcx      # 0xc8ff
leaq 0x67d4(%rip), %r8       # 0xc901
movb $0x0, %al
callq 0x2090
leaq -0x400(%rbp), %rax
movq %rax, -0x430(%rbp)
leaq -0x400(%rbp), %rdi
callq 0x2070
movq -0x430(%rbp), %rsi
movq %rax, %rcx
movl $0x50, %eax
subq %rcx, %rax
movl %eax, %edx
leaq 0x66f0(%rip), %rdi      # 0xc859
leaq 0x6799(%rip), %rcx      # 0xc909
movb $0x0, %al
callq 0x2080
leaq -0x400(%rbp), %rdi
movl $0x400, %esi            # imm = 0x400
leaq 0x679d(%rip), %rdx      # 0xc927
leaq 0x67a8(%rip), %rcx      # 0xc939
leaq 0x679a(%rip), %r8       # 0xc932
movb $0x0, %al
callq 0x2090
leaq -0x400(%rbp), %rax
movq %rax, -0x428(%rbp)
leaq -0x400(%rbp), %rdi
callq 0x2070
movq -0x428(%rbp), %rsi
movq %rax, %rcx
movl $0x50, %eax
subq %rcx, %rax
movl %eax, %edx
leaq 0x6685(%rip), %rdi      # 0xc859
leaq 0x676a(%rip), %rcx      # 0xc945
movb $0x0, %al
callq 0x2080
leaq -0x400(%rbp), %rdi
movl $0x400, %esi            # imm = 0x400
leaq 0x6732(%rip), %rdx      # 0xc927
leaq 0x673a(%rip), %rcx      # 0xc936
leaq 0x672f(%rip), %r8       # 0xc932
movb $0x0, %al
callq 0x2090
leaq -0x400(%rbp), %rax
movq %rax, -0x420(%rbp)
leaq -0x400(%rbp), %rdi
callq 0x2070
movq -0x420(%rbp), %rsi
movq %rax, %rcx
movl $0x50, %eax
subq %rcx, %rax
movl %eax, %edx
leaq 0x661a(%rip), %rdi      # 0xc859
leaq 0x66fb(%rip), %rcx      # 0xc941
movb $0x0, %al
callq 0x2080
leaq -0x400(%rbp), %rdi
movl $0x400, %esi            # imm = 0x400
leaq 0x66c7(%rip), %rdx      # 0xc927
leaq 0x66f9(%rip), %r8       # 0xc960
movq %r8, %rcx
movb $0x0, %al
callq 0x2090
leaq -0x400(%rbp), %rax
movq %rax, -0x418(%rbp)
leaq -0x400(%rbp), %rdi
callq 0x2070
movq -0x418(%rbp), %rsi
movq %rax, %rcx
movl $0x50, %eax
subq %rcx, %rax
movl %eax, %edx
leaq 0x65b3(%rip), %rdi      # 0xc859
leaq 0x66ba(%rip), %rcx      # 0xc967
movb $0x0, %al
callq 0x2080
leaq -0x400(%rbp), %rdi
movl $0x400, %esi            # imm = 0x400
leaq 0x6660(%rip), %rdx      # 0xc927
leaq 0x66c2(%rip), %r8       # 0xc990
movq %r8, %rcx
movb $0x0, %al
callq 0x2090
leaq -0x400(%rbp), %rax
movq %rax, -0x410(%rbp)
leaq -0x400(%rbp), %rdi
callq 0x2070
movq -0x410(%rbp), %rsi
movq %rax, %rcx
movl $0x50, %eax
subq %rcx, %rax
movl %eax, %edx
leaq 0x654c(%rip), %rdi      # 0xc859
leaq 0x6683(%rip), %rcx      # 0xc997
movb $0x0, %al
callq 0x2080
leaq -0x400(%rbp), %rdi
movl $0x400, %esi            # imm = 0x400
leaq 0x65f9(%rip), %rdx      # 0xc927
leaq 0x6687(%rip), %rcx      # 0xc9bc
leaq 0x6688(%rip), %r8       # 0xc9c4
movb $0x0, %al
callq 0x2090
leaq -0x400(%rbp), %rax
movq %rax, -0x408(%rbp)
leaq -0x400(%rbp), %rdi
callq 0x2070
movq -0x408(%rbp), %rsi
movq %rax, %rcx
movl $0x50, %eax
subq %rcx, %rax
movl %eax, %edx
leaq 0x64e1(%rip), %rdi      # 0xc859
leaq 0x6652(%rip), %rcx      # 0xc9d1
movb $0x0, %al
callq 0x2080
leaq 0x676c(%rip), %rdi      # 0xcaf9
movb $0x0, %al
callq 0x2080
leaq 0x664d(%rip), %rdi      # 0xc9e8
movb $0x0, %al
callq 0x2080
leaq 0x6689(%rip), %rdi      # 0xca32
movb $0x0, %al
callq 0x2080
leaq 0x66e3(%rip), %rdi      # 0xca9a
movb $0x0, %al
callq 0x2080
addq $0x460, %rsp            # imm = 0x460
popq %rbp
retq
nopw (%rax,%rax)