#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*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ pad_blanks(char *, int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void hdr_strg(FILE *f, char var[], char str[], int len, char comment[]) {
  char line[256];
  strcpy(line, var);
  pad_blanks(line, 8);
  strcat(line, "= '");
  strcat(line, str);
  pad_blanks(line, len + 12 - 1);
  strcat(line, "'");
  if (*comment != '\0') {
    strcat(line, "/ ");
    strcat(line, comment);
  }
  fprintf(f, "%s\n", line);
}


x86 assembly (clang, -O0):
<hdr_strg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
lea    -0x130(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x130(%rbp),%rdi
mov    $0x8,%esi
call   1050 <pad_blanks@plt>
lea    -0x130(%rbp),%rdi
lea    0xe73(%rip),%rsi
call   1060 <strcat@plt>
lea    -0x130(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <strcat@plt>
lea    -0x130(%rbp),%rdi
mov    -0x1c(%rbp),%esi
add    $0xc,%esi
sub    $0x1,%esi
call   1050 <pad_blanks@plt>
lea    -0x130(%rbp),%rdi
lea    0xe3d(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11fd <hdr_strg+0xbd>
lea    -0x130(%rbp),%rdi
lea    0xe1c(%rip),%rsi
call   1060 <strcat@plt>
lea    -0x130(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x8(%rbp),%rdi
lea    -0x130(%rbp),%rdx
lea    0xdf8(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hdr_strg>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x100,%rsp
mov    %r8,%r15
mov    %ecx,%ebp
mov    %rdx,%r12
mov    %rdi,%r14
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1050 <pad_blanks@plt>
lea    0xe87(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1060 <strcat@plt>
add    $0xb,%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
call   1050 <pad_blanks@plt>
lea    0xe62(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
cmpb   $0x0,(%r15)
je     11cb <hdr_strg+0x8b>
lea    0xe4f(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1060 <strcat@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <strcat@plt>
lea    0xe35(%rip),%rsi
mov    %rsp,%rdx
mov    %r14,%rdi
call   1040 <fprintf@plt>
add    $0x100,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"= '\00"
@.str.1 = [2 x i8] c"'\00"
@.str.2 = [3 x i8] c"/ \00"
@.str.3 = [4 x i8] c"%s\0A\00"
define void @hdr_strg(i32* %0, i8* %1, i8* %2, i32 %3, i8* %4) {
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca [256 x i8]
store i32* %0, i32** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%13 = load i8*, i8** %7
%14 = call i32 @strcpy(i8* %12, i8* %13)
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%16 = call i32 @pad_blanks(i8* %15, i32 8)
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%18 = call i32 @strcat(i8* %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%20 = load i8*, i8** %8
%21 = call i32 @strcat(i8* %19, i8* %20)
%22 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%23 = load i32, i32* %9
%24 = add nsw i32 %23, 12
%25 = sub nsw i32 %24, 1
%26 = call i32 @pad_blanks(i8* %22, i32 %25)
%27 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%28 = call i32 @strcat(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%29 = load i8*, i8** %10
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %39
33: ; preds = %5
%34 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%35 = call i32 @strcat(i8* %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%36 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%37 = load i8*, i8** %10
%38 = call i32 @strcat(i8* %36, i8* %37)
br label %39
39: ; preds = %33, %5
%40 = load i32*, i32** %6
%41 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%42 = call i32 @fprintf(i32* %40, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %41)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"= '\00"
@.str.1 = [2 x i8] c"'\00"
@.str.2 = [3 x i8] c"/ \00"
@.str.3 = [4 x i8] c"%s\0A\00"
define void @hdr_strg(i32* nocapture %0, i8* %1, i8* %2, i32 %3, i8* %4) {
%6 = alloca [256 x i8]
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%8 = call i32 @strcpy(i8* %7, i8* %1)
%9 = call i32 @pad_blanks(i8* %7, i32 8)
%10 = call i32 @strcat(i8* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @strcat(i8* %7, i8* %2)
%12 = add nsw i32 %3, 11
%13 = call i32 @pad_blanks(i8* %7, i32 %12)
%14 = call i32 @strcat(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%15 = load i8, i8* %4
%16 = icmp eq i8 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %5
%18 = call i32 @strcat(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 @strcat(i8* %7, i8* %4)
br label %20
20: ; preds = %17, %5
%21 = call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %7)
ret void
}