#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*/ do_ping(char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ usage();
int /*<<< orphan*/ version();
main(int argc, char *argv[]) {
  if (argc == 1) {
    usage();
    goto l_exit;
  }
  if (strcmp("-h", argv[1]) == 0) {
    usage();
    goto l_exit;
  }
  if (strcmp("-v", argv[1]) == 0) {
    version();
    goto l_exit;
  }
  do_ping(argv[1]);
l_exit:;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    116c <main+0x2c>
mov    $0x0,%al
call   1060 <usage@plt>
jmp    11cd <main+0x8d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe85(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1196 <main+0x56>
mov    $0x0,%al
call   1060 <usage@plt>
jmp    11cd <main+0x8d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe5e(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11c0 <main+0x80>
mov    $0x0,%al
call   1050 <version@plt>
jmp    11cd <main+0x8d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <do_ping@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x1,%edi
je     117e <main+0x3e>
mov    %rsi,%rbx
mov    0x8(%rsi),%rsi
lea    0xeac(%rip),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     117e <main+0x3e>
mov    0x8(%rbx),%rsi
lea    0xe9a(%rip),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1189 <main+0x49>
mov    0x8(%rbx),%rdi
call   1030 <do_ping@plt>
jmp    1185 <main+0x45>
xor    %eax,%eax
call   1060 <usage@plt>
xor    %eax,%eax
pop    %rbx
ret
xor    %eax,%eax
call   1050 <version@plt>
jmp    1185 <main+0x45>

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

LLVM IR (-O2):
@.str = [3 x i8] c"-h\00"
@.str.1 = [3 x i8] c"-v\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @usage()
br label %22
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = tail call i32 (...) @usage()
br label %22
13: ; preds = %6
%14 = load i8*, i8** %7
%15 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = tail call i32 (...) @version()
br label %22
19: ; preds = %13
%20 = load i8*, i8** %7
%21 = tail call i32 @do_ping(i8* %20)
br label %22
22: ; preds = %19, %17, %11, %4
ret i32 0
}