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

/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ print_fields(struct util_rec *);
int /*<<< orphan*/ print_records(char *, struct util_rec *);
int /*<<< orphan*/ util_rec_free(struct util_rec *);
struct util_rec *util_rec_new_csv(char *);
struct util_rec *util_rec_new_long(char *, char *, char *, int, int);
struct util_rec *util_rec_new_wide(char *);
int /*<<< orphan*/ util_rec_set_indent(struct util_rec *, int);
int main(void) {
  struct util_rec *rec;
  rec = util_rec_new_wide("-");
  print_records("Wide format", rec);
  util_rec_free(rec);
  rec = util_rec_new_wide("-");
  util_rec_set_indent(rec, 4);
  print_records("Wide format with indentation", rec);
  util_rec_free(rec);
  rec = util_rec_new_long("-", ":", "number", 30, 20);
  print_records("Long format", rec);
  util_rec_free(rec);
  rec = util_rec_new_csv(",");
  print_records("CSV format", rec);
  print_fields(rec);
  util_rec_free(rec);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe7a(%rip),%rdi
call   1080 <util_rec_new_wide@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe68(%rip),%rdi
call   1060 <print_records@plt>
mov    -0x10(%rbp),%rdi
call   1030 <util_rec_free@plt>
lea    0xe51(%rip),%rdi
call   1080 <util_rec_new_wide@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1070 <util_rec_set_indent@plt>
mov    -0x10(%rbp),%rsi
lea    0xe3d(%rip),%rdi
call   1060 <print_records@plt>
mov    -0x10(%rbp),%rdi
call   1030 <util_rec_free@plt>
lea    0xe1a(%rip),%rdi
lea    0xe3e(%rip),%rsi
lea    0xe39(%rip),%rdx
mov    $0x1e,%ecx
mov    $0x14,%r8d
call   1040 <util_rec_new_long@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe21(%rip),%rdi
call   1060 <print_records@plt>
mov    -0x10(%rbp),%rdi
call   1030 <util_rec_free@plt>
lea    0xe18(%rip),%rdi
call   1050 <util_rec_new_csv@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe06(%rip),%rdi
call   1060 <print_records@plt>
mov    -0x10(%rbp),%rdi
call   1090 <print_fields@plt>
mov    -0x10(%rbp),%rdi
call   1030 <util_rec_free@plt>
mov    0x2d86(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xe85(%rip),%r14
mov    %r14,%rdi
call   1080 <util_rec_new_wide@plt>
mov    %rax,%rbx
lea    0xe75(%rip),%rdi
mov    %rax,%rsi
call   1060 <print_records@plt>
mov    %rbx,%rdi
call   1030 <util_rec_free@plt>
mov    %r14,%rdi
call   1080 <util_rec_new_wide@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x4,%esi
call   1070 <util_rec_set_indent@plt>
lea    0xe52(%rip),%rdi
mov    %rbx,%rsi
call   1060 <print_records@plt>
mov    %rbx,%rdi
call   1030 <util_rec_free@plt>
lea    0xe58(%rip),%rsi
lea    0xe53(%rip),%rdx
mov    %r14,%rdi
mov    $0x1e,%ecx
mov    $0x14,%r8d
call   1040 <util_rec_new_long@plt>
mov    %rax,%rbx
lea    0xe3d(%rip),%rdi
mov    %rax,%rsi
call   1060 <print_records@plt>
mov    %rbx,%rdi
call   1030 <util_rec_free@plt>
lea    0xe32(%rip),%rdi
call   1050 <util_rec_new_csv@plt>
mov    %rax,%rbx
lea    0xe25(%rip),%rdi
mov    %rax,%rsi
call   1060 <print_records@plt>
mov    %rbx,%rdi
call   1090 <print_fields@plt>
mov    %rbx,%rdi
call   1030 <util_rec_free@plt>
mov    0x2da4(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.util_rec = type { i32 }
@.str = [2 x i8] c"-\00"
@.str.1 = [12 x i8] c"Wide format\00"
@.str.2 = [29 x i8] c"Wide format with indentation\00"
@.str.3 = [2 x i8] c":\00"
@.str.4 = [7 x i8] c"number\00"
@.str.5 = [12 x i8] c"Long format\00"
@.str.6 = [2 x i8] c",\00"
@.str.7 = [11 x i8] c"CSV format\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.util_rec*
store i32 0, i32* %1
%3 = call %struct.util_rec* @util_rec_new_wide(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store %struct.util_rec* %3, %struct.util_rec** %2
%4 = load %struct.util_rec*, %struct.util_rec** %2
%5 = call i32 @print_records(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), %struct.util_rec* %4)
%6 = load %struct.util_rec*, %struct.util_rec** %2
%7 = call i32 @util_rec_free(%struct.util_rec* %6)
%8 = call %struct.util_rec* @util_rec_new_wide(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store %struct.util_rec* %8, %struct.util_rec** %2
%9 = load %struct.util_rec*, %struct.util_rec** %2
%10 = call i32 @util_rec_set_indent(%struct.util_rec* %9, i32 4)
%11 = load %struct.util_rec*, %struct.util_rec** %2
%12 = call i32 @print_records(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), %struct.util_rec* %11)
%13 = load %struct.util_rec*, %struct.util_rec** %2
%14 = call i32 @util_rec_free(%struct.util_rec* %13)
%15 = call %struct.util_rec* @util_rec_new_long(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 30, i32 20)
store %struct.util_rec* %15, %struct.util_rec** %2
%16 = load %struct.util_rec*, %struct.util_rec** %2
%17 = call i32 @print_records(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), %struct.util_rec* %16)
%18 = load %struct.util_rec*, %struct.util_rec** %2
%19 = call i32 @util_rec_free(%struct.util_rec* %18)
%20 = call %struct.util_rec* @util_rec_new_csv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store %struct.util_rec* %20, %struct.util_rec** %2
%21 = load %struct.util_rec*, %struct.util_rec** %2
%22 = call i32 @print_records(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), %struct.util_rec* %21)
%23 = load %struct.util_rec*, %struct.util_rec** %2
%24 = call i32 @print_fields(%struct.util_rec* %23)
%25 = load %struct.util_rec*, %struct.util_rec** %2
%26 = call i32 @util_rec_free(%struct.util_rec* %25)
%27 = load i32, i32* @EXIT_SUCCESS
ret i32 %27
}

