#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 do_fstat(int, char **);
int do_fuser(int, char **);
int /*<<< orphan*/ err(int, char *, char *);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  char *p;
  p = basename(argv[0]);
  if (p == NULL)
    err(1, "basename(%s)", argv[0]);
  if (!strcmp(p, "fuser"))
    return (do_fuser(argc, argv));
  else
    return (do_fstat(argc, argv));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <basename@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1199 <main+0x49>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    $0x1,%edi
lea    0xe6c(%rip),%rsi
call   1050 <err@plt>
mov    -0x18(%rbp),%rdi
lea    0xe69(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11c6 <main+0x76>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <do_fuser@plt>
mov    %eax,-0x4(%rbp)
jmp    11d5 <main+0x85>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <do_fstat@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%r14d
mov    (%rsi),%rdi
call   1040 <basename@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    117e <main+0x2e>
mov    (%rbx),%rdx
lea    0xe8c(%rip),%rsi
mov    $0x1,%edi
call   1050 <err@plt>
lea    0xe88(%rip),%rsi
mov    %rbp,%rdi
call   1030 <strcmp@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
test   %eax,%eax
je     11a0 <main+0x50>
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <do_fstat@plt>
pop    %rbx
pop    %r14
pop    %rbp
jmp    1070 <do_fuser@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"basename(%s)\00"
@.str.1 = [6 x i8] c"fuser\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 0
%9 = load i8*, i8** %8
%10 = call i8* @basename(i8* %9)
store i8* %10, i8** %6
%11 = load i8*, i8** %6
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 @err(i32 1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %16)
br label %18
18: ; preds = %13, %2
%19 = load i8*, i8** %6
%20 = call i32 @strcmp(i8* %19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp ne i32 %20, 0
br i1 %21, label %26, label %22
22: ; preds = %18
%23 = load i32, i32* %4
%24 = load i8**, i8*** %5
%25 = call i32 @do_fuser(i32 %23, i8** %24)
store i32 %25, i32* %3
br label %30
26: ; preds = %18
%27 = load i32, i32* %4
%28 = load i8**, i8*** %5
%29 = call i32 @do_fstat(i32 %27, i8** %28)
store i32 %29, i32* %3
br label %30
30: ; preds = %26, %22
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
@.str = [13 x i8] c"basename(%s)\00"
@.str.1 = [6 x i8] c"fuser\00"
define i32 @main(i32 %0, i8** %1) {
%3 = load i8*, i8** %1
%4 = tail call i8* @basename(i8* %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 @err(i32 1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %9
9: ; preds = %6, %2
%10 = tail call i32 @strcmp(i8* dereferenceable(1) %4, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = tail call i32 @do_fuser(i32 %0, i8** %1)
br label %16
14: ; preds = %9
%15 = tail call i32 @do_fstat(i32 %0, i8** %1)
br label %16
16: ; preds = %14, %12
%17 = phi i32 [ %15, %14 ], [ %13, %12 ]
ret i32 %17
}