#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*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *);
void ktest_usage(FILE *out) {
  static const char usage_str[] =
      ("Usage:\n  ktest [options] [function] devices\n\n"
       "Functions:\n"
       "  -r | --read       read from device (read)\n"
       "  -w | --write      write to device (write)\n"
       "  -p | --poll       poll devices (poll)\n"
       "  -i | --info       show devices info (ioctl)\n\n"
       "Options:\n"
       "  -b | --nonblock   open devices in non-blocking mode\n"
       "  -n | --nonewline  do not write the trailing newline\n"
       "  -v | --version    show the program version and exit\n"
       "  -h | --help       show this help and exit\n\n"
       "Examples:\n"
       "  ktest -b -r /dev/kbuf0\n"
       "  ktest -n -w \"something new\" /dev/kbuf0\n"
       "  ktest -i /dev/kbuf0 /dev/kbuf2\n"
       "  ktest -p /dev/kbuf*\n\n");
  fprintf(out, "%s", usage_str);
  fflush(out);
  return;
}


x86 assembly (clang, -O0):
<ktest_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0x110d(%rip),%rsi
lea    0xec2(%rip),%rdx
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ktest_usage>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
mov    $0x243,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <fflush@plt>

LLVM IR (-O0):
@ktest_usage.usage_str = internal constant [580 x i8] c"Usage:\0A ktest [options] [function] devices\0A\0AFunctions:\0A -r | --read read from device (read)\0A -w | --write write to device (write)\0A -p | --poll poll devices (poll)\0A -i | --info show devices info (ioctl)\0A\0AOptions:\0A -b | --nonblock open devices in non-blocking mode\0A -n | --nonewline do not write the trailing newline\0A -v | --version show the program version and exit\0A -h | --help show this help and exit\0A\0AExamples:\0A ktest -b -r /dev/kbuf0\0A ktest -n -w \22something new\22 /dev/kbuf0\0A ktest -i /dev/kbuf0 /dev/kbuf2\0A ktest -p /dev/kbuf*\0A\0A\00"
@.str = [3 x i8] c"%s\00"
define void @ktest_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 ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([580 x i8], [580 x i8]* @ktest_usage.usage_str, i64 0, i64 0))
%5 = load i32*, i32** %2
%6 = call i32 @fflush(i32* %5)
ret void
}

LLVM IR (-O2):
@ktest_usage.usage_str = internal constant [580 x i8] c"Usage:\0A ktest [options] [function] devices\0A\0AFunctions:\0A -r | --read read from device (read)\0A -w | --write write to device (write)\0A -p | --poll poll devices (poll)\0A -i | --info show devices info (ioctl)\0A\0AOptions:\0A -b | --nonblock open devices in non-blocking mode\0A -n | --nonewline do not write the trailing newline\0A -v | --version show the program version and exit\0A -h | --help show this help and exit\0A\0AExamples:\0A ktest -b -r /dev/kbuf0\0A ktest -n -w \22something new\22 /dev/kbuf0\0A ktest -i /dev/kbuf0 /dev/kbuf2\0A ktest -p /dev/kbuf*\0A\0A\00"
define void @ktest_usage(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([580 x i8], [580 x i8]* @ktest_usage.usage_str, i64 0, i64 0), i64 579, i64 1, i32* %0)
%3 = tail call i32 @fflush(i32* %0)
ret void
}