#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 handle_kmod_commands(int, char **);
int handle_kmod_compat_commands(int, char **);
scalar_t__ strcmp(char const *, char *);
int main(int argc, char *argv[]) {
  const char *binname = basename(argv[0]);
  int err;
  if (strcmp(binname, "kmod") == 0)
    err = handle_kmod_commands(argc, argv);
  else
    err = handle_kmod_compat_commands(argc, argv);
  return err;
}


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   1050 <basename@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe8f(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1194 <main+0x54>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <handle_kmod_commands@plt>
mov    %eax,-0x1c(%rbp)
jmp    11a3 <main+0x63>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <handle_kmod_compat_commands@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    (%rsi),%rdi
call   1050 <basename@plt>
lea    0xea9(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcmp@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
test   %rax,%rax
je     1174 <main+0x34>
pop    %rbx
pop    %rbp
jmp    1060 <handle_kmod_compat_commands@plt>
pop    %rbx
pop    %rbp
jmp    1030 <handle_kmod_commands@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"kmod\00"
define i32 @main(i32 %0, i8** %1) {
%3 = load i8*, i8** %1
%4 = tail call i8* @basename(i8* %3)
%5 = tail call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 @handle_kmod_commands(i32 %0, i8** %1)
br label %11
9: ; preds = %2
%10 = tail call i32 @handle_kmod_compat_commands(i32 %0, i8** %1)
br label %11
11: ; preds = %9, %7
%12 = phi i32 [ %8, %7 ], [ %10, %9 ]
ret i32 %12
}