#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 confline {
  int dummy;
};
struct cnfnode {
  int dummy;
};
struct cnfmodule {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
struct confline *_parse_cyconf(struct cnfnode *, struct confline *);
struct cnfnode *create_cnfnode(char *);
int /*<<< orphan*/ destroy_confline_list(struct confline *);
struct confline *read_conflines(int /*<<< orphan*/ *);
struct cnfnode *parse_cyconf(struct cnfmodule *cm, FILE *fptr) {
  struct cnfnode *cn_root;
  struct confline *cl, *cl_root;
  cl_root = read_conflines(fptr);
  cn_root = create_cnfnode("(root)");
  for (cl = cl_root; cl;) {
    cl = _parse_cyconf(cn_root, cl);
  }
  destroy_confline_list(cl_root);
  return cn_root;
}


x86 assembly (clang, -O0):
<parse_cyconf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <read_conflines@plt>
mov    %rax,-0x28(%rbp)
lea    0xe9c(%rip),%rdi
call   1060 <create_cnfnode@plt>
mov    %rax,-0x18(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1196 <parse_cyconf+0x56>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <_parse_cyconf@plt>
mov    %rax,-0x20(%rbp)
jmp    1175 <parse_cyconf+0x35>
mov    -0x28(%rbp),%rdi
call   1030 <destroy_confline_list@plt>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_cyconf>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rdi
call   1040 <read_conflines@plt>
mov    %rax,%r14
lea    0xeaa(%rip),%rdi
call   1060 <create_cnfnode@plt>
mov    %rax,%rbx
test   %r14,%r14
je     1180 <parse_cyconf+0x40>
mov    %r14,%rax
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %rax,%rsi
call   1050 <_parse_cyconf@plt>
test   %rax,%rax
jne    1170 <parse_cyconf+0x30>
mov    %r14,%rdi
call   1030 <destroy_confline_list@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.cnfnode = type { i32 }
%struct.cnfmodule = type { i32 }
%struct.confline = type { i32 }
@.str = [7 x i8] c"(root)\00"
define %struct.cnfnode* @parse_cyconf(%struct.cnfmodule* %0, i32* %1) {
%3 = alloca %struct.cnfmodule*
%4 = alloca i32*
%5 = alloca %struct.cnfnode*
%6 = alloca %struct.confline*
%7 = alloca %struct.confline*
store %struct.cnfmodule* %0, %struct.cnfmodule** %3
store i32* %1, i32** %4
%8 = load i32*, i32** %4
%9 = call %struct.confline* @read_conflines(i32* %8)
store %struct.confline* %9, %struct.confline** %7
%10 = call %struct.cnfnode* @create_cnfnode(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store %struct.cnfnode* %10, %struct.cnfnode** %5
%11 = load %struct.confline*, %struct.confline** %7
store %struct.confline* %11, %struct.confline** %6
br label %12
12: ; preds = %15, %2
%13 = load %struct.confline*, %struct.confline** %6
%14 = icmp ne %struct.confline* %13, null
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load %struct.cnfnode*, %struct.cnfnode** %5
%17 = load %struct.confline*, %struct.confline** %6
%18 = call %struct.confline* @_parse_cyconf(%struct.cnfnode* %16, %struct.confline* %17)
store %struct.confline* %18, %struct.confline** %6
br label %12
19: ; preds = %12
%20 = load %struct.confline*, %struct.confline** %7
%21 = call i32 @destroy_confline_list(%struct.confline* %20)
%22 = load %struct.cnfnode*, %struct.cnfnode** %5
ret %struct.cnfnode* %22
}

LLVM IR (-O2):
%struct.cnfnode = type { i32 }
%struct.cnfmodule = type { i32 }
%struct.confline = type { i32 }
@.str = [7 x i8] c"(root)\00"
define %struct.cnfnode* @parse_cyconf(%struct.cnfmodule* nocapture readnone %0, i32* %1) {
%3 = tail call %struct.confline* @read_conflines(i32* %1)
%4 = tail call %struct.cnfnode* @create_cnfnode(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq %struct.confline* %3, null
br i1 %5, label %10, label %6
6: ; preds = %2, %6
%7 = phi %struct.confline* [ %8, %6 ], [ %3, %2 ]
%8 = tail call %struct.confline* @_parse_cyconf(%struct.cnfnode* %4, %struct.confline* %7)
%9 = icmp eq %struct.confline* %8, null
br i1 %9, label %10, label %6
10: ; preds = %6, %2
%11 = tail call i32 @destroy_confline_list(%struct.confline* %3)
ret %struct.cnfnode* %4
}