#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*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strlen(char const *);
void usage(const char *argv0, const char *msg) {
  if (msg != NULL && strlen(msg) > 0) {
    printf("%s\n\n", msg);
  }
  printf("Usage\n\n");
  printf("%s pipe\n\n", argv0);
  printf("communicate from parent to child via pipe\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1170 <usage+0x40>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
jle    1170 <usage+0x40>
mov    -0x10(%rbp),%rsi
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
test   %rsi,%rsi
je     116d <usage+0x2d>
mov    %rsi,%rbx
mov    %rsi,%rdi
call   1040 <strlen@plt>
test   %rax,%rax
jle    116d <usage+0x2d>
lea    0xe9d(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe9b(%rip),%rdi
call   1030 <puts@plt>
lea    0xe85(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe85(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%s\0A\0A\00"
@.str.1 = [8 x i8] c"Usage\0A\0A\00"
@.str.2 = [10 x i8] c"%s pipe\0A\0A\00"
@.str.3 = [43 x i8] c"communicate from parent to child via pipe\0A\00"
define void @usage(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %14
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = call i64 @strlen(i8* %8)
%10 = icmp sgt i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i8*, i8** %4
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %14
14: ; preds = %11, %7, %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%16 = load i8*, i8** %3
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
%19 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s\0A\0A\00"
@.str.2 = [10 x i8] c"%s pipe\0A\0A\00"
@str = [7 x i8] c"Usage\0A\00"
@str.4 = [42 x i8] c"communicate from parent to child via pipe\00"
define void @usage(i8* %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = tail call i64 @strlen(i8* %1)
%6 = icmp sgt i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %9
9: ; preds = %7, %4, %2
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.4, i64 0, i64 0))
%13 = tail call i32 @exit(i32 1)
unreachable
}