#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 BUFSIZ;
char *GetAChar(int /*<<< orphan*/ *);
int /*<<< orphan*/ MB_CUR_MAX;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
scalar_t__ isspace(char);
int mblen(char *, int /*<<< orphan*/);
void MergeMetaInfo(FILE *infile, FILE *outfile) {
  char buff[BUFSIZ];
  char *nextC;
  char *writeC, *token;
  fprintf(outfile, "# Meta Information\n");
  fseek(infile, 0, SEEK_SET);
  while ((*(nextC = GetAChar(infile)) != '\0') &&
         (mblen(nextC, MB_CUR_MAX) == 1) && isspace(*nextC))
    ;
  fputs(nextC, outfile);
  while (*(nextC = GetAChar(infile)))
    fputs(nextC, outfile);
  fputs("\n\n", outfile);
}


x86 assembly (clang, -O0):
<MergeMetaInfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e61(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe71(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e31(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1070 <fseek@plt>
mov    -0x8(%rbp),%rdi
call   1080 <GetAChar@plt>
mov    %rax,-0x28(%rbp)
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x39(%rbp)
je     11fe <MergeMetaInfo+0x9e>
mov    -0x28(%rbp),%rdi
mov    0x2e27(%rip),%rax
mov    (%rax),%esi
call   1030 <mblen@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
mov    %al,-0x39(%rbp)
jne    11fe <MergeMetaInfo+0x9e>
mov    -0x28(%rbp),%rax
movsbl (%rax),%edi
call   1050 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x39(%rbp)
mov    -0x39(%rbp),%al
test   $0x1,%al
jne    120e <MergeMetaInfo+0xae>
jmp    1213 <MergeMetaInfo+0xb3>
jmp    11a8 <MergeMetaInfo+0x48>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <fputs@plt>
mov    -0x8(%rbp),%rdi
call   1080 <GetAChar@plt>
mov    %rax,-0x28(%rbp)
cmpb   $0x0,(%rax)
je     1248 <MergeMetaInfo+0xe8>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <fputs@plt>
jmp    1220 <MergeMetaInfo+0xc0>
mov    -0x10(%rbp),%rsi
lea    0xdc1(%rip),%rdi
call   1040 <fputs@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MergeMetaInfo>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xe8b(%rip),%rdi
mov    $0x13,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1070 <fwrite@plt>
mov    0x2e4a(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
xor    %esi,%esi
call   1060 <fseek@plt>
mov    0x2e57(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1080 <GetAChar@plt>
mov    %rax,%rbx
cmpb   $0x0,(%rax)
je     11de <MergeMetaInfo+0x7e>
mov    (%r12),%esi
mov    %rbx,%rdi
call   1030 <mblen@plt>
cmp    $0x1,%eax
jne    11de <MergeMetaInfo+0x7e>
movsbl (%rbx),%edi
call   1050 <isspace@plt>
test   %rax,%rax
jne    11b0 <MergeMetaInfo+0x50>
mov    %rbx,%rdi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rsi
call   1040 <fputs@plt>
mov    %r15,%rdi
call   1080 <GetAChar@plt>
cmpb   $0x0,(%rax)
je     120a <MergeMetaInfo+0xaa>
mov    %rax,%rdi
jmp    11f0 <MergeMetaInfo+0x90>
lea    0xe03(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1070 <fwrite@plt>

LLVM IR (-O0):
@BUFSIZ = global i32 0
@.str = [20 x i8] c"# Meta Information\0A\00"
@SEEK_SET = global i32 0
@MB_CUR_MAX = global i32 0
@.str.1 = [3 x i8] c"\0A\0A\00"
define void @MergeMetaInfo(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
store i32* %0, i32** %3
store i32* %1, i32** %4
%10 = load i32, i32* @BUFSIZ
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %5
%13 = alloca i8, i64 %11
store i64 %11, i64* %6
%14 = load i32*, i32** %4
%15 = call i32 @fprintf(i32* %14, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%16 = load i32*, i32** %3
%17 = load i32, i32* @SEEK_SET
%18 = call i32 @fseek(i32* %16, i32 0, i32 %17)
br label %19
19: ; preds = %37, %2
%20 = load i32*, i32** %3
%21 = call i8* @GetAChar(i32* %20)
store i8* %21, i8** %7
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %35
25: ; preds = %19
%26 = load i8*, i8** %7
%27 = load i32, i32* @MB_CUR_MAX
%28 = call i32 @mblen(i8* %26, i32 %27)
%29 = icmp eq i32 %28, 1
br i1 %29, label %30, label %35
30: ; preds = %25
%31 = load i8*, i8** %7
%32 = load i8, i8* %31
%33 = call i64 @isspace(i8 signext %32)
%34 = icmp ne i64 %33, 0
br label %35
35: ; preds = %30, %25, %19
%36 = phi i1 [ false, %25 ], [ false, %19 ], [ %34, %30 ]
br i1 %36, label %37, label %38
37: ; preds = %35
br label %19
38: ; preds = %35
%39 = load i8*, i8** %7
%40 = load i32*, i32** %4
%41 = call i32 @fputs(i8* %39, i32* %40)
br label %42
42: ; preds = %47, %38
%43 = load i32*, i32** %3
%44 = call i8* @GetAChar(i32* %43)
store i8* %44, i8** %7
%45 = load i8, i8* %44
%46 = icmp ne i8 %45, 0
br i1 %46, label %47, label %51
47: ; preds = %42
%48 = load i8*, i8** %7
%49 = load i32*, i32** %4
%50 = call i32 @fputs(i8* %48, i32* %49)
br label %42
51: ; preds = %42
%52 = load i32*, i32** %4
%53 = call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %52)
%54 = load i8*, i8** %5
ret void
}

LLVM IR (-O2):
@BUFSIZ = global i32 0
@.str = [20 x i8] c"# Meta Information\0A\00"
@SEEK_SET = global i32 0
@MB_CUR_MAX = global i32 0
@.str.1 = [3 x i8] c"\0A\0A\00"
define void @MergeMetaInfo(i32* %0, i32* nocapture %1) {
%3 = tail call i64 @fwrite(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i64 19, i64 1, i32* %1)
%4 = load i32, i32* @SEEK_SET
%5 = tail call i32 @fseek(i32* %0, i32 0, i32 %4)
br label %6
6: ; preds = %14, %2
%7 = tail call i8* @GetAChar(i32* %0)
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
br i1 %9, label %18, label %10
10: ; preds = %6
%11 = load i32, i32* @MB_CUR_MAX
%12 = tail call i32 @mblen(i8* %7, i32 %11)
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i8, i8* %7
%16 = tail call i64 @isspace(i8 signext %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %6
18: ; preds = %6, %10, %14
%19 = tail call i32 @fputs(i8* %7, i32* %1)
%20 = tail call i8* @GetAChar(i32* %0)
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 0
br i1 %22, label %29, label %23
23: ; preds = %18, %23
%24 = phi i8* [ %26, %23 ], [ %20, %18 ]
%25 = tail call i32 @fputs(i8* %24, i32* %1)
%26 = tail call i8* @GetAChar(i32* %0)
%27 = load i8, i8* %26
%28 = icmp eq i8 %27, 0
br i1 %28, label %29, label %23
29: ; preds = %23, %18
%30 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64 2, i64 1, i32* %1)
ret void
}