#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void usage(FILE *fd) {
  fprintf(fd, "Calvaria - Maemo CAL partition variable access tool\n");
  fprintf(fd, "\n");
  fprintf(fd, "Usage: calvaria [OPTIONS] FILE\n");
  fprintf(fd, "\n");
  fprintf(fd, "Actions:\n");
  fprintf(fd, "  -d|--dump            Dump the contents of the image\n");
  fprintf(fd, "  -H|--headers         Dump the headers of the image, only\n");
  fprintf(fd, "  -p|--payload         Write the binary payload to stdout.\n");
  fprintf(fd, "                       Requires -i and -n to be set, too\n");
  fprintf(fd, "\n");
  fprintf(fd, "Options:\n");
  fprintf(fd, "  -i|--index NUMBER    Use this section index number\n");
  fprintf(fd, "  -n|--name STRING     Use this section name\n");
  fprintf(fd, "  -r|--raw             Dump raw data (for -d|--dump only)\n");
  fprintf(fd, "\n");
  fprintf(fd, "  -h|--help            Print this help text\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0x10b8(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xeee(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0x1098(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xeee(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xee8(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf0f(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf3b(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf67(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0x1038(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf81(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf7b(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xfa1(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xfbf(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xfe8(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xfda(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
mov    $0x34,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
lea    0xee4(%rip),%rdi
mov    $0x1f,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
lea    0xede(%rip),%rdi
mov    $0x9,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xecf(%rip),%rdi
mov    $0x36,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xeed(%rip),%rdi
mov    $0x3b,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xf10(%rip),%rdi
mov    $0x3b,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xf33(%rip),%rdi
mov    $0x39,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
lea    0xf47(%rip),%rdi
mov    $0x9,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xf38(%rip),%rdi
mov    $0x35,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xf55(%rip),%rdi
mov    $0x2d,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xf6a(%rip),%rdi
mov    $0x3a,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
lea    0xf7f(%rip),%rdi
mov    $0x2c,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
pop    %rbx
jmp    1040 <fwrite@plt>

LLVM IR (-O0):
@.str = [53 x i8] c"Calvaria - Maemo CAL partition variable access tool\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [32 x i8] c"Usage: calvaria [OPTIONS] FILE\0A\00"
@.str.3 = [10 x i8] c"Actions:\0A\00"
@.str.4 = [55 x i8] c" -d|--dump Dump the contents of the image\0A\00"
@.str.5 = [60 x i8] c" -H|--headers Dump the headers of the image, only\0A\00"
@.str.6 = [60 x i8] c" -p|--payload Write the binary payload to stdout.\0A\00"
@.str.7 = [58 x i8] c" Requires -i and -n to be set, too\0A\00"
@.str.8 = [10 x i8] c"Options:\0A\00"
@.str.9 = [54 x i8] c" -i|--index NUMBER Use this section index number\0A\00"
@.str.10 = [46 x i8] c" -n|--name STRING Use this section name\0A\00"
@.str.11 = [59 x i8] c" -r|--raw Dump raw data (for -d|--dump only)\0A\00"
@.str.12 = [45 x i8] c" -h|--help Print this help text\0A\00"
define void @usage(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%5 = load i32*, i32** %2
%6 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32*, i32** %2
%8 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%9 = load i32*, i32** %2
%10 = call i32 @fprintf(i32* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32*, i32** %2
%12 = call i32 @fprintf(i32* %11, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%13 = load i32*, i32** %2
%14 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.4, i64 0, i64 0))
%15 = load i32*, i32** %2
%16 = call i32 @fprintf(i32* %15, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.5, i64 0, i64 0))
%17 = load i32*, i32** %2
%18 = call i32 @fprintf(i32* %17, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.6, i64 0, i64 0))
%19 = load i32*, i32** %2
%20 = call i32 @fprintf(i32* %19, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.7, i64 0, i64 0))
%21 = load i32*, i32** %2
%22 = call i32 @fprintf(i32* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%23 = load i32*, i32** %2
%24 = call i32 @fprintf(i32* %23, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%25 = load i32*, i32** %2
%26 = call i32 @fprintf(i32* %25, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.9, i64 0, i64 0))
%27 = load i32*, i32** %2
%28 = call i32 @fprintf(i32* %27, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.10, i64 0, i64 0))
%29 = load i32*, i32** %2
%30 = call i32 @fprintf(i32* %29, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.11, i64 0, i64 0))
%31 = load i32*, i32** %2
%32 = call i32 @fprintf(i32* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%33 = load i32*, i32** %2
%34 = call i32 @fprintf(i32* %33, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.12, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [53 x i8] c"Calvaria - Maemo CAL partition variable access tool\0A\00"
@.str.2 = [32 x i8] c"Usage: calvaria [OPTIONS] FILE\0A\00"
@.str.3 = [10 x i8] c"Actions:\0A\00"
@.str.4 = [55 x i8] c" -d|--dump Dump the contents of the image\0A\00"
@.str.5 = [60 x i8] c" -H|--headers Dump the headers of the image, only\0A\00"
@.str.6 = [60 x i8] c" -p|--payload Write the binary payload to stdout.\0A\00"
@.str.7 = [58 x i8] c" Requires -i and -n to be set, too\0A\00"
@.str.8 = [10 x i8] c"Options:\0A\00"
@.str.9 = [54 x i8] c" -i|--index NUMBER Use this section index number\0A\00"
@.str.10 = [46 x i8] c" -n|--name STRING Use this section name\0A\00"
@.str.11 = [59 x i8] c" -r|--raw Dump raw data (for -d|--dump only)\0A\00"
@.str.12 = [45 x i8] c" -h|--help Print this help text\0A\00"
define void @usage(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i64 52, i64 1, i32* %0)
%3 = tail call i32 @fputc(i32 10, i32* %0)
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i64 31, i64 1, i32* %0)
%5 = tail call i32 @fputc(i32 10, i32* %0)
%6 = tail call i64 @fwrite(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i64 9, i64 1, i32* %0)
%7 = tail call i64 @fwrite(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.4, i64 0, i64 0), i64 54, i64 1, i32* %0)
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.5, i64 0, i64 0), i64 59, i64 1, i32* %0)
%9 = tail call i64 @fwrite(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.6, i64 0, i64 0), i64 59, i64 1, i32* %0)
%10 = tail call i64 @fwrite(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.7, i64 0, i64 0), i64 57, i64 1, i32* %0)
%11 = tail call i32 @fputc(i32 10, i32* %0)
%12 = tail call i64 @fwrite(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i64 9, i64 1, i32* %0)
%13 = tail call i64 @fwrite(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.9, i64 0, i64 0), i64 53, i64 1, i32* %0)
%14 = tail call i64 @fwrite(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.10, i64 0, i64 0), i64 45, i64 1, i32* %0)
%15 = tail call i64 @fwrite(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.11, i64 0, i64 0), i64 58, i64 1, i32* %0)
%16 = tail call i32 @fputc(i32 10, i32* %0)
%17 = tail call i64 @fwrite(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.12, i64 0, i64 0), i64 44, i64 1, i32* %0)
ret void
}