#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*/ shell_output(char *, char *);
void help(char *str) {
  shell_output("Available commands:", "");
  shell_output("stats   - show network statistics", "");
  shell_output("conn    - show TCP connections", "");
  shell_output("help, ? - show help", "");
  shell_output("exit    - exit shell", "");
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
lea    0xee9(%rip),%rsi
call   1030 <shell_output@plt>
lea    0xede(%rip),%rdi
lea    0xed6(%rip),%rsi
call   1030 <shell_output@plt>
lea    0xeed(%rip),%rdi
lea    0xec3(%rip),%rsi
call   1030 <shell_output@plt>
lea    0xef9(%rip),%rdi
lea    0xeb0(%rip),%rsi
call   1030 <shell_output@plt>
lea    0xefa(%rip),%rdi
lea    0xe9d(%rip),%rsi
call   1030 <shell_output@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<help>:
push   %rbx
lea    0xee8(%rip),%rdi
lea    0xef4(%rip),%rbx
mov    %rbx,%rsi
call   1030 <shell_output@plt>
lea    0xee6(%rip),%rdi
mov    %rbx,%rsi
call   1030 <shell_output@plt>
lea    0xef9(%rip),%rdi
mov    %rbx,%rsi
call   1030 <shell_output@plt>
lea    0xf09(%rip),%rdi
mov    %rbx,%rsi
call   1030 <shell_output@plt>
lea    0xf0e(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <shell_output@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"Available commands:\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [34 x i8] c"stats - show network statistics\00"
@.str.3 = [31 x i8] c"conn - show TCP connections\00"
@.str.4 = [20 x i8] c"help, ? - show help\00"
@.str.5 = [21 x i8] c"exit - exit shell\00"
define void @help(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @shell_output(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @shell_output(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @shell_output(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @shell_output(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @shell_output(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"Available commands:\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [34 x i8] c"stats - show network statistics\00"
@.str.3 = [31 x i8] c"conn - show TCP connections\00"
@.str.4 = [20 x i8] c"help, ? - show help\00"
@.str.5 = [21 x i8] c"exit - exit shell\00"
define void @help(i8* nocapture readnone %0) {
%2 = tail call i32 @shell_output(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @shell_output(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @shell_output(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @shell_output(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @shell_output(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
ret void
}