#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 *, ...);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int strlen(char *);
void opt_fileheader(FILE *fp) {
  extern char *opt_program_name;
  int i, n;
  char buf[80];
  sprintf(buf, "Options file created by: [%.30s]", opt_program_name);
  n = strlen(buf);
  fputc(';', fp);
  fprintf(fp, "%s", buf);
  fputc(';', fp);
  fputc('\n', fp);
  fputc(';', fp);
  for (i = 0; i < n; ++i)
    fprintf(fp, "-");
  fputc(';', fp);
  fputc('\n', fp);
}


x86 assembly (clang, -O0):
<opt_fileheader>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x60(%rbp),%rdi
mov    0x2e91(%rip),%rax
mov    (%rax),%rdx
lea    0xe9f(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0x60(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0x3b,%edi
call   1040 <fputc@plt>
mov    -0x8(%rbp),%rdi
lea    -0x60(%rbp),%rdx
lea    0xe92(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rsi
mov    $0x3b,%edi
call   1040 <fputc@plt>
mov    -0x8(%rbp),%rsi
mov    $0xa,%edi
call   1040 <fputc@plt>
mov    -0x8(%rbp),%rsi
mov    $0x3b,%edi
call   1040 <fputc@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11f3 <opt_fileheader+0xb3>
mov    -0x8(%rbp),%rdi
lea    0xe46(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c7 <opt_fileheader+0x87>
mov    -0x8(%rbp),%rsi
mov    $0x3b,%edi
call   1040 <fputc@plt>
mov    -0x8(%rbp),%rsi
mov    $0xa,%edi
call   1040 <fputc@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<opt_fileheader>:
push   %rbp
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    %rdi,%rbx
mov    0x2e96(%rip),%rax
mov    (%rax),%rdx
lea    0xea4(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1060 <sprintf@plt>
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    $0x3b,%edi
mov    %rbx,%rsi
call   1050 <fputc@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <fputs@plt>
mov    $0x3b,%edi
mov    %rbx,%rsi
call   1050 <fputc@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1050 <fputc@plt>
mov    $0x3b,%edi
mov    %rbx,%rsi
call   1050 <fputc@plt>
test   %ebp,%ebp
jle    11d2 <opt_fileheader+0x92>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x2d,%edi
mov    %rbx,%rsi
call   1050 <fputc@plt>
add    $0xffffffff,%ebp
jne    11c0 <opt_fileheader+0x80>
mov    $0x3b,%edi
mov    %rbx,%rsi
call   1050 <fputc@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1050 <fputc@plt>
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Options file created by: [%.30s]\00"
@opt_program_name = external global i8*
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [2 x i8] c"-\00"
define void @opt_fileheader(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca [80 x i8]
store i32* %0, i32** %2
%6 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%7 = load i8*, i8** @opt_program_name
%8 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%10 = call i32 @strlen(i8* %9)
store i32 %10, i32* %4
%11 = load i32*, i32** %2
%12 = call i32 @fputc(i8 signext 59, i32* %11)
%13 = load i32*, i32** %2
%14 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%15 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = load i32*, i32** %2
%17 = call i32 @fputc(i8 signext 59, i32* %16)
%18 = load i32*, i32** %2
%19 = call i32 @fputc(i8 signext 10, i32* %18)
%20 = load i32*, i32** %2
%21 = call i32 @fputc(i8 signext 59, i32* %20)
store i32 0, i32* %3
br label %22
22: ; preds = %29, %1
%23 = load i32, i32* %3
%24 = load i32, i32* %4
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %32
26: ; preds = %22
%27 = load i32*, i32** %2
%28 = call i32 (i32*, i8*, ...) @fprintf(i32* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %29
29: ; preds = %26
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
store i32 %31, i32* %3
br label %22
32: ; preds = %22
%33 = load i32*, i32** %2
%34 = call i32 @fputc(i8 signext 59, i32* %33)
%35 = load i32*, i32** %2
%36 = call i32 @fputc(i8 signext 10, i32* %35)
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"Options file created by: [%.30s]\00"
@opt_program_name = external global i8*
define void @opt_fileheader(i32* %0) {
%2 = alloca [80 x i8]
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%4 = load i8*, i8** @opt_program_name
%5 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @strlen(i8* %3)
%7 = call i32 @fputc(i8 signext 59, i32* %0)
%8 = call i32 @fputs(i8* %3, i32* %0)
%9 = call i32 @fputc(i8 signext 59, i32* %0)
%10 = call i32 @fputc(i8 signext 10, i32* %0)
%11 = call i32 @fputc(i8 signext 59, i32* %0)
%12 = icmp sgt i32 %6, 0
br i1 %12, label %13, label %18
13: ; preds = %1, %13
%14 = phi i32 [ %16, %13 ], [ 0, %1 ]
%15 = call i32 bitcast (i32 (i8, i32*)* @fputc to i32 (i32, i32*)*)(i32 45, i32* %0)
%16 = add nuw nsw i32 %14, 1
%17 = icmp eq i32 %16, %6
br i1 %17, label %18, label %13
18: ; preds = %13, %1
%19 = call i32 @fputc(i8 signext 59, i32* %0)
%20 = call i32 @fputc(i8 signext 10, i32* %0)
ret void
}