#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ putc(char, int /*<<< orphan*/ *);
void outputfilefinish(FILE *outfile, int argc, char **argv) {
  int i;
  fputs("# Generated by", outfile);
  for (i = 0; i < argc; i++) {
    putc(' ', outfile);
    fputs(argv[i], outfile);
  }
  putc('\n', outfile);
  fclose(outfile);
}


x86 assembly (clang, -O0):
<outputfilefinish>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeb2(%rip),%rdi
call   1040 <fputs@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1197 <outputfilefinish+0x67>
mov    -0x8(%rbp),%rsi
mov    $0x20,%edi
call   1050 <putc@plt>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <fputs@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    115a <outputfilefinish+0x2a>
mov    -0x8(%rbp),%rsi
mov    $0xa,%edi
call   1050 <putc@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outputfilefinish>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xeaa(%rip),%rdi
mov    $0xe,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
test   %ebp,%ebp
jle    11a2 <outputfilefinish+0x62>
mov    %ebp,%r15d
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
mov    %rbx,%rsi
call   1050 <putc@plt>
mov    (%r14,%rbp,8),%rdi
mov    %rbx,%rsi
call   1040 <fputs@plt>
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1180 <outputfilefinish+0x40>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1050 <putc@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"# Generated by\00"
define void @outputfilefinish(i32* %0, i32 %1, i8** %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
%8 = load i32*, i32** %4
%9 = call i32 @fputs(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32* %8)
store i32 0, i32* %7
br label %10
10: ; preds = %24, %3
%11 = load i32, i32* %7
%12 = load i32, i32* %5
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %27
14: ; preds = %10
%15 = load i32*, i32** %4
%16 = call i32 @putc(i8 signext 32, i32* %15)
%17 = load i8**, i8*** %6
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8*, i8** %17, i64 %19
%21 = load i8*, i8** %20
%22 = load i32*, i32** %4
%23 = call i32 @fputs(i8* %21, i32* %22)
br label %24
24: ; preds = %14
%25 = load i32, i32* %7
%26 = add nsw i32 %25, 1
store i32 %26, i32* %7
br label %10
27: ; preds = %10
%28 = load i32*, i32** %4
%29 = call i32 @putc(i8 signext 10, i32* %28)
%30 = load i32*, i32** %4
%31 = call i32 @fclose(i32* %30)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"# Generated by\00"
define void @outputfilefinish(i32* nocapture %0, i32 %1, i8** nocapture %2) {
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i64 14, i64 1, i32* %0)
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %16
6: ; preds = %3
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %14, %8 ]
%10 = tail call i32 @putc(i8 signext 32, i32* %0)
%11 = getelementptr inbounds i8*, i8** %2, i64 %9
%12 = load i8*, i8** %11
%13 = tail call i32 @fputs(i8* %12, i32* %0)
%14 = add nuw nsw i64 %9, 1
%15 = icmp eq i64 %14, %7
br i1 %15, label %16, label %8
16: ; preds = %8, %3
%17 = tail call i32 @putc(i8 signext 10, i32* %0)
%18 = tail call i32 @fclose(i32* %0)
ret void
}