#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 cli_pipeline {
  int dummy;
};
struct cli_def {
  int dummy;
};

/* Variables and functions */
int cli_int_execute_pipeline(struct cli_def *, struct cli_pipeline *);
int /*<<< orphan*/ cli_int_free_pipeline(struct cli_pipeline *);
struct cli_pipeline *cli_int_generate_pipeline(struct cli_def *, char const *);
int cli_int_validate_pipeline(struct cli_def *, struct cli_pipeline *);
int cli_run_command(struct cli_def *cli, const char *command) {
  int rc = -1;
  struct cli_pipeline *pipeline;
  pipeline = cli_int_generate_pipeline(cli, command);
  if (pipeline)
    rc = cli_int_validate_pipeline(cli, pipeline);
  if (rc == 0) {
    rc = cli_int_execute_pipeline(cli, pipeline);
  }
  cli_int_free_pipeline(pipeline);
  return rc;
}


x86 assembly (clang, -O0):
<cli_run_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <cli_int_generate_pipeline@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1183 <cli_run_command+0x43>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <cli_int_validate_pipeline@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    119d <cli_run_command+0x5d>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <cli_int_execute_pipeline@plt>
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <cli_int_free_pipeline@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cli_run_command>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1060 <cli_int_generate_pipeline@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1174 <cli_run_command+0x34>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <cli_int_validate_pipeline@plt>
mov    %eax,%ebp
test   %eax,%eax
jne    1179 <cli_run_command+0x39>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <cli_int_execute_pipeline@plt>
mov    %eax,%ebp
jmp    1179 <cli_run_command+0x39>
mov    $0xffffffff,%ebp
mov    %rbx,%rdi
call   1030 <cli_int_free_pipeline@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.cli_def = type { i32 }
%struct.cli_pipeline = type { i32 }
define i32 @cli_run_command(%struct.cli_def* %0, i8* %1) {
%3 = alloca %struct.cli_def*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca %struct.cli_pipeline*
store %struct.cli_def* %0, %struct.cli_def** %3
store i8* %1, i8** %4
store i32 -1, i32* %5
%7 = load %struct.cli_def*, %struct.cli_def** %3
%8 = load i8*, i8** %4
%9 = call %struct.cli_pipeline* @cli_int_generate_pipeline(%struct.cli_def* %7, i8* %8)
store %struct.cli_pipeline* %9, %struct.cli_pipeline** %6
%10 = load %struct.cli_pipeline*, %struct.cli_pipeline** %6
%11 = icmp ne %struct.cli_pipeline* %10, null
br i1 %11, label %12, label %16
12: ; preds = %2
%13 = load %struct.cli_def*, %struct.cli_def** %3
%14 = load %struct.cli_pipeline*, %struct.cli_pipeline** %6
%15 = call i32 @cli_int_validate_pipeline(%struct.cli_def* %13, %struct.cli_pipeline* %14)
store i32 %15, i32* %5
br label %16
16: ; preds = %12, %2
%17 = load i32, i32* %5
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = load %struct.cli_def*, %struct.cli_def** %3
%21 = load %struct.cli_pipeline*, %struct.cli_pipeline** %6
%22 = call i32 @cli_int_execute_pipeline(%struct.cli_def* %20, %struct.cli_pipeline* %21)
store i32 %22, i32* %5
br label %23
23: ; preds = %19, %16
%24 = load %struct.cli_pipeline*, %struct.cli_pipeline** %6
%25 = call i32 @cli_int_free_pipeline(%struct.cli_pipeline* %24)
%26 = load i32, i32* %5
ret i32 %26
}

LLVM IR (-O2):
%struct.cli_def = type { i32 }
%struct.cli_pipeline = type { i32 }
define i32 @cli_run_command(%struct.cli_def* %0, i8* %1) {
%3 = tail call %struct.cli_pipeline* @cli_int_generate_pipeline(%struct.cli_def* %0, i8* %1)
%4 = icmp eq %struct.cli_pipeline* %3, null
br i1 %4, label %10, label %5
5: ; preds = %2
%6 = tail call i32 @cli_int_validate_pipeline(%struct.cli_def* %0, %struct.cli_pipeline* %3)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @cli_int_execute_pipeline(%struct.cli_def* %0, %struct.cli_pipeline* %3)
br label %10
10: ; preds = %2, %8, %5
%11 = phi i32 [ %9, %8 ], [ %6, %5 ], [ -1, %2 ]
%12 = tail call i32 @cli_int_free_pipeline(%struct.cli_pipeline* %3)
ret i32 %11
}