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

/* Variables and functions */
char *ast_to_string(struct ast_node *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ icase_ast(struct ast_node **);
struct ast_node *parse_file(int /*<<< orphan*/);
int /*<<< orphan*/ print_ast_node(int /*<<< orphan*/, struct ast_node *,
                                  int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main(void) {
  struct ast_node *root;
  root = parse_file(stdin);
  print_ast_node(stdout, root, 0);
  {
    char *pat = ast_to_string(root);
    printf("Parsed pattern: '%s'\n", pat);
    free(pat);
  }
  printf("case-insensitive version:\n");
  icase_ast(&root);
  print_ast_node(stdout, root, 0);
  {
    char *pat = ast_to_string(root);
    printf("Parsed pattern: '%s'\n", pat);
    free(pat);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
call   1070 <parse_file@plt>
mov    %rax,-0x10(%rbp)
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
xor    %edx,%edx
call   1080 <print_ast_node@plt>
mov    -0x10(%rbp),%rdi
call   1040 <ast_to_string@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x10(%rbp),%rdi
call   1060 <icase_ast@plt>
mov    0x2dfd(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
xor    %edx,%edx
call   1080 <print_ast_node@plt>
mov    -0x10(%rbp),%rdi
call   1040 <ast_to_string@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    0x2e68(%rip),%rax
mov    (%rax),%edi
call   1080 <parse_file@plt>
mov    %rax,%rbx
mov    %rax,0x8(%rsp)
mov    0x2e42(%rip),%r15
mov    (%r15),%edi
mov    %rax,%rsi
xor    %edx,%edx
call   1090 <print_ast_node@plt>
mov    %rbx,%rdi
call   1050 <ast_to_string@plt>
mov    %rax,%rbx
lea    0xe4b(%rip),%r14
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xe45(%rip),%rdi
call   1040 <puts@plt>
lea    0x8(%rsp),%rdi
call   1070 <icase_ast@plt>
mov    (%r15),%edi
mov    0x8(%rsp),%rsi
xor    %edx,%edx
call   1090 <print_ast_node@plt>
mov    0x8(%rsp),%rdi
call   1050 <ast_to_string@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.ast_node = type { i32 }
@stdin = global i32 0
@stdout = global i32 0
@.str = [22 x i8] c"Parsed pattern: '%s'\0A\00"
@.str.1 = [27 x i8] c"case-insensitive version:\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.ast_node*
%3 = alloca i8*
%4 = alloca i8*
store i32 0, i32* %1
%5 = load i32, i32* @stdin
%6 = call %struct.ast_node* @parse_file(i32 %5)
store %struct.ast_node* %6, %struct.ast_node** %2
%7 = load i32, i32* @stdout
%8 = load %struct.ast_node*, %struct.ast_node** %2
%9 = call i32 @print_ast_node(i32 %7, %struct.ast_node* %8, i32 0)
%10 = load %struct.ast_node*, %struct.ast_node** %2
%11 = call i8* @ast_to_string(%struct.ast_node* %10)
store i8* %11, i8** %3
%12 = load i8*, i8** %3
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = load i8*, i8** %3
%15 = call i32 @free(i8* %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 @icase_ast(%struct.ast_node** %2)
%18 = load i32, i32* @stdout
%19 = load %struct.ast_node*, %struct.ast_node** %2
%20 = call i32 @print_ast_node(i32 %18, %struct.ast_node* %19, i32 0)
%21 = load %struct.ast_node*, %struct.ast_node** %2
%22 = call i8* @ast_to_string(%struct.ast_node* %21)
store i8* %22, i8** %4
%23 = load i8*, i8** %4
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %23)
%25 = load i8*, i8** %4
%26 = call i32 @free(i8* %25)
ret i32 0
}

LLVM IR (-O2):
%struct.ast_node = type { i32 }
@stdin = global i32 0
@stdout = global i32 0
@.str = [22 x i8] c"Parsed pattern: '%s'\0A\00"
@str = [26 x i8] c"case-insensitive version:\00"
define i32 @main() {
%1 = alloca %struct.ast_node*
%2 = bitcast %struct.ast_node** %1 to i8*
%3 = load i32, i32* @stdin
%4 = tail call %struct.ast_node* @parse_file(i32 %3)
store %struct.ast_node* %4, %struct.ast_node** %1
%5 = load i32, i32* @stdout
%6 = tail call i32 @print_ast_node(i32 %5, %struct.ast_node* %4, i32 0)
%7 = tail call i8* @ast_to_string(%struct.ast_node* %4)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = tail call i32 @free(i8* %7)
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%11 = call i32 @icase_ast(%struct.ast_node** %1)
%12 = load i32, i32* @stdout
%13 = load %struct.ast_node*, %struct.ast_node** %1
%14 = call i32 @print_ast_node(i32 %12, %struct.ast_node* %13, i32 0)
%15 = load %struct.ast_node*, %struct.ast_node** %1
%16 = call i8* @ast_to_string(%struct.ast_node* %15)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = call i32 @free(i8* %16)
ret i32 0
}