#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*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int, int, int, int);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *, int *, int *,
                          int *, int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdout;
void readFileDateTime(char *fileName) {
  FILE *log;
  log = fopen(fileName, "r");
  if (!log) {
    printf("File opening error.\n");
    exit(1);
  }
  int d, m, a, h, mn;
  fscanf(log, "%d/%d/%d,%d:%d", &d, &m, &a, &h, &mn);
  fprintf(stdout, "Date and time: %d/%02d/%d %d:%d\n", d, m, a, h, mn);
  fclose(log);
}


x86 assembly (clang, -O0):
<readFileDateTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe89(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11a1 <readFileDateTime+0x41>
lea    0xe70(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rdi
lea    0xe6b(%rip),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x1c(%rbp),%r8
lea    -0x20(%rbp),%r9
lea    -0x24(%rbp),%rax
mov    %rax,(%rsp)
call   1050 <fscanf@plt>
mov    0x2e10(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x20(%rbp),%r9d
mov    -0x24(%rbp),%eax
lea    0xe3c(%rip),%rsi
mov    %eax,(%rsp)
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readFileDateTime>:
push   %rbx
sub    $0x20,%rsp
lea    0xe94(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     11e1 <readFileDateTime+0x81>
mov    %rax,%rbx
lea    0xc(%rsp),%rax
mov    %rax,(%rsp)
lea    0xe79(%rip),%rsi
lea    0x1c(%rsp),%rdx
lea    0x18(%rsp),%rcx
lea    0x14(%rsp),%r8
lea    0x10(%rsp),%r9
mov    %rbx,%rdi
call   1050 <fscanf@plt>
mov    0x2e34(%rip),%rax
mov    (%rax),%edi
mov    0x1c(%rsp),%edx
mov    0x18(%rsp),%ecx
mov    0x14(%rsp),%r8d
mov    0x10(%rsp),%r9d
mov    0xc(%rsp),%eax
mov    %eax,(%rsp)
lea    0xe43(%rip),%rsi
call   1060 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
add    $0x20,%rsp
pop    %rbx
ret
lea    0xe4a(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [21 x i8] c"File opening error.\0A\00"
@.str.2 = [15 x i8] c"%d/%d/%d,%d:%d\00"
@stdout = global i32 0
@.str.3 = [33 x i8] c"Date and time: %d/%02d/%d %d:%d\0A\00"
define void @readFileDateTime(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %2
%9 = load i8*, i8** %2
%10 = call i32* @fopen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %10, i32** %3
%11 = load i32*, i32** %3
%12 = icmp ne i32* %11, null
br i1 %12, label %16, label %13
13: ; preds = %1
%14 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %1
%17 = load i32*, i32** %3
%18 = call i32 @fscanf(i32* %17, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32* %4, i32* %5, i32* %6, i32* %7, i32* %8)
%19 = load i32, i32* @stdout
%20 = load i32, i32* %4
%21 = load i32, i32* %5
%22 = load i32, i32* %6
%23 = load i32, i32* %7
%24 = load i32, i32* %8
%25 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %20, i32 %21, i32 %22, i32 %23, i32 %24)
%26 = load i32*, i32** %3
%27 = call i32 @fclose(i32* %26)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.2 = [15 x i8] c"%d/%d/%d,%d:%d\00"
@stdout = global i32 0
@.str.3 = [33 x i8] c"Date and time: %d/%02d/%d %d:%d\0A\00"
@str = [20 x i8] c"File opening error.\00"
define void @readFileDateTime(i8* nocapture %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %1
%13 = bitcast i32* %2 to i8*
%14 = bitcast i32* %3 to i8*
%15 = bitcast i32* %4 to i8*
%16 = bitcast i32* %5 to i8*
%17 = bitcast i32* %6 to i8*
%18 = call i32 @fscanf(i32* %7, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32* %2, i32* %3, i32* %4, i32* %5, i32* %6)
%19 = load i32, i32* @stdout
%20 = load i32, i32* %2
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = load i32, i32* %5
%24 = load i32, i32* %6
%25 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %20, i32 %21, i32 %22, i32 %23, i32 %24)
%26 = call i32 @fclose(i32* %7)
ret void
}