#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void print_usage(void) {
  fprintf(stderr, "usage: dgfirmware [<opts>] <img>\n");
  fprintf(stderr, "  <img>               firmware image filename\n");
  fprintf(stderr, "  <opts>  -h          print this message\n");
  fprintf(stderr, "          -f          fix the checksum\n");
  fprintf(stderr, "          -x  <file>  extract the rootfs file to <file>\n");
  fprintf(stderr, "          -xk <file>  extract the kernel to <file>\n");
  fprintf(stderr, "          -m  <file>  merge in rootfs fil\e from <file>\n");
  fprintf(stderr, "          -k  <file>  merge in kernel from <file>\n");
  fprintf(stderr, "          -w  <file>  write back the modified firmware\n");
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
lea    0xee9(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
lea    0xf03(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
lea    0xf18(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
lea    0xf2b(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e5c(%rip),%rax
mov    (%rax),%edi
lea    0xf4f(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e47(%rip),%rax
mov    (%rax),%edi
lea    0xf6e(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e32(%rip),%rax
mov    (%rax),%edi
lea    0xf91(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e1d(%rip),%rax
mov    (%rax),%edi
lea    0xfaf(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
push   %rbx
mov    0x2ec8(%rip),%rbx
mov    (%rbx),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xef3(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf14(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf30(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf4a(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf75(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf9b(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xfc5(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xfea(%rip),%rsi
pop    %rbx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"usage: dgfirmware [<opts>] <img>\0A\00"
@.str.1 = [47 x i8] c" <img> firmware image filename\0A\00"
@.str.2 = [42 x i8] c" <opts> -h print this message\0A\00"
@.str.3 = [40 x i8] c" -f fix the checksum\0A\00"
@.str.4 = [57 x i8] c" -x <file> extract the rootfs file to <file>\0A\00"
@.str.5 = [52 x i8] c" -xk <file> extract the kernel to <file>\0A\00"
@.str.6 = [56 x i8] c" -m <file> merge in rootfs fil\1B from <file>\0A\00"
@.str.7 = [51 x i8] c" -k <file> merge in kernel from <file>\0A\00"
@.str.8 = [56 x i8] c" -w <file> write back the modified firmware\0A\00"
define void @print_usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0))
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.4, i64 0, i64 0))
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0))
%13 = load i32, i32* @stderr
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.6, i64 0, i64 0))
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.7, i64 0, i64 0))
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.8, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"usage: dgfirmware [<opts>] <img>\0A\00"
@.str.1 = [47 x i8] c" <img> firmware image filename\0A\00"
@.str.2 = [42 x i8] c" <opts> -h print this message\0A\00"
@.str.3 = [40 x i8] c" -f fix the checksum\0A\00"
@.str.4 = [57 x i8] c" -x <file> extract the rootfs file to <file>\0A\00"
@.str.5 = [52 x i8] c" -xk <file> extract the kernel to <file>\0A\00"
@.str.6 = [56 x i8] c" -m <file> merge in rootfs fil\1B from <file>\0A\00"
@.str.7 = [51 x i8] c" -k <file> merge in kernel from <file>\0A\00"
@.str.8 = [56 x i8] c" -w <file> write back the modified firmware\0A\00"
define void @print_usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0))
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.4, i64 0, i64 0))
%11 = load i32, i32* @stderr
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0))
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.6, i64 0, i64 0))
%15 = load i32, i32* @stderr
%16 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.7, i64 0, i64 0))
%17 = load i32, i32* @stderr
%18 = tail call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.8, i64 0, i64 0))
ret void
}