#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 make_binding_object(int, char **, char **, int *);
scalar_t__ put32(char **, int *, int);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ warnx(char *, ...);
int make_remove_command(int argc, char **argv, char **bpp, int *lenp) {
  int argc_passed = 0, passed;
  if (argc == 0) {
    warnx("make_remove_command: command is too short");
    return (-1);
  }
  if (strcmp(argv[0], "binding") == 0) {
    if (put32(bpp, lenp, 1))
      goto fail;
    if ((passed = make_binding_object(argc - 1, argv + 1, bpp, lenp)) < 0) {
      return (-1);
    }
    argc_passed += passed;
  } else {
    warnx("remove target not supported: %s", argv[0]);
    return (-1);
  }
  argc_passed++;
  return (argc_passed);
fail:
  warnx("make_remove_command failed");
  return (-1);
}


x86 assembly (clang, -O0):
<make_remove_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1182 <make_remove_command+0x42>
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <warnx@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    124b <make_remove_command+0x10b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe9a(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1201 <make_remove_command+0xc1>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x1,%edx
call   1050 <put32@plt>
cmp    $0x0,%rax
je     11c0 <make_remove_command+0x80>
jmp    1236 <make_remove_command+0xf6>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1060 <make_binding_object@plt>
mov    %eax,-0x28(%rbp)
cmp    $0x0,%eax
jge    11f3 <make_remove_command+0xb3>
movl   $0xffffffff,-0x4(%rbp)
jmp    124b <make_remove_command+0x10b>
mov    -0x28(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    1222 <make_remove_command+0xe2>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1030 <warnx@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    124b <make_remove_command+0x10b>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    124b <make_remove_command+0x10b>
lea    0xe15(%rip),%rdi
mov    $0x0,%al
call   1030 <warnx@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_remove_command>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
je     117d <make_remove_command+0x3d>
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %edi,%ebp
mov    (%rsi),%rdi
lea    0xeca(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1186 <make_remove_command+0x46>
mov    (%rbx),%rsi
lea    0xebe(%rip),%rdi
xor    %eax,%eax
call   1030 <warnx@plt>
jmp    11a9 <make_remove_command+0x69>
lea    0xe7c(%rip),%rdi
jmp    11a2 <make_remove_command+0x62>
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x1,%edx
call   1050 <put32@plt>
test   %rax,%rax
je     11b9 <make_remove_command+0x79>
lea    0xeb0(%rip),%rdi
xor    %eax,%eax
call   1030 <warnx@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
add    $0xffffffff,%ebp
add    $0x8,%rbx
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
call   1060 <make_binding_object@plt>
lea    0x1(%rax),%ecx
test   %eax,%eax
mov    $0xffffffff,%eax
cmovns %ecx,%eax
jmp    11ae <make_remove_command+0x6e>

LLVM IR (-O0):
@.str = [42 x i8] c"make_remove_command: command is too short\00"
@.str.1 = [8 x i8] c"binding\00"
@.str.2 = [32 x i8] c"remove target not supported: %s\00"
@.str.3 = [27 x i8] c"make_remove_command failed\00"
define i32 @make_remove_command(i32 %0, i8** %1, i8** %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8**
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %6
store i8** %1, i8*** %7
store i8** %2, i8*** %8
store i32* %3, i32** %9
store i32 0, i32* %10
%12 = load i32, i32* %6
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %4
%15 = call i32 (i8*, ...) @warnx(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %5
br label %53
16: ; preds = %4
%17 = load i8**, i8*** %7
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %42
22: ; preds = %16
%23 = load i8**, i8*** %8
%24 = load i32*, i32** %9
%25 = call i64 @put32(i8** %23, i32* %24, i32 1)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %22
br label %51
28: ; preds = %22
%29 = load i32, i32* %6
%30 = sub nsw i32 %29, 1
%31 = load i8**, i8*** %7
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8**, i8*** %8
%34 = load i32*, i32** %9
%35 = call i32 @make_binding_object(i32 %30, i8** %32, i8** %33, i32* %34)
store i32 %35, i32* %11
%36 = icmp slt i32 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %28
store i32 -1, i32* %5
br label %53
38: ; preds = %28
%39 = load i32, i32* %11
%40 = load i32, i32* %10
%41 = add nsw i32 %40, %39
store i32 %41, i32* %10
br label %47
42: ; preds = %16
%43 = load i8**, i8*** %7
%44 = getelementptr inbounds i8*, i8** %43, i64 0
%45 = load i8*, i8** %44
%46 = call i32 (i8*, ...) @warnx(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* %45)
store i32 -1, i32* %5
br label %53
47: ; preds = %38
%48 = load i32, i32* %10
%49 = add nsw i32 %48, 1
store i32 %49, i32* %10
%50 = load i32, i32* %10
store i32 %50, i32* %5
br label %53
51: ; preds = %27
%52 = call i32 (i8*, ...) @warnx(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %5
br label %53
53: ; preds = %51, %47, %42, %37, %14
%54 = load i32, i32* %5
ret i32 %54
}

LLVM IR (-O2):
@.str = [42 x i8] c"make_remove_command: command is too short\00"
@.str.1 = [8 x i8] c"binding\00"
@.str.2 = [32 x i8] c"remove target not supported: %s\00"
@.str.3 = [27 x i8] c"make_remove_command failed\00"
define i32 @make_remove_command(i32 %0, i8** %1, i8** %2, i32* %3) {
%5 = icmp eq i32 %0, 0
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = tail call i32 (i8*, ...) @warnx(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
br label %27
8: ; preds = %4
%9 = load i8*, i8** %1
%10 = tail call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %22
12: ; preds = %8
%13 = tail call i64 @put32(i8** %2, i32* %3, i32 1)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %25
15: ; preds = %12
%16 = add nsw i32 %0, -1
%17 = getelementptr inbounds i8*, i8** %1, i64 1
%18 = tail call i32 @make_binding_object(i32 %16, i8** %17, i8** %2, i32* %3)
%19 = add nsw i32 %18, 1
%20 = icmp sgt i32 %18, -1
%21 = select i1 %20, i32 %19, i32 -1
br label %27
22: ; preds = %8
%23 = load i8*, i8** %1
%24 = tail call i32 (i8*, ...) @warnx(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* %23)
br label %27
25: ; preds = %12
%26 = tail call i32 (i8*, ...) @warnx(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
br label %27
27: ; preds = %15, %25, %22, %6
%28 = phi i32 [ -1, %6 ], [ -1, %25 ], [ -1, %22 ], [ %21, %15 ]
ret i32 %28
}