#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ printf_buffer(int /*<<< orphan*/ *, char *, int, size_t *,
                                 char *, ...);
void printf_header(FILE *f, char *buffer, const size_t max_buf,
                   size_t *buf_idx_ptr, const char *name, const char *dtype,
                   int rows, int cols, int isFloat) {
  printf_buffer(f, buffer, 2048, buf_idx_ptr, "# name: %s\n", name);
  printf_buffer(f, buffer, 2048, buf_idx_ptr, "# type: %s\n", dtype);
  printf_buffer(f, buffer, 2048, buf_idx_ptr, "# rows: %d\n", rows);
  printf_buffer(f, buffer, 2048, buf_idx_ptr, "# columns: %d\n", cols);
}


x86 assembly (clang, -O0):
<printf_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r9
mov    $0x800,%edx
lea    0xeab(%rip),%r8
mov    $0x0,%al
call   1030 <printf_buffer@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rcx
mov    -0x30(%rbp),%r9
mov    $0x800,%edx
lea    0xe94(%rip),%r8
mov    $0x0,%al
call   1030 <printf_buffer@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rcx
mov    0x10(%rbp),%r9d
mov    $0x800,%edx
lea    0xe7d(%rip),%r8
mov    $0x0,%al
call   1030 <printf_buffer@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rcx
mov    0x18(%rbp),%r9d
mov    $0x800,%edx
lea    0xe66(%rip),%r8
mov    $0x0,%al
call   1030 <printf_buffer@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printf_header>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r13
mov    %r8,%r9
mov    %rcx,%r15
mov    %rsi,%rbp
mov    %rdi,%rbx
mov    0x48(%rsp),%r14d
mov    0x40(%rsp),%r12d
lea    0xec5(%rip),%r8
mov    $0x800,%edx
xor    %eax,%eax
call   1030 <printf_buffer@plt>
lea    0xebe(%rip),%r8
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x800,%edx
mov    %r15,%rcx
mov    %r13,%r9
xor    %eax,%eax
call   1030 <printf_buffer@plt>
lea    0xeab(%rip),%r8
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x800,%edx
mov    %r15,%rcx
mov    %r12d,%r9d
xor    %eax,%eax
call   1030 <printf_buffer@plt>
lea    0xe98(%rip),%r8
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x800,%edx
mov    %r15,%rcx
mov    %r14d,%r9d
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf_buffer@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"# name: %s\0A\00"
@.str.1 = [12 x i8] c"# type: %s\0A\00"
@.str.2 = [12 x i8] c"# rows: %d\0A\00"
@.str.3 = [15 x i8] c"# columns: %d\0A\00"
define void @printf_header(i32* %0, i8* %1, i64 %2, i64* %3, i8* %4, i8* %5, i32 %6, i32 %7, i32 %8) {
%10 = alloca i32*
%11 = alloca i8*
%12 = alloca i64
%13 = alloca i64*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
store i32* %0, i32** %10
store i8* %1, i8** %11
store i64 %2, i64* %12
store i64* %3, i64** %13
store i8* %4, i8** %14
store i8* %5, i8** %15
store i32 %6, i32* %16
store i32 %7, i32* %17
store i32 %8, i32* %18
%19 = load i32*, i32** %10
%20 = load i8*, i8** %11
%21 = load i64*, i64** %13
%22 = load i8*, i8** %14
%23 = call i32 (i32*, i8*, i32, i64*, i8*, ...) @printf_buffer(i32* %19, i8* %20, i32 2048, i64* %21, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %22)
%24 = load i32*, i32** %10
%25 = load i8*, i8** %11
%26 = load i64*, i64** %13
%27 = load i8*, i8** %15
%28 = call i32 (i32*, i8*, i32, i64*, i8*, ...) @printf_buffer(i32* %24, i8* %25, i32 2048, i64* %26, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %27)
%29 = load i32*, i32** %10
%30 = load i8*, i8** %11
%31 = load i64*, i64** %13
%32 = load i32, i32* %16
%33 = call i32 (i32*, i8*, i32, i64*, i8*, ...) @printf_buffer(i32* %29, i8* %30, i32 2048, i64* %31, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %32)
%34 = load i32*, i32** %10
%35 = load i8*, i8** %11
%36 = load i64*, i64** %13
%37 = load i32, i32* %17
%38 = call i32 (i32*, i8*, i32, i64*, i8*, ...) @printf_buffer(i32* %34, i8* %35, i32 2048, i64* %36, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %37)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"# name: %s\0A\00"
@.str.1 = [12 x i8] c"# type: %s\0A\00"
@.str.2 = [12 x i8] c"# rows: %d\0A\00"
@.str.3 = [15 x i8] c"# columns: %d\0A\00"
define void @printf_header(i32* %0, i8* %1, i64 %2, i64* %3, i8* %4, i8* %5, i32 %6, i32 %7, i32 %8) {
%10 = tail call i32 (i32*, i8*, i32, i64*, i8*, ...) @printf_buffer(i32* %0, i8* %1, i32 2048, i64* %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %4)
%11 = tail call i32 (i32*, i8*, i32, i64*, i8*, ...) @printf_buffer(i32* %0, i8* %1, i32 2048, i64* %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%12 = tail call i32 (i32*, i8*, i32, i64*, i8*, ...) @printf_buffer(i32* %0, i8* %1, i32 2048, i64* %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%13 = tail call i32 (i32*, i8*, i32, i64*, i8*, ...) @printf_buffer(i32* %0, i8* %1, i32 2048, i64* %3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %7)
ret void
}