#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*/ remote_help(char const *, int, char **);
int remote_nodes_add(char const *, int, char **);
int remote_nodes_list(char const *, int, char **);
int remote_nodes_remove(char const *, int, char **);
scalar_t__ strcmp(char *, char *);
int remote_nodes(const char *device, int argc, char *argv[]) {
  if (argc < 1) {
    remote_help(device, argc, argv);
    return 1;
  }
  if (strcmp(argv[1], "list") == 0) {
    return remote_nodes_list(device, argc - 1, argv + 1);
  } else if (strcmp(argv[1], "add") == 0) {
    return remote_nodes_add(device, argc - 1, argv + 1);
  } else if (strcmp(argv[1], "remove") == 0) {
    return remote_nodes_remove(device, argc - 1, argv + 1);
  } else {
    remote_help(device, argc, argv);
    return 1;
  }
}


x86 assembly (clang, -O0):
<remote_nodes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
cmpl   $0x1,-0x14(%rbp)
jge    1189 <remote_nodes+0x39>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1030 <remote_help@plt>
movl   $0x1,-0x4(%rbp)
jmp    1257 <remote_nodes+0x107>
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe68(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11c6 <remote_nodes+0x76>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
sub    $0x1,%esi
mov    -0x20(%rbp),%rdx
add    $0x8,%rdx
call   1070 <remote_nodes_list@plt>
mov    %eax,-0x4(%rbp)
jmp    1257 <remote_nodes+0x107>
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe30(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1203 <remote_nodes+0xb3>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
sub    $0x1,%esi
mov    -0x20(%rbp),%rdx
add    $0x8,%rdx
call   1050 <remote_nodes_add@plt>
mov    %eax,-0x4(%rbp)
jmp    1257 <remote_nodes+0x107>
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdf7(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1240 <remote_nodes+0xf0>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
sub    $0x1,%esi
mov    -0x20(%rbp),%rdx
add    $0x8,%rdx
call   1040 <remote_nodes_remove@plt>
mov    %eax,-0x4(%rbp)
jmp    1257 <remote_nodes+0x107>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1030 <remote_help@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remote_nodes>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r12
mov    %esi,%ebx
mov    %rdi,%r14
test   %esi,%esi
jle    11a7 <remote_nodes+0x57>
lea    0x8(%r12),%r15
mov    0x8(%r12),%rdi
lea    0xe8b(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11c5 <remote_nodes+0x75>
mov    (%r15),%rdi
lea    0xe7c(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11e0 <remote_nodes+0x90>
mov    (%r15),%rdi
lea    0xe6c(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11fb <remote_nodes+0xab>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %r12,%rdx
call   1030 <remote_help@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
add    $0xffffffff,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
mov    %r15,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1070 <remote_nodes_list@plt>
add    $0xffffffff,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
mov    %r15,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1050 <remote_nodes_add@plt>
add    $0xffffffff,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
mov    %r15,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <remote_nodes_remove@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"list\00"
@.str.1 = [4 x i8] c"add\00"
@.str.2 = [7 x i8] c"remove\00"
define i32 @remote_nodes(i8* %0, i32 %1, i8** %2) {
%4 = icmp slt i32 %1, 1
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @remote_help(i8* %0, i32 %1, i8** %2)
br label %31
7: ; preds = %3
%8 = getelementptr inbounds i8*, i8** %2, i64 1
%9 = load i8*, i8** %8
%10 = tail call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%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 @remote_nodes_list(i8* %0, i32 %13, i8** %8)
br label %31
15: ; preds = %7
%16 = load i8*, i8** %8
%17 = tail call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = add nsw i32 %1, -1
%21 = tail call i32 @remote_nodes_add(i8* %0, i32 %20, i8** %8)
br label %31
22: ; preds = %15
%23 = load i8*, i8** %8
%24 = tail call i64 @strcmp(i8* %23, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %22
%27 = add nsw i32 %1, -1
%28 = tail call i32 @remote_nodes_remove(i8* %0, i32 %27, i8** %8)
br label %31
29: ; preds = %22
%30 = tail call i32 @remote_help(i8* %0, i32 %1, i8** %2)
br label %31
31: ; preds = %29, %26, %19, %12, %5
%32 = phi i32 [ 1, %5 ], [ %14, %12 ], [ %21, %19 ], [ %28, %26 ], [ 1, %29 ]
ret i32 %32
}