#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ getprogname();
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(int /*<<< orphan*/, char *);
void usage(void) {
  if (strcmp(getprogname(), "groups") == 0) {
    (void)fprintf(stderr, "usage: groups [user]\n");
  } else if (strcmp(getprogname(), "whoami") == 0) {
    (void)fprintf(stderr, "usage: whoami\n");
  } else {
    (void)fprintf(stderr, "usage: id [user]\n");
    (void)fprintf(stderr, "       id -G [-n] [user]\n");
    (void)fprintf(stderr, "       id -g [-nr] [user]\n");
    (void)fprintf(stderr, "       id -p [user]\n");
    (void)fprintf(stderr, "       id -u [-nr] [user]\n");
  }
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <getprogname@plt>
mov    %eax,%edi
lea    0xeac(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    117d <usage+0x3d>
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
lea    0xe94(%rip),%rsi
call   1050 <fprintf@plt>
jmp    1224 <usage+0xe4>
mov    $0x0,%al
call   1030 <getprogname@plt>
mov    %eax,%edi
lea    0xe90(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11b6 <usage+0x76>
mov    0x2e3d(%rip),%rax
mov    (%rax),%edi
lea    0xe78(%rip),%rsi
call   1050 <fprintf@plt>
jmp    121f <usage+0xdf>
mov    0x2e23(%rip),%rax
mov    (%rax),%edi
lea    0xe6d(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e0e(%rip),%rax
mov    (%rax),%edi
lea    0xe6a(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2df9(%rip),%rax
mov    (%rax),%edi
lea    0xe6f(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2de4(%rip),%rax
mov    (%rax),%edi
lea    0xe75(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2dcf(%rip),%rax
mov    (%rax),%edi
lea    0xe75(%rip),%rsi
call   1050 <fprintf@plt>
jmp    1224 <usage+0xe4>
mov    $0x1,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
xor    %eax,%eax
call   1030 <getprogname@plt>
lea    0xeb1(%rip),%rsi
mov    %eax,%edi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    1164 <usage+0x24>
lea    0xea5(%rip),%rsi
jmp    11cd <usage+0x8d>
xor    %eax,%eax
call   1030 <getprogname@plt>
lea    0xeab(%rip),%rsi
mov    %eax,%edi
call   1040 <strcmp@plt>
mov    0x2e60(%rip),%rbx
mov    (%rbx),%edi
test   %rax,%rax
jne    1190 <usage+0x50>
lea    0xe96(%rip),%rsi
jmp    11d6 <usage+0x96>
lea    0xe9c(%rip),%rsi
call   1050 <fprintf@plt>
mov    (%rbx),%edi
lea    0xea0(%rip),%rsi
call   1050 <fprintf@plt>
mov    (%rbx),%edi
lea    0xeac(%rip),%rsi
call   1050 <fprintf@plt>
mov    (%rbx),%edi
lea    0xeb9(%rip),%rsi
call   1050 <fprintf@plt>
lea    0xec2(%rip),%rsi
mov    0x2e0c(%rip),%rax
mov    (%rax),%edi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"groups\00"
@stderr = global i32 0
@.str.1 = [22 x i8] c"usage: groups [user]\0A\00"
@.str.2 = [7 x i8] c"whoami\00"
@.str.3 = [15 x i8] c"usage: whoami\0A\00"
@.str.4 = [18 x i8] c"usage: id [user]\0A\00"
@.str.5 = [26 x i8] c" id -G [-n] [user]\0A\00"
@.str.6 = [27 x i8] c" id -g [-nr] [user]\0A\00"
@.str.7 = [21 x i8] c" id -p [user]\0A\00"
@.str.8 = [27 x i8] c" id -u [-nr] [user]\0A\00"
define void @usage() {
%1 = call i32 (...) @getprogname()
%2 = call i64 @strcmp(i32 %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %26
7: ; preds = %0
%8 = call i32 (...) @getprogname()
%9 = call i64 @strcmp(i32 %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %25
14: ; preds = %7
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
%19 = load i32, i32* @stderr
%20 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
%21 = load i32, i32* @stderr
%22 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%23 = load i32, i32* @stderr
%24 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
br label %25
25: ; preds = %14, %11
br label %26
26: ; preds = %25, %4
%27 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [7 x i8] c"groups\00"
@stderr = global i32 0
@.str.1 = [22 x i8] c"usage: groups [user]\0A\00"
@.str.2 = [7 x i8] c"whoami\00"
@.str.3 = [15 x i8] c"usage: whoami\0A\00"
@.str.4 = [18 x i8] c"usage: id [user]\0A\00"
@.str.5 = [26 x i8] c" id -G [-n] [user]\0A\00"
@.str.6 = [27 x i8] c" id -g [-nr] [user]\0A\00"
@.str.7 = [21 x i8] c" id -p [user]\0A\00"
@.str.8 = [27 x i8] c" id -u [-nr] [user]\0A\00"
define void @usage() {
%1 = tail call i32 (...) @getprogname()
%2 = tail call i64 @strcmp(i32 %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %17, label %4
4: ; preds = %0
%5 = tail call i32 (...) @getprogname()
%6 = tail call i64 @strcmp(i32 %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
%8 = load i32, i32* @stderr
br i1 %7, label %20, label %9
9: ; preds = %4
%10 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%11 = load i32, i32* @stderr
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
%15 = load i32, i32* @stderr
%16 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
br label %17
17: ; preds = %0, %9
%18 = phi i8* [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), %9 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), %0 ]
%19 = load i32, i32* @stderr
br label %20
20: ; preds = %17, %4
%21 = phi i8* [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), %4 ], [ %18, %17 ]
%22 = phi i32 [ %8, %4 ], [ %19, %17 ]
%23 = tail call i32 @fprintf(i32 %22, i8* %21)
%24 = tail call i32 @exit(i32 1)
unreachable
}