#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*/ add_acl(int, int, char **);
int /*<<< orphan*/ add_usage();
int /*<<< orphan*/ adddel_target(int, char *, int, char **);
scalar_t__ strncmp(char *, char *, int);
void add(int sock, int argc, char **argv) {
  if (argc < 2) {
    add_usage();
    return;
  }
  if (strncmp(argv[1], "tar", 3) == 0) {
    adddel_target(sock, "add", (argc - 1), argv + 1);
    return;
  }
  if (strncmp(argv[1], "int", 3) == 0) {
    return;
  }
  if (strncmp(argv[1], "acl", 3) == 0) {
    add_acl(sock, (argc - 1), argv + 1);
    return;
  }
  if (strncmp(argv[1], "acc", 3) == 0) {
    add_acl(sock, (argc - 1), argv + 1);
    return;
  }
  add_usage();
  return;
}


x86 assembly (clang, -O0):
<add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1168 <add+0x28>
mov    $0x0,%al
call   1050 <add_usage@plt>
jmp    1258 <add+0x118>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe89(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11ad <add+0x6d>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
mov    -0x10(%rbp),%rcx
add    $0x8,%rcx
lea    0xe61(%rip),%rsi
call   1040 <adddel_target@plt>
jmp    1258 <add+0x118>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe4c(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11d5 <add+0x95>
jmp    1258 <add+0x118>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe28(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1213 <add+0xd3>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
mov    -0x10(%rbp),%rdx
add    $0x8,%rdx
call   1060 <add_acl@plt>
jmp    1258 <add+0x118>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdee(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1251 <add+0x111>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
mov    -0x10(%rbp),%rdx
add    $0x8,%rdx
call   1060 <add_acl@plt>
jmp    1258 <add+0x118>
mov    $0x0,%al
call   1050 <add_usage@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x1,%esi
jg     1154 <add+0x14>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <add_usage@plt>
mov    %rdx,%rbx
mov    %esi,%ebp
mov    %edi,%r14d
mov    0x8(%rdx),%rdi
add    $0x8,%rbx
lea    0xe95(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11d9 <add+0x99>
mov    (%rbx),%rdi
lea    0xe84(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11f4 <add+0xb4>
mov    (%rbx),%rdi
lea    0xe6f(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11c5 <add+0x85>
mov    (%rbx),%rdi
lea    0xe5a(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1149 <add+0x9>
add    $0xffffffff,%ebp
mov    %r14d,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <add_acl@plt>
add    $0xffffffff,%ebp
lea    0xe21(%rip),%rsi
mov    %r14d,%edi
mov    %ebp,%edx
mov    %rbx,%rcx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <adddel_target@plt>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"tar\00"
@.str.1 = [4 x i8] c"add\00"
@.str.2 = [4 x i8] c"int\00"
@.str.3 = [4 x i8] c"acl\00"
@.str.4 = [4 x i8] c"acc\00"
define void @add(i32 %0, i32 %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = call i32 (...) @add_usage()
br label %59
11: ; preds = %3
%12 = load i8**, i8*** %6
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i64 @strncmp(i8* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %24
17: ; preds = %11
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = sub nsw i32 %19, 1
%21 = load i8**, i8*** %6
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = call i32 @adddel_target(i32 %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %20, i8** %22)
br label %59
24: ; preds = %11
%25 = load i8**, i8*** %6
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i64 @strncmp(i8* %27, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 3)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %24
br label %59
31: ; preds = %24
%32 = load i8**, i8*** %6
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = call i64 @strncmp(i8* %34, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 3)
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %44
37: ; preds = %31
%38 = load i32, i32* %4
%39 = load i32, i32* %5
%40 = sub nsw i32 %39, 1
%41 = load i8**, i8*** %6
%42 = getelementptr inbounds i8*, i8** %41, i64 1
%43 = call i32 @add_acl(i32 %38, i32 %40, i8** %42)
br label %59
44: ; preds = %31
%45 = load i8**, i8*** %6
%46 = getelementptr inbounds i8*, i8** %45, i64 1
%47 = load i8*, i8** %46
%48 = call i64 @strncmp(i8* %47, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 3)
%49 = icmp eq i64 %48, 0
br i1 %49, label %50, label %57
50: ; preds = %44
%51 = load i32, i32* %4
%52 = load i32, i32* %5
%53 = sub nsw i32 %52, 1
%54 = load i8**, i8*** %6
%55 = getelementptr inbounds i8*, i8** %54, i64 1
%56 = call i32 @add_acl(i32 %51, i32 %53, i8** %55)
br label %59
57: ; preds = %44
%58 = call i32 (...) @add_usage()
br label %59
59: ; preds = %57, %50, %37, %30, %17, %9
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"tar\00"
@.str.1 = [4 x i8] c"add\00"
@.str.2 = [4 x i8] c"int\00"
@.str.3 = [4 x i8] c"acl\00"
@.str.4 = [4 x i8] c"acc\00"
define void @add(i32 %0, i32 %1, i8** %2) {
%4 = icmp slt i32 %1, 2
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 (...) @add_usage()
br label %35
7: ; preds = %3
%8 = getelementptr inbounds i8*, i8** %2, i64 1
%9 = load i8*, i8** %8
%10 = tail call i64 @strncmp(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = add nsw i32 %1, -1
%14 = tail call i32 @adddel_target(i32 %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %13, i8** %8)
br label %35
15: ; preds = %7
%16 = load i8*, i8** %8
%17 = tail call i64 @strncmp(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 3)
%18 = icmp eq i64 %17, 0
br i1 %18, label %35, label %19
19: ; preds = %15
%20 = load i8*, i8** %8
%21 = tail call i64 @strncmp(i8* %20, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 3)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = add nsw i32 %1, -1
%25 = tail call i32 @add_acl(i32 %0, i32 %24, i8** %8)
br label %35
26: ; preds = %19
%27 = load i8*, i8** %8
%28 = tail call i64 @strncmp(i8* %27, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 3)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %26
%31 = add nsw i32 %1, -1
%32 = tail call i32 @add_acl(i32 %0, i32 %31, i8** %8)
br label %35
33: ; preds = %26
%34 = tail call i32 (...) @add_usage()
br label %35
35: ; preds = %15, %33, %30, %23, %12, %5
ret void
}