#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 */
struct sockaddr_in {
  int dummy;
};

/* Variables and functions */
int get_status(char const *, struct sockaddr_in *, int, char **);
int /*<<< orphan*/ help(char const *);
int /*<<< orphan*/ printf(char *);
scalar_t__ strcmp(char *, char *);
int get(const char *program, struct sockaddr_in *serv_addr, int argc,
        char *argv[]) {
  if (argc < 2) {
    help(program);
    return 1;
  }
  if (strcmp(argv[1], "status") == 0) {
    return get_status(program, serv_addr, argc - 1, &argv[1]);
  }
  printf("Error : Invalid parameter for command\n");
  help(program);
  return 1;
}


x86 assembly (clang, -O0):
<get>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
cmpl   $0x2,-0x1c(%rbp)
jge    1176 <get+0x36>
mov    -0x10(%rbp),%rdi
call   1060 <help@plt>
movl   $0x1,-0x4(%rbp)
jmp    11d3 <get+0x93>
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe7b(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11b7 <get+0x77>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
sub    $0x1,%edx
mov    -0x28(%rbp),%rcx
add    $0x8,%rcx
call   1030 <get_status@plt>
mov    %eax,-0x4(%rbp)
jmp    11d3 <get+0x93>
lea    0xe49(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1060 <help@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
cmp    $0x1,%edx
jle    1178 <get+0x38>
mov    %rcx,%rbx
mov    %edx,%ebp
mov    %rsi,%r15
mov    0x8(%rcx),%rdi
lea    0xe9e(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1190 <get+0x50>
lea    0xe94(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1060 <help@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
add    $0x8,%rbx
add    $0xffffffff,%ebp
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
mov    %rbx,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <get_status@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
@.str = [7 x i8] c"status\00"
@.str.1 = [39 x i8] c"Error : Invalid parameter for command\0A\00"
define i32 @get(i8* %0, %struct.sockaddr_in* %1, i32 %2, i8** %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca %struct.sockaddr_in*
%8 = alloca i32
%9 = alloca i8**
store i8* %0, i8** %6
store %struct.sockaddr_in* %1, %struct.sockaddr_in** %7
store i32 %2, i32* %8
store i8** %3, i8*** %9
%10 = load i32, i32* %8
%11 = icmp slt i32 %10, 2
br i1 %11, label %12, label %15
12: ; preds = %4
%13 = load i8*, i8** %6
%14 = call i32 @help(i8* %13)
store i32 1, i32* %5
br label %33
15: ; preds = %4
%16 = load i8**, i8*** %9
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %29
21: ; preds = %15
%22 = load i8*, i8** %6
%23 = load %struct.sockaddr_in*, %struct.sockaddr_in** %7
%24 = load i32, i32* %8
%25 = sub nsw i32 %24, 1
%26 = load i8**, i8*** %9
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = call i32 @get_status(i8* %22, %struct.sockaddr_in* %23, i32 %25, i8** %27)
store i32 %28, i32* %5
br label %33
29: ; preds = %15
%30 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
%31 = load i8*, i8** %6
%32 = call i32 @help(i8* %31)
store i32 1, i32* %5
br label %33
33: ; preds = %29, %21, %12
%34 = load i32, i32* %5
ret i32 %34
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32 }
@.str = [7 x i8] c"status\00"
@str = [38 x i8] c"Error : Invalid parameter for command\00"
define i32 @get(i8* %0, %struct.sockaddr_in* %1, i32 %2, i8** %3) {
%5 = icmp slt i32 %2, 2
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = tail call i32 @help(i8* %0)
br label %19
8: ; preds = %4
%9 = getelementptr inbounds i8*, i8** %3, i64 1
%10 = load i8*, i8** %9
%11 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = add nsw i32 %2, -1
%15 = tail call i32 @get_status(i8* %0, %struct.sockaddr_in* %1, i32 %14, i8** %9)
br label %19
16: ; preds = %8
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%18 = tail call i32 @help(i8* %0)
br label %19
19: ; preds = %16, %13, %6
%20 = phi i32 [ 1, %6 ], [ %15, %13 ], [ 1, %16 ]
ret i32 %20
}