#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*/ time_t;
struct tm {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  int num, length, width;
  FILE *fp;
  time_t timer;
  char buffer1[32], buffer2[32];
  struct tm *tm_info;
  time(&timer);
  tm_info = localtime(&timer);
  strftime(buffer1, 32, "%Y-%m-%dT%H:%M:%S%z", tm_info);
  strftime(buffer2, 32, "00_%Y%m%d_%H%M%S.txt", tm_info);
  fp = fopen(buffer2, "w");
  fprintf(fp, "####################################\n");
  fprintf(fp, "#\n");
  fprintf(fp, "# -- TEXTPATGEN GENERATED FILE --\n");
  fprintf(fp, "#\n");
  fprintf(fp, "# -- %s --\n", buffer1);
  fprintf(fp, "#\n");
  fprintf(fp, "####################################\n");
  num = 0;
  for (length = 0; length < 10; length++) {
    for (width = 0; width < 9; width++) {
      fprintf(fp, "D-%04d ", num);
      num++;
    }
    fprintf(fp, "D-%04d\n", num);
    num++;
  }
  fprintf(fp, "# -- End of file.\n");
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x2c(%rbp),%rdi
call   1060 <time@plt>
lea    -0x2c(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x78(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x78(%rbp),%rcx
mov    $0x20,%esi
lea    0xe5d(%rip),%rdx
call   1070 <strftime@plt>
lea    -0x70(%rbp),%rdi
mov    -0x78(%rbp),%rcx
mov    $0x20,%esi
lea    0xe58(%rip),%rdx
call   1070 <strftime@plt>
lea    -0x70(%rbp),%rdi
lea    0xe5d(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xe4b(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xe5c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xe4d(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xe38(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    -0x50(%rbp),%rdx
lea    0xe48(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xe10(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xddb(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0xa,-0x18(%rbp)
jge    12d8 <main+0x178>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x9,-0x1c(%rbp)
jge    12ac <main+0x14c>
mov    -0x28(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xdf2(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1276 <main+0x116>
mov    -0x28(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xdce(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1265 <main+0x105>
mov    -0x28(%rbp),%rdi
lea    0xdad(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x58,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
mov    %rax,%rbx
lea    0xe66(%rip),%rdx
lea    0x30(%rsp),%r14
mov    %r14,%rdi
mov    $0x20,%esi
mov    %rax,%rcx
call   1070 <strftime@plt>
lea    0xe5e(%rip),%rdx
lea    0x10(%rsp),%r15
mov    %r15,%rdi
mov    $0x20,%esi
mov    %rbx,%rcx
call   1070 <strftime@plt>
lea    0xe57(%rip),%rsi
mov    %r15,%rdi
call   1080 <fopen@plt>
mov    %rax,%r12
lea    0xe47(%rip),%r15
mov    $0x25,%esi
mov    $0x1,%edx
mov    %r15,%rdi
mov    %rax,%rcx
call   1090 <fwrite@plt>
lea    0xe4e(%rip),%rbx
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rdi
mov    %r12,%rcx
call   1090 <fwrite@plt>
lea    0xe35(%rip),%rdi
mov    $0x22,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1090 <fwrite@plt>
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rdi
mov    %r12,%rcx
call   1090 <fwrite@plt>
lea    0xe2a(%rip),%rsi
mov    %r12,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rdi
mov    %r12,%rcx
call   1090 <fwrite@plt>
mov    $0x25,%esi
mov    $0x1,%edx
mov    %r15,%rdi
mov    %r12,%rcx
call   1090 <fwrite@plt>
lea    0xdf8(%rip),%r14
lea    0xdf9(%rip),%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0x1(%rbx),%edx
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0x2(%rbx),%edx
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0x3(%rbx),%edx
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0x4(%rbx),%edx
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0x5(%rbx),%edx
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0x6(%rbx),%edx
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0x7(%rbx),%edx
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0x8(%rbx),%edx
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0x9(%rbx),%edx
mov    %r12,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0xa(%rbx),%eax
cmp    $0x5a,%ebx
mov    %eax,%ebx
jne    12a0 <main+0x130>
lea    0xd3c(%rip),%rdi
mov    $0x12,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1090 <fwrite@plt>
mov    %r12,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [20 x i8] c"%Y-%m-%dT%H:%M:%S%z\00"
@.str.1 = [21 x i8] c"00_%Y%m%d_%H%M%S.txt\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [38 x i8] c"####################################\0A\00"
@.str.4 = [3 x i8] c"#\0A\00"
@.str.5 = [35 x i8] c"# -- TEXTPATGEN GENERATED FILE --\0A\00"
@.str.6 = [12 x i8] c"# -- %s --\0A\00"
@.str.7 = [8 x i8] c"D-%04d \00"
@.str.8 = [8 x i8] c"D-%04d\0A\00"
@.str.9 = [19 x i8] c"# -- End of file.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32
%11 = alloca [32 x i8]
%12 = alloca [32 x i8]
%13 = alloca %struct.tm*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = call i32 @time(i32* %10)
%15 = call %struct.tm* @localtime(i32* %10)
store %struct.tm* %15, %struct.tm** %13
%16 = getelementptr inbounds [32 x i8], [32 x i8]* %11, i64 0, i64 0
%17 = load %struct.tm*, %struct.tm** %13
%18 = call i32 @strftime(i8* %16, i32 32, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), %struct.tm* %17)
%19 = getelementptr inbounds [32 x i8], [32 x i8]* %12, i64 0, i64 0
%20 = load %struct.tm*, %struct.tm** %13
%21 = call i32 @strftime(i8* %19, i32 32, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %20)
%22 = getelementptr inbounds [32 x i8], [32 x i8]* %12, i64 0, i64 0
%23 = call i32* @fopen(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %23, i32** %9
%24 = load i32*, i32** %9
%25 = call i32 (i32*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
%26 = load i32*, i32** %9
%27 = call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%28 = load i32*, i32** %9
%29 = call i32 (i32*, i8*, ...) @fprintf(i32* %28, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
%30 = load i32*, i32** %9
%31 = call i32 (i32*, i8*, ...) @fprintf(i32* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%32 = load i32*, i32** %9
%33 = getelementptr inbounds [32 x i8], [32 x i8]* %11, i64 0, i64 0
%34 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %33)
%35 = load i32*, i32** %9
%36 = call i32 (i32*, i8*, ...) @fprintf(i32* %35, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%37 = load i32*, i32** %9
%38 = call i32 (i32*, i8*, ...) @fprintf(i32* %37, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %6
store i32 0, i32* %7
br label %39
39: ; preds = %61, %2
%40 = load i32, i32* %7
%41 = icmp slt i32 %40, 10
br i1 %41, label %42, label %64
42: ; preds = %39
store i32 0, i32* %8
br label %43
43: ; preds = %52, %42
%44 = load i32, i32* %8
%45 = icmp slt i32 %44, 9
br i1 %45, label %46, label %55
46: ; preds = %43
%47 = load i32*, i32** %9
%48 = load i32, i32* %6
%49 = call i32 (i32*, i8*, ...) @fprintf(i32* %47, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 %48)
%50 = load i32, i32* %6
%51 = add nsw i32 %50, 1
store i32 %51, i32* %6
br label %52
52: ; preds = %46
%53 = load i32, i32* %8
%54 = add nsw i32 %53, 1
store i32 %54, i32* %8
br label %43
55: ; preds = %43
%56 = load i32*, i32** %9
%57 = load i32, i32* %6
%58 = call i32 (i32*, i8*, ...) @fprintf(i32* %56, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i32 %57)
%59 = load i32, i32* %6
%60 = add nsw i32 %59, 1
store i32 %60, i32* %6
br label %61
61: ; preds = %55
%62 = load i32, i32* %7
%63 = add nsw i32 %62, 1
store i32 %63, i32* %7
br label %39
64: ; preds = %39
%65 = load i32*, i32** %9
%66 = call i32 (i32*, i8*, ...) @fprintf(i32* %65, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
%67 = load i32*, i32** %9
%68 = call i32 @fclose(i32* %67)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [20 x i8] c"%Y-%m-%dT%H:%M:%S%z\00"
@.str.1 = [21 x i8] c"00_%Y%m%d_%H%M%S.txt\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [38 x i8] c"####################################\0A\00"
@.str.4 = [3 x i8] c"#\0A\00"
@.str.5 = [35 x i8] c"# -- TEXTPATGEN GENERATED FILE --\0A\00"
@.str.6 = [12 x i8] c"# -- %s --\0A\00"
@.str.7 = [8 x i8] c"D-%04d \00"
@.str.8 = [8 x i8] c"D-%04d\0A\00"
@.str.9 = [19 x i8] c"# -- End of file.\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca [32 x i8]
%5 = alloca [32 x i8]
%6 = bitcast i32* %3 to i8*
%7 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%9 = call i32 @time(i32* %3)
%10 = call %struct.tm* @localtime(i32* %3)
%11 = call i32 @strftime(i8* %7, i32 32, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), %struct.tm* %10)
%12 = call i32 @strftime(i8* %8, i32 32, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %10)
%13 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%14 = call i64 @fwrite(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i64 37, i64 1, i32* %13)
%15 = call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i64 2, i64 1, i32* %13)
%16 = call i64 @fwrite(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i64 34, i64 1, i32* %13)
%17 = call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i64 2, i64 1, i32* %13)
%18 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %7)
%19 = call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i64 2, i64 1, i32* %13)
%20 = call i64 @fwrite(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i64 37, i64 1, i32* %13)
br label %21
21: ; preds = %2, %21
%22 = phi i32 [ 0, %2 ], [ %43, %21 ]
%23 = phi i32 [ 0, %2 ], [ %44, %21 ]
%24 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 %22)
%25 = or i32 %22, 1
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 %25)
%27 = add nuw nsw i32 %22, 2
%28 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 %27)
%29 = add nuw nsw i32 %22, 3
%30 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 %29)
%31 = add nuw nsw i32 %22, 4
%32 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 %31)
%33 = add nuw nsw i32 %22, 5
%34 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 %33)
%35 = add nuw nsw i32 %22, 6
%36 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 %35)
%37 = add nuw nsw i32 %22, 7
%38 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 %37)
%39 = add nuw nsw i32 %22, 8
%40 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 %39)
%41 = add nuw nsw i32 %22, 9
%42 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i32 %41)
%43 = add nuw nsw i32 %22, 10
%44 = add nuw nsw i32 %23, 1
%45 = icmp eq i32 %44, 10
br i1 %45, label %46, label %21
46: ; preds = %21
%47 = call i64 @fwrite(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), i64 18, i64 1, i32* %13)
%48 = call i32 @fclose(i32* %13)
ret i32 0
}