#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 keyval_token {
  int dummy;
};
struct keyval_node {
  int dummy;
};

/* Variables and functions */
struct keyval_node *keyval_parse_section(struct keyval_token **);
int /*<<< orphan*/ keyval_token_free_all(struct keyval_token *);
struct keyval_token *keyval_tokenize(char const *, char *);
struct keyval_node *keyval_parse_string(const char *data) {
  struct keyval_token *token = keyval_tokenize(data, "{}#=\n[],");
  struct keyval_token *token_old = token;
  struct keyval_node *node = keyval_parse_section(&token);
  keyval_token_free_all(token_old);
  return node;
}


x86 assembly (clang, -O0):
<keyval_parse_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1050 <keyval_tokenize@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <keyval_parse_section@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <keyval_token_free_all@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<keyval_parse_string>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%rsi
call   1050 <keyval_tokenize@plt>
mov    %rax,%rbx
mov    %rax,(%rsp)
mov    %rsp,%rdi
call   1030 <keyval_parse_section@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <keyval_token_free_all@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.keyval_node = type { i32 }
%struct.keyval_token = type { i32 }
@.str = [9 x i8] c"{}#=\0A[],\00"
define %struct.keyval_node* @keyval_parse_string(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.keyval_token*
%4 = alloca %struct.keyval_token*
%5 = alloca %struct.keyval_node*
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call %struct.keyval_token* @keyval_tokenize(i8* %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store %struct.keyval_token* %7, %struct.keyval_token** %3
%8 = load %struct.keyval_token*, %struct.keyval_token** %3
store %struct.keyval_token* %8, %struct.keyval_token** %4
%9 = call %struct.keyval_node* @keyval_parse_section(%struct.keyval_token** %3)
store %struct.keyval_node* %9, %struct.keyval_node** %5
%10 = load %struct.keyval_token*, %struct.keyval_token** %4
%11 = call i32 @keyval_token_free_all(%struct.keyval_token* %10)
%12 = load %struct.keyval_node*, %struct.keyval_node** %5
ret %struct.keyval_node* %12
}

LLVM IR (-O2):
%struct.keyval_node = type { i32 }
%struct.keyval_token = type { i32 }
@.str = [9 x i8] c"{}#=\0A[],\00"
define %struct.keyval_node* @keyval_parse_string(i8* %0) {
%2 = alloca %struct.keyval_token*
%3 = bitcast %struct.keyval_token** %2 to i8*
%4 = tail call %struct.keyval_token* @keyval_tokenize(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store %struct.keyval_token* %4, %struct.keyval_token** %2
%5 = call %struct.keyval_node* @keyval_parse_section(%struct.keyval_token** %2)
%6 = call i32 @keyval_token_free_all(%struct.keyval_token* %4)
ret %struct.keyval_node* %5
}