#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 xhda_route_list {
  int dummy;
};
struct xhda_node {
  int dummy;
};
struct xhda_codec {
  int dummy;
};

/* Variables and functions */
struct xhda_node *find_node(struct xhda_codec *, int);
struct xhda_route_list *routes_connected_from(struct xhda_codec *,
                                              struct xhda_node *,
                                              int /*<<< orphan*/,
                                              struct xhda_node **, unsigned int,
                                              int /*<<< orphan*/ *);
struct xhda_route_list *hda_routes_connected_from(struct xhda_codec *codec,
                                                  int nid, unsigned int flags) {
  struct xhda_node *route[10 + 1];
  struct xhda_node *node;
  node = find_node(codec, nid);
  if (!node)
    return NULL;
  return routes_connected_from(codec, node, 0, route, flags, NULL);
}


x86 assembly (clang, -O0):
<hda_routes_connected_from>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <find_node@plt>
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x78(%rbp)
jne    115d <hda_routes_connected_from+0x3d>
movq   $0x0,-0x8(%rbp)
jmp    117d <hda_routes_connected_from+0x5d>
mov    -0x10(%rbp),%rdi
mov    -0x78(%rbp),%rsi
lea    -0x70(%rbp),%rcx
mov    -0x18(%rbp),%r8d
xor    %edx,%edx
xor    %eax,%eax
mov    %eax,%r9d
call   1040 <routes_connected_from@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hda_routes_connected_from>:
push   %rbp
push   %rbx
sub    $0x58,%rsp
mov    %edx,%ebp
mov    %rdi,%rbx
call   1030 <find_node@plt>
test   %rax,%rax
je     114d <hda_routes_connected_from+0x2d>
mov    %rsp,%rcx
mov    %rbx,%rdi
mov    %rax,%rsi
xor    %edx,%edx
mov    %ebp,%r8d
xor    %r9d,%r9d
call   1040 <routes_connected_from@plt>
jmp    114f <hda_routes_connected_from+0x2f>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.xhda_route_list = type { i32 }
%struct.xhda_codec = type { i32 }
%struct.xhda_node = type { i32 }
define %struct.xhda_route_list* @hda_routes_connected_from(%struct.xhda_codec* %0, i32 %1, i32 %2) {
%4 = alloca %struct.xhda_route_list*
%5 = alloca %struct.xhda_codec*
%6 = alloca i32
%7 = alloca i32
%8 = alloca [11 x %struct.xhda_node*]
%9 = alloca %struct.xhda_node*
store %struct.xhda_codec* %0, %struct.xhda_codec** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%10 = load %struct.xhda_codec*, %struct.xhda_codec** %5
%11 = load i32, i32* %6
%12 = call %struct.xhda_node* @find_node(%struct.xhda_codec* %10, i32 %11)
store %struct.xhda_node* %12, %struct.xhda_node** %9
%13 = load %struct.xhda_node*, %struct.xhda_node** %9
%14 = icmp ne %struct.xhda_node* %13, null
br i1 %14, label %16, label %15
15: ; preds = %3
store %struct.xhda_route_list* null, %struct.xhda_route_list** %4
br label %22
16: ; preds = %3
%17 = load %struct.xhda_codec*, %struct.xhda_codec** %5
%18 = load %struct.xhda_node*, %struct.xhda_node** %9
%19 = getelementptr inbounds [11 x %struct.xhda_node*], [11 x %struct.xhda_node*]* %8, i64 0, i64 0
%20 = load i32, i32* %7
%21 = call %struct.xhda_route_list* @routes_connected_from(%struct.xhda_codec* %17, %struct.xhda_node* %18, i32 0, %struct.xhda_node** %19, i32 %20, i32* null)
store %struct.xhda_route_list* %21, %struct.xhda_route_list** %4
br label %22
22: ; preds = %16, %15
%23 = load %struct.xhda_route_list*, %struct.xhda_route_list** %4
ret %struct.xhda_route_list* %23
}

LLVM IR (-O2):
%struct.xhda_route_list = type { i32 }
%struct.xhda_codec = type { i32 }
%struct.xhda_node = type { i32 }
define %struct.xhda_route_list* @hda_routes_connected_from(%struct.xhda_codec* %0, i32 %1, i32 %2) {
%4 = alloca [11 x %struct.xhda_node*]
%5 = bitcast [11 x %struct.xhda_node*]* %4 to i8*
%6 = tail call %struct.xhda_node* @find_node(%struct.xhda_codec* %0, i32 %1)
%7 = icmp eq %struct.xhda_node* %6, null
br i1 %7, label %11, label %8
8: ; preds = %3
%9 = getelementptr inbounds [11 x %struct.xhda_node*], [11 x %struct.xhda_node*]* %4, i64 0, i64 0
%10 = call %struct.xhda_route_list* @routes_connected_from(%struct.xhda_codec* %0, %struct.xhda_node* %6, i32 0, %struct.xhda_node** %9, i32 %2, i32* null)
br label %11
11: ; preds = %3, %8
%12 = phi %struct.xhda_route_list* [ %10, %8 ], [ null, %3 ]
ret %struct.xhda_route_list* %12
}