#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 *basename(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
void usage(char progname[], int exit_status) {
  printf("Usage:\n");
  printf("1) %s -r [-s sleep]\n", basename(progname));
  printf("2) %s -b byte_offset\n", basename(progname));
  printf("3) %s -w byte_offset -v value\n\n", basename(progname));
  puts("\t-r [-s sleep]      : Dump EC registers");
  puts("\t                     If sleep is given, sleep x seconds,");
  puts("\t                     re-read EC registers and show changes");
  puts("\t-b offset          : Read value at byte_offset (in hex)");
  puts("\t-w offset -v value : Write value at byte_offset");
  puts("\t-h                 : Print this help\n\n");
  puts("Offsets and values are in hexadecimal number system.");
  puts("The offset and value must be between 0 and 0xff.");
  exit(exit_status);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1050 <basename@plt>
mov    %rax,%rsi
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1050 <basename@plt>
mov    %rax,%rsi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1050 <basename@plt>
mov    %rax,%rsi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea1(%rip),%rdi
call   1030 <puts@plt>
lea    0xebd(%rip),%rdi
call   1030 <puts@plt>
lea    0xeeb(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1b(%rip),%rdi
call   1030 <puts@plt>
lea    0xf48(%rip),%rdi
call   1030 <puts@plt>
lea    0xf6d(%rip),%rdi
call   1030 <puts@plt>
lea    0xf89(%rip),%rdi
call   1030 <puts@plt>
lea    0xfb2(%rip),%rdi
call   1030 <puts@plt>
mov    -0xc(%rbp),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0x1092(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1050 <basename@plt>
lea    0xe9d(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <basename@plt>
lea    0xe99(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <basename@plt>
lea    0xe96(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea5(%rip),%rdi
call   1030 <puts@plt>
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
lea    0xeef(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1f(%rip),%rdi
call   1030 <puts@plt>
lea    0xf4c(%rip),%rdi
call   1030 <puts@plt>
lea    0xf71(%rip),%rdi
call   1030 <puts@plt>
lea    0xf8d(%rip),%rdi
call   1030 <puts@plt>
lea    0xfb6(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"Usage:\0A\00"
@.str.1 = [21 x i8] c"1) %s -r [-s sleep]\0A\00"
@.str.2 = [22 x i8] c"2) %s -b byte_offset\0A\00"
@.str.3 = [32 x i8] c"3) %s -w byte_offset -v value\0A\0A\00"
@.str.4 = [40 x i8] c"\09-r [-s sleep] : Dump EC registers\00"
@.str.5 = [58 x i8] c"\09 If sleep is given, sleep x seconds,\00"
@.str.6 = [60 x i8] c"\09 re-read EC registers and show changes\00"
@.str.7 = [57 x i8] c"\09-b offset : Read value at byte_offset (in hex)\00"
@.str.8 = [49 x i8] c"\09-w offset -v value : Write value at byte_offset\00"
@.str.9 = [40 x i8] c"\09-h : Print this help\0A\0A\00"
@.str.10 = [53 x i8] c"Offsets and values are in hexadecimal number system.\00"
@.str.11 = [49 x i8] c"The offset and value must be between 0 and 0xff.\00"
define void @usage(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%6 = load i8*, i8** %3
%7 = call i8* @basename(i8* %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = load i8*, i8** %3
%10 = call i8* @basename(i8* %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %10)
%12 = load i8*, i8** %3
%13 = call i8* @basename(i8* %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8* %13)
%15 = call i32 @puts(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 @puts(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.5, i64 0, i64 0))
%17 = call i32 @puts(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.6, i64 0, i64 0))
%18 = call i32 @puts(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.7, i64 0, i64 0))
%19 = call i32 @puts(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.8, i64 0, i64 0))
%20 = call i32 @puts(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.9, i64 0, i64 0))
%21 = call i32 @puts(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.10, i64 0, i64 0))
%22 = call i32 @puts(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.11, i64 0, i64 0))
%23 = load i32, i32* %4
%24 = call i32 @exit(i32 %23)
unreachable
}

LLVM IR (-O2):
@.str.1 = [21 x i8] c"1) %s -r [-s sleep]\0A\00"
@.str.2 = [22 x i8] c"2) %s -b byte_offset\0A\00"
@.str.3 = [32 x i8] c"3) %s -w byte_offset -v value\0A\0A\00"
@.str.4 = [40 x i8] c"\09-r [-s sleep] : Dump EC registers\00"
@.str.5 = [58 x i8] c"\09 If sleep is given, sleep x seconds,\00"
@.str.6 = [60 x i8] c"\09 re-read EC registers and show changes\00"
@.str.7 = [57 x i8] c"\09-b offset : Read value at byte_offset (in hex)\00"
@.str.8 = [49 x i8] c"\09-w offset -v value : Write value at byte_offset\00"
@.str.9 = [40 x i8] c"\09-h : Print this help\0A\0A\00"
@.str.10 = [53 x i8] c"Offsets and values are in hexadecimal number system.\00"
@.str.11 = [49 x i8] c"The offset and value must be between 0 and 0xff.\00"
@str = [7 x i8] c"Usage:\00"
define void @usage(i8* %0, i32 %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%4 = tail call i8* @basename(i8* %0)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = tail call i8* @basename(i8* %0)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%8 = tail call i8* @basename(i8* %0)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8* %8)
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.5, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.6, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.7, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.8, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.9, i64 0, i64 0))
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.10, i64 0, i64 0))
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.11, i64 0, i64 0))
%18 = tail call i32 @exit(i32 %1)
unreachable
}