#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 ir_remote {
  int dummy;
};
struct ir_ncode {
  int dummy;
};

/* Variables and functions */
scalar_t__ parse_rc(int, char *, char *, struct ir_remote **,
                    struct ir_ncode **, int /*<<< orphan*/);
int send_name(int, char *, struct ir_ncode *);
int send_remote(int, char *, struct ir_remote *);
int send_remote_list(int, char *);
int list(int fd, char *message, char *arguments) {
  struct ir_remote *remote;
  struct ir_ncode *code;
  if (parse_rc(fd, message, arguments, &remote, &code, 0) == 0)
    return (0);
  if (remote == NULL) {
    return (send_remote_list(fd, message));
  }
  if (code == NULL) {
    return (send_remote(fd, message, remote));
  }
  return (send_name(fd, message, code));
}


x86 assembly (clang, -O0):
<list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x28(%rbp),%r8
xor    %r9d,%r9d
call   1040 <parse_rc@plt>
cmp    $0x0,%rax
jne    1184 <list+0x44>
movl   $0x0,-0x4(%rbp)
jmp    11d9 <list+0x99>
cmpq   $0x0,-0x20(%rbp)
jne    11a3 <list+0x63>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <send_remote_list@plt>
mov    %eax,-0x4(%rbp)
jmp    11d9 <list+0x99>
cmpq   $0x0,-0x28(%rbp)
jne    11c6 <list+0x86>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <send_remote@plt>
mov    %eax,-0x4(%rbp)
jmp    11d9 <list+0x99>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1050 <send_name@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %edi,%ebp
lea    0x8(%rsp),%rcx
mov    %rsp,%r8
xor    %ebx,%ebx
xor    %r9d,%r9d
call   1040 <parse_rc@plt>
test   %rax,%rax
je     1199 <list+0x59>
mov    0x8(%rsp),%rdx
test   %rdx,%rdx
je     1186 <list+0x46>
mov    (%rsp),%rax
mov    %ebp,%edi
mov    %r14,%rsi
test   %rax,%rax
je     1192 <list+0x52>
mov    %rax,%rdx
call   1050 <send_name@plt>
jmp    1197 <list+0x57>
mov    %ebp,%edi
mov    %r14,%rsi
call   1060 <send_remote_list@plt>
jmp    1197 <list+0x57>
call   1030 <send_remote@plt>
mov    %eax,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.ir_remote = type { i32 }
%struct.ir_ncode = type { i32 }
define i32 @list(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca %struct.ir_remote*
%9 = alloca %struct.ir_ncode*
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%10 = load i32, i32* %5
%11 = load i8*, i8** %6
%12 = load i8*, i8** %7
%13 = call i64 @parse_rc(i32 %10, i8* %11, i8* %12, %struct.ir_remote** %8, %struct.ir_ncode** %9, i32 0)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %3
store i32 0, i32* %4
br label %36
16: ; preds = %3
%17 = load %struct.ir_remote*, %struct.ir_remote** %8
%18 = icmp eq %struct.ir_remote* %17, null
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = load i32, i32* %5
%21 = load i8*, i8** %6
%22 = call i32 @send_remote_list(i32 %20, i8* %21)
store i32 %22, i32* %4
br label %36
23: ; preds = %16
%24 = load %struct.ir_ncode*, %struct.ir_ncode** %9
%25 = icmp eq %struct.ir_ncode* %24, null
br i1 %25, label %26, label %31
26: ; preds = %23
%27 = load i32, i32* %5
%28 = load i8*, i8** %6
%29 = load %struct.ir_remote*, %struct.ir_remote** %8
%30 = call i32 @send_remote(i32 %27, i8* %28, %struct.ir_remote* %29)
store i32 %30, i32* %4
br label %36
31: ; preds = %23
%32 = load i32, i32* %5
%33 = load i8*, i8** %6
%34 = load %struct.ir_ncode*, %struct.ir_ncode** %9
%35 = call i32 @send_name(i32 %32, i8* %33, %struct.ir_ncode* %34)
store i32 %35, i32* %4
br label %36
36: ; preds = %31, %26, %19, %15
%37 = load i32, i32* %4
ret i32 %37
}

LLVM IR (-O2):
%struct.ir_remote = type { i32 }
%struct.ir_ncode = type { i32 }
define i32 @list(i32 %0, i8* %1, i8* %2) {
%4 = alloca %struct.ir_remote*
%5 = alloca %struct.ir_ncode*
%6 = bitcast %struct.ir_remote** %4 to i8*
%7 = bitcast %struct.ir_ncode** %5 to i8*
%8 = call i64 @parse_rc(i32 %0, i8* %1, i8* %2, %struct.ir_remote** %4, %struct.ir_ncode** %5, i32 0)
%9 = icmp eq i64 %8, 0
br i1 %9, label %22, label %10
10: ; preds = %3
%11 = load %struct.ir_remote*, %struct.ir_remote** %4
%12 = icmp eq %struct.ir_remote* %11, null
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 @send_remote_list(i32 %0, i8* %1)
br label %22
15: ; preds = %10
%16 = load %struct.ir_ncode*, %struct.ir_ncode** %5
%17 = icmp eq %struct.ir_ncode* %16, null
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 @send_remote(i32 %0, i8* %1, %struct.ir_remote* %11)
br label %22
20: ; preds = %15
%21 = call i32 @send_name(i32 %0, i8* %1, %struct.ir_ncode* %16)
br label %22
22: ; preds = %3, %20, %18, %13
%23 = phi i32 [ %14, %13 ], [ %19, %18 ], [ %21, %20 ], [ 0, %3 ]
ret i32 %23
}