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

/* Variables and functions */
int /*<<< orphan*/ copy_body();
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ free_params(struct params *);
scalar_t__ read_func_header(char **, struct params **, struct params **);
char *read_package();
int /*<<< orphan*/ read_preprocessor_lines();
int /*<<< orphan*/ write_func_header(char *, char *, struct params *,
                                     struct params *);
int /*<<< orphan*/ write_func_trailer(char *, char *, struct params *);
void process_file(void) {
  char *package, *name;
  struct params *params, *rets;
  package = read_package();
  read_preprocessor_lines();
  while (read_func_header(&name, &params, &rets)) {
    write_func_header(package, name, params, rets);
    copy_body();
    write_func_trailer(package, name, rets);
    free(name);
    free_params(params);
    free_params(rets);
  }
  free(package);
}


x86 assembly (clang, -O0):
<process_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1090 <read_package@plt>
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <read_preprocessor_lines@plt>
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1060 <read_func_header@plt>
cmp    $0x0,%rax
je     1202 <process_file+0x82>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1070 <write_func_header@plt>
mov    $0x0,%al
call   10a0 <copy_body@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1080 <write_func_trailer@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1050 <free_params@plt>
mov    -0x20(%rbp),%rdi
call   1050 <free_params@plt>
jmp    119a <process_file+0x1a>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_file>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %eax,%eax
call   1090 <read_package@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <read_preprocessor_lines@plt>
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    %rsp,%rdx
call   1060 <read_func_header@plt>
test   %rax,%rax
je     121e <process_file+0x9e>
lea    0x8(%rsp),%r14
lea    0x10(%rsp),%r15
mov    %rsp,%r12
mov    0x8(%rsp),%rsi
mov    0x10(%rsp),%rdx
mov    (%rsp),%rcx
mov    %rbx,%rdi
call   1070 <write_func_header@plt>
xor    %eax,%eax
call   10a0 <copy_body@plt>
mov    0x8(%rsp),%rsi
mov    (%rsp),%rdx
mov    %rbx,%rdi
call   1080 <write_func_trailer@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    0x10(%rsp),%rdi
call   1050 <free_params@plt>
mov    (%rsp),%rdi
call   1050 <free_params@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1060 <read_func_header@plt>
test   %rax,%rax
jne    11c0 <process_file+0x40>
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.params = type { i32 }
define void @process_file() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca %struct.params*
%4 = alloca %struct.params*
%5 = call i8* (...) @read_package()
store i8* %5, i8** %1
%6 = call i32 (...) @read_preprocessor_lines()
br label %7
7: ; preds = %10, %0
%8 = call i64 @read_func_header(i8** %2, %struct.params** %3, %struct.params** %4)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %27
10: ; preds = %7
%11 = load i8*, i8** %1
%12 = load i8*, i8** %2
%13 = load %struct.params*, %struct.params** %3
%14 = load %struct.params*, %struct.params** %4
%15 = call i32 @write_func_header(i8* %11, i8* %12, %struct.params* %13, %struct.params* %14)
%16 = call i32 (...) @copy_body()
%17 = load i8*, i8** %1
%18 = load i8*, i8** %2
%19 = load %struct.params*, %struct.params** %4
%20 = call i32 @write_func_trailer(i8* %17, i8* %18, %struct.params* %19)
%21 = load i8*, i8** %2
%22 = call i32 @free(i8* %21)
%23 = load %struct.params*, %struct.params** %3
%24 = call i32 @free_params(%struct.params* %23)
%25 = load %struct.params*, %struct.params** %4
%26 = call i32 @free_params(%struct.params* %25)
br label %7
27: ; preds = %7
%28 = load i8*, i8** %1
%29 = call i32 @free(i8* %28)
ret void
}

LLVM IR (-O2):
%struct.params = type { i32 }
define void @process_file() {
%1 = alloca i8*
%2 = alloca %struct.params*
%3 = alloca %struct.params*
%4 = bitcast i8** %1 to i8*
%5 = bitcast %struct.params** %2 to i8*
%6 = bitcast %struct.params** %3 to i8*
%7 = tail call i8* (...) @read_package()
%8 = tail call i32 (...) @read_preprocessor_lines()
%9 = call i64 @read_func_header(i8** %1, %struct.params** %2, %struct.params** %3)
%10 = icmp eq i64 %9, 0
br i1 %10, label %28, label %11
11: ; preds = %0, %11
%12 = load i8*, i8** %1
%13 = load %struct.params*, %struct.params** %2
%14 = load %struct.params*, %struct.params** %3
%15 = call i32 @write_func_header(i8* %7, i8* %12, %struct.params* %13, %struct.params* %14)
%16 = call i32 (...) @copy_body()
%17 = load i8*, i8** %1
%18 = load %struct.params*, %struct.params** %3
%19 = call i32 @write_func_trailer(i8* %7, i8* %17, %struct.params* %18)
%20 = load i8*, i8** %1
%21 = call i32 @free(i8* %20)
%22 = load %struct.params*, %struct.params** %2
%23 = call i32 @free_params(%struct.params* %22)
%24 = load %struct.params*, %struct.params** %3
%25 = call i32 @free_params(%struct.params* %24)
%26 = call i64 @read_func_header(i8** %1, %struct.params** %2, %struct.params** %3)
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %11
28: ; preds = %11, %0
%29 = call i32 @free(i8* %7)
ret void
}