#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*/ sprintf(char *, char *, ...);
int write_header_log_file(FILE *log_file, unsigned short size_f,
                          long int npackages, int period, int nburst) {
  char buffer[3000];
  sprintf(buffer, "SIZE %d \n", size_f);
  fprintf(log_file, buffer);
  sprintf(buffer, "PERIOD %d \n", period);
  fprintf(log_file, buffer);
  sprintf(buffer, "NBURST %d \n", nburst);
  fprintf(log_file, buffer);
  sprintf(buffer, "NPACKG %d \n", npackages);
  fprintf(log_file, buffer);
  sprintf(buffer, "VALUES (BW,LOSTPACKG,CORRUPTEDPKG) \n");
  fprintf(log_file, buffer);
  return 0;
}


x86 assembly (clang, -O0):
<write_header_log_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0xbe0,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
lea    -0xbe0(%rbp),%rdi
movzwl -0xa(%rbp),%edx
lea    0xead(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0xbe0(%rbp),%rsi
call   1030 <fprintf@plt>
lea    -0xbe0(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xe8f(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0xbe0(%rbp),%rsi
call   1030 <fprintf@plt>
lea    -0xbe0(%rbp),%rdi
mov    -0x20(%rbp),%edx
lea    0xe73(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0xbe0(%rbp),%rsi
call   1030 <fprintf@plt>
lea    -0xbe0(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xe56(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0xbe0(%rbp),%rsi
call   1030 <fprintf@plt>
lea    -0xbe0(%rbp),%rdi
lea    0xe3d(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0xbe0(%rbp),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0xbe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_header_log_file>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xbc0,%rsp
mov    %r8d,%r12d
mov    %ecx,%ebp
mov    %rdx,%r15
mov    %esi,%edx
mov    %rdi,%rbx
lea    0xebd(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <fprintf@plt>
lea    0xea8(%rip),%rsi
mov    %r14,%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <fprintf@plt>
lea    0xe96(%rip),%rsi
mov    %r14,%rdi
mov    %r12d,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <fprintf@plt>
lea    0xe83(%rip),%rsi
mov    %r14,%rdi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <fprintf@plt>
movabs $0xa2029474b5044,%rax
mov    %rax,0x1d(%rsp)
movups 0xe61(%rip),%xmm0
movaps %xmm0,(%rsp)
movups 0xe66(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0xbc0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"SIZE %d \0A\00"
@.str.1 = [12 x i8] c"PERIOD %d \0A\00"
@.str.2 = [12 x i8] c"NBURST %d \0A\00"
@.str.3 = [12 x i8] c"NPACKG %d \0A\00"
@.str.4 = [37 x i8] c"VALUES (BW,LOSTPACKG,CORRUPTEDPKG) \0A\00"
define i32 @write_header_log_file(i32* %0, i16 zeroext %1, i64 %2, i32 %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i16
%8 = alloca i64
%9 = alloca i32
%10 = alloca i32
%11 = alloca [3000 x i8]
store i32* %0, i32** %6
store i16 %1, i16* %7
store i64 %2, i64* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%12 = getelementptr inbounds [3000 x i8], [3000 x i8]* %11, i64 0, i64 0
%13 = load i16, i16* %7
%14 = zext i16 %13 to i32
%15 = call i32 (i8*, i8*, ...) @sprintf(i8* %12, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = load i32*, i32** %6
%17 = getelementptr inbounds [3000 x i8], [3000 x i8]* %11, i64 0, i64 0
%18 = call i32 @fprintf(i32* %16, i8* %17)
%19 = getelementptr inbounds [3000 x i8], [3000 x i8]* %11, i64 0, i64 0
%20 = load i32, i32* %9
%21 = call i32 (i8*, i8*, ...) @sprintf(i8* %19, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = load i32*, i32** %6
%23 = getelementptr inbounds [3000 x i8], [3000 x i8]* %11, i64 0, i64 0
%24 = call i32 @fprintf(i32* %22, i8* %23)
%25 = getelementptr inbounds [3000 x i8], [3000 x i8]* %11, i64 0, i64 0
%26 = load i32, i32* %10
%27 = call i32 (i8*, i8*, ...) @sprintf(i8* %25, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %26)
%28 = load i32*, i32** %6
%29 = getelementptr inbounds [3000 x i8], [3000 x i8]* %11, i64 0, i64 0
%30 = call i32 @fprintf(i32* %28, i8* %29)
%31 = getelementptr inbounds [3000 x i8], [3000 x i8]* %11, i64 0, i64 0
%32 = load i64, i64* %8
%33 = call i32 (i8*, i8*, ...) @sprintf(i8* %31, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i64 %32)
%34 = load i32*, i32** %6
%35 = getelementptr inbounds [3000 x i8], [3000 x i8]* %11, i64 0, i64 0
%36 = call i32 @fprintf(i32* %34, i8* %35)
%37 = getelementptr inbounds [3000 x i8], [3000 x i8]* %11, i64 0, i64 0
%38 = call i32 (i8*, i8*, ...) @sprintf(i8* %37, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0))
%39 = load i32*, i32** %6
%40 = getelementptr inbounds [3000 x i8], [3000 x i8]* %11, i64 0, i64 0
%41 = call i32 @fprintf(i32* %39, i8* %40)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"SIZE %d \0A\00"
@.str.1 = [12 x i8] c"PERIOD %d \0A\00"
@.str.2 = [12 x i8] c"NBURST %d \0A\00"
@.str.3 = [12 x i8] c"NPACKG %d \0A\00"
@.str.4 = [37 x i8] c"VALUES (BW,LOSTPACKG,CORRUPTEDPKG) \0A\00"
define i32 @write_header_log_file(i32* nocapture %0, i16 zeroext %1, i64 %2, i32 %3, i32 %4) {
%6 = alloca [3000 x i8]
%7 = getelementptr inbounds [3000 x i8], [3000 x i8]* %6, i64 0, i64 0
%8 = zext i16 %1 to i32
%9 = call i32 (i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 @fprintf(i32* %0, i8* %7)
%11 = call i32 (i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%12 = call i32 @fprintf(i32* %0, i8* %7)
%13 = call i32 (i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %4)
%14 = call i32 @fprintf(i32* %0, i8* %7)
%15 = call i32 (i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i64 %2)
%16 = call i32 @fprintf(i32* %0, i8* %7)
%17 = call i32 @fprintf(i32* %0, i8* %7)
ret i32 0
}