LLVM IR (-O2):
%struct.util_rec = type { i32 }
@.str = [2 x i8] c"-\00"
@.str.1 = [12 x i8] c"Wide format\00"
@.str.2 = [29 x i8] c"Wide format with indentation\00"
@.str.3 = [2 x i8] c":\00"
@.str.4 = [7 x i8] c"number\00"
@.str.5 = [12 x i8] c"Long format\00"
@.str.6 = [2 x i8] c",\00"
@.str.7 = [11 x i8] c"CSV format\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call %struct.util_rec* @util_rec_new_wide(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @print_records(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), %struct.util_rec* %1)
%3 = tail call i32 @util_rec_free(%struct.util_rec* %1)
%4 = tail call %struct.util_rec* @util_rec_new_wide(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @util_rec_set_indent(%struct.util_rec* %4, i32 4)
%6 = tail call i32 @print_records(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), %struct.util_rec* %4)
%7 = tail call i32 @util_rec_free(%struct.util_rec* %4)
%8 = tail call %struct.util_rec* @util_rec_new_long(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 30, i32 20)
%9 = tail call i32 @print_records(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), %struct.util_rec* %8)
%10 = tail call i32 @util_rec_free(%struct.util_rec* %8)
%11 = tail call %struct.util_rec* @util_rec_new_csv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%12 = tail call i32 @print_records(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), %struct.util_rec* %11)
%13 = tail call i32 @print_fields(%struct.util_rec* %11)
%14 = tail call i32 @util_rec_free(%struct.util_rec* %11)
%15 = load i32, i32* @EXIT_SUCCESS
ret i32 %15
}