#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 node {
  int dummy;
};

/* Variables and functions */
struct node *mk_sexp(char *, int, int);
struct node *mk_symb(char *, int, int);
struct node *mk_node(char *str, int a, int b) {
  if (!str)
    return NULL;
  else if (str[a] == '(')
    return mk_sexp(str, a, b);
  else
    return mk_symb(str, a, b);
}


x86 assembly (clang, -O0):
<mk_node>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114a <mk_node+0x2a>
movq   $0x0,-0x8(%rbp)
jmp    118a <mk_node+0x6a>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x28,%eax
jne    1177 <mk_node+0x57>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1040 <mk_sexp@plt>
mov    %rax,-0x8(%rbp)
jmp    118a <mk_node+0x6a>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <mk_symb@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mk_node>:
test   %rdi,%rdi
je     1133 <mk_node+0x13>
movslq %esi,%rax
cmpb   $0x28,(%rdi,%rax,1)
jne    1136 <mk_node+0x16>
jmp    1040 <mk_sexp@plt>
xor    %eax,%eax
ret
jmp    1030 <mk_symb@plt>

LLVM IR (-O0):
%struct.node = type { i32 }
define %struct.node* @mk_node(i8* %0, i32 %1, i32 %2) {
%4 = alloca %struct.node*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = load i8*, i8** %5
%9 = icmp ne i8* %8, null
br i1 %9, label %11, label %10
10: ; preds = %3
store %struct.node* null, %struct.node** %4
br label %29
11: ; preds = %3
%12 = load i8*, i8** %5
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 40
br i1 %18, label %19, label %24
19: ; preds = %11
%20 = load i8*, i8** %5
%21 = load i32, i32* %6
%22 = load i32, i32* %7
%23 = call %struct.node* @mk_sexp(i8* %20, i32 %21, i32 %22)
store %struct.node* %23, %struct.node** %4
br label %29
24: ; preds = %11
%25 = load i8*, i8** %5
%26 = load i32, i32* %6
%27 = load i32, i32* %7
%28 = call %struct.node* @mk_symb(i8* %25, i32 %26, i32 %27)
store %struct.node* %28, %struct.node** %4
br label %29
29: ; preds = %24, %19, %10
%30 = load %struct.node*, %struct.node** %4
ret %struct.node* %30
}

LLVM IR (-O2):
%struct.node = type { i32 }
define %struct.node* @mk_node(i8* %0, i32 %1, i32 %2) {
%4 = icmp eq i8* %0, null
br i1 %4, label %14, label %5
5: ; preds = %3
%6 = sext i32 %1 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 40
br i1 %9, label %10, label %12
10: ; preds = %5
%11 = tail call %struct.node* @mk_sexp(i8* %0, i32 %1, i32 %2)
br label %14
12: ; preds = %5
%13 = tail call %struct.node* @mk_symb(i8* %0, i32 %1, i32 %2)
br label %14
14: ; preds = %3, %12, %10
%15 = phi %struct.node* [ %11, %10 ], [ %13, %12 ], [ null, %3 ]
ret %struct.node* %15
}