#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 */
char A_CHARTEXT;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
char mvinch(int, int);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void graphics_sprites_screenshot(void) {
  char path[80];
  time_t rawtime = 0;
  struct tm *timeinfo = NULL;
  FILE *file = NULL;
  int x = 0;
  int y = 0;
  memset(path, 0, 80 * sizeof(char));
  time(&rawtime);
  timeinfo = localtime(&rawtime);
  strftime(path, 80, "screenshot-turbo-bomber-%Y-%m-%d-%H%M%S.txt", timeinfo);
  ((void)0);
  file = fopen(path, "w");
  if (file == NULL) {
    ((void)0);
    return;
  }
  for (y = 0; y < 40; y++) {
    for (x = 0; x < 150; x++) {
      fputc(mvinch(y, x) & A_CHARTEXT, file);
    }
    fputc('\n', file);
  }
  fclose(file);
}


x86 assembly (clang, -O0):
<graphics_sprites_screenshot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x54(%rbp)
movq   $0x0,-0x60(%rbp)
movq   $0x0,-0x68(%rbp)
movl   $0x0,-0x6c(%rbp)
movl   $0x0,-0x70(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x50,%edx
call   1050 <memset@plt>
lea    -0x54(%rbp),%rdi
call   1070 <time@plt>
lea    -0x54(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x60(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x60(%rbp),%rcx
mov    $0x50,%esi
lea    0xe19(%rip),%rdx
call   1080 <strftime@plt>
lea    -0x50(%rbp),%rdi
lea    0xe35(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x68(%rbp)
cmpq   $0x0,-0x68(%rbp)
jne    1210 <graphics_sprites_screenshot+0x90>
jmp    128e <graphics_sprites_screenshot+0x10e>
movl   $0x0,-0x70(%rbp)
cmpl   $0x28,-0x70(%rbp)
jge    1285 <graphics_sprites_screenshot+0x105>
movl   $0x0,-0x6c(%rbp)
cmpl   $0x96,-0x6c(%rbp)
jge    1269 <graphics_sprites_screenshot+0xe9>
mov    -0x70(%rbp),%edi
mov    -0x6c(%rbp),%esi
call   10a0 <mvinch@plt>
movsbl %al,%eax
mov    0x2d9e(%rip),%rcx
movsbl (%rcx),%ecx
and    %ecx,%eax
mov    -0x68(%rbp),%rsi
movsbl %al,%edi
call   1060 <fputc@plt>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    1228 <graphics_sprites_screenshot+0xa8>
mov    -0x68(%rbp),%rsi
mov    $0xa,%edi
call   1060 <fputc@plt>
mov    -0x70(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x70(%rbp)
jmp    1217 <graphics_sprites_screenshot+0x97>
mov    -0x68(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<graphics_sprites_screenshot>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x68,%rsp
movl   $0x0,0xc(%rsp)
lea    0x10(%rsp),%rbx
xor    %r14d,%r14d
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x50,%edx
call   1050 <memset@plt>
lea    0xc(%rsp),%rbp
mov    %rbp,%rdi
call   1070 <time@plt>
mov    %rbp,%rdi
call   1030 <localtime@plt>
lea    0xe3b(%rip),%rdx
mov    %rbx,%rdi
mov    $0x50,%esi
mov    %rax,%rcx
call   1080 <strftime@plt>
lea    0xe50(%rip),%rsi
mov    %rbx,%rdi
call   1090 <fopen@plt>
test   %rax,%rax
je     1252 <graphics_sprites_screenshot+0xd2>
mov    %rax,%rbx
mov    0x2df5(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14d,%edi
mov    %ebp,%esi
call   10a0 <mvinch@plt>
and    (%r15),%al
movsbl %al,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
add    $0x1,%ebp
cmp    $0x96,%ebp
jne    1210 <graphics_sprites_screenshot+0x90>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
add    $0x1,%r14d
cmp    $0x28,%r14d
jne    1200 <graphics_sprites_screenshot+0x80>
mov    %rbx,%rdi
call   1040 <fclose@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [44 x i8] c"screenshot-turbo-bomber-%Y-%m-%d-%H%M%S.txt\00"
@.str.1 = [2 x i8] c"w\00"
@A_CHARTEXT = global i8 0
define void @graphics_sprites_screenshot() {
%1 = alloca [80 x i8]
%2 = alloca i32
%3 = alloca %struct.tm*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %2
store %struct.tm* null, %struct.tm** %3
store i32* null, i32** %4
store i32 0, i32* %5
store i32 0, i32* %6
%7 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%8 = call i32 @memset(i8* %7, i32 0, i32 80)
%9 = call i32 @time(i32* %2)
%10 = call %struct.tm* @localtime(i32* %2)
store %struct.tm* %10, %struct.tm** %3
%11 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%12 = load %struct.tm*, %struct.tm** %3
%13 = call i32 @strftime(i8* %11, i32 80, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), %struct.tm* %12)
%14 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%15 = call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %15, i32** %4
%16 = load i32*, i32** %4
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %19
18: ; preds = %0
br label %50
19: ; preds = %0
store i32 0, i32* %6
br label %20
20: ; preds = %44, %19
%21 = load i32, i32* %6
%22 = icmp slt i32 %21, 40
br i1 %22, label %23, label %47
23: ; preds = %20
store i32 0, i32* %5
br label %24
24: ; preds = %38, %23
%25 = load i32, i32* %5
%26 = icmp slt i32 %25, 150
br i1 %26, label %27, label %41
27: ; preds = %24
%28 = load i32, i32* %6
%29 = load i32, i32* %5
%30 = call signext i8 @mvinch(i32 %28, i32 %29)
%31 = sext i8 %30 to i32
%32 = load i8, i8* @A_CHARTEXT
%33 = sext i8 %32 to i32
%34 = and i32 %31, %33
%35 = trunc i32 %34 to i8
%36 = load i32*, i32** %4
%37 = call i32 @fputc(i8 signext %35, i32* %36)
br label %38
38: ; preds = %27
%39 = load i32, i32* %5
%40 = add nsw i32 %39, 1
store i32 %40, i32* %5
br label %24
41: ; preds = %24
%42 = load i32*, i32** %4
%43 = call i32 @fputc(i8 signext 10, i32* %42)
br label %44
44: ; preds = %41
%45 = load i32, i32* %6
%46 = add nsw i32 %45, 1
store i32 %46, i32* %6
br label %20
47: ; preds = %20
%48 = load i32*, i32** %4
%49 = call i32 @fclose(i32* %48)
br label %50
50: ; preds = %47, %18
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [44 x i8] c"screenshot-turbo-bomber-%Y-%m-%d-%H%M%S.txt\00"
@.str.1 = [2 x i8] c"w\00"
@A_CHARTEXT = global i8 0
define void @graphics_sprites_screenshot() {
%1 = alloca [80 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = call i32 @memset(i8* %3, i32 0, i32 80)
%6 = call i32 @time(i32* %2)
%7 = call %struct.tm* @localtime(i32* %2)
%8 = call i32 @strftime(i8* %3, i32 80, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), %struct.tm* %7)
%9 = call i32* @fopen(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i32* %9, null
br i1 %10, label %27, label %11
11: ; preds = %0, %21
%12 = phi i32 [ %23, %21 ], [ 0, %0 ]
br label %13
13: ; preds = %11, %13
%14 = phi i32 [ 0, %11 ], [ %19, %13 ]
%15 = call signext i8 @mvinch(i32 %12, i32 %14)
%16 = load i8, i8* @A_CHARTEXT
%17 = and i8 %16, %15
%18 = call i32 @fputc(i8 signext %17, i32* %9)
%19 = add nuw nsw i32 %14, 1
%20 = icmp eq i32 %19, 150
br i1 %20, label %21, label %13
21: ; preds = %13
%22 = call i32 @fputc(i8 signext 10, i32* %9)
%23 = add nuw nsw i32 %12, 1
%24 = icmp eq i32 %23, 40
br i1 %24, label %25, label %11
25: ; preds = %21
%26 = call i32 @fclose(i32* %9)
br label %27
27: ; preds = %0, %25
ret void
}