#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *, ...);
int main() {
  FILE *f = fopen("INP.TXT", "r");
  int n, i, preva, a, r = 1;
  fscanf(f, "%d", &n, &preva);
  for (i = 1; i < n; i++) {
    fscanf(f, "%d", &a);
    if (a > preva)
      r++;
    preva = a;
  }
  fclose(f);
  f = fopen("OUT.TXT", "w");
  fprintf(f, "%d\n", r);
  fclose(f);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    0xeab(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe92(%rip),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x1c(%rbp),%rcx
mov    $0x0,%al
call   1040 <fscanf@plt>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11d9 <main+0x99>
mov    -0x10(%rbp),%rdi
lea    0xe65(%rip),%rsi
lea    -0x20(%rbp),%rdx
mov    $0x0,%al
call   1040 <fscanf@plt>
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jle    11c5 <main+0x85>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    118e <main+0x4e>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xe24(%rip),%rdi
lea    0xe25(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xe10(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xead(%rip),%rdi
lea    0xeae(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r12
lea    0xea1(%rip),%rsi
lea    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
mov    %rax,%rdi
xor    %eax,%eax
call   1040 <fscanf@plt>
mov    $0x1,%ebp
cmpl   $0x2,0x8(%rsp)
jl     11cc <main+0x8c>
mov    $0x1,%ebp
lea    0xe75(%rip),%r14
lea    0xc(%rsp),%r15
mov    $0x1,%ebx
nop
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <fscanf@plt>
mov    0xc(%rsp),%eax
xor    %ecx,%ecx
cmp    0x4(%rsp),%eax
setg   %cl
add    %ecx,%ebp
mov    %eax,0x4(%rsp)
add    $0x1,%ebx
cmp    0x8(%rsp),%ebx
jl     11a0 <main+0x60>
mov    %r12,%rdi
call   1030 <fclose@plt>
lea    0xe32(%rip),%rdi
lea    0xe33(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
lea    0xe26(%rip),%rsi
mov    %rax,%rdi
mov    %ebp,%edx
call   1050 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"INP.TXT\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [8 x i8] c"OUT.TXT\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %8, i32** %2
store i32 1, i32* %7
%9 = load i32*, i32** %2
%10 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3, i32* %5)
store i32 1, i32* %4
br label %11
11: ; preds = %26, %0
%12 = load i32, i32* %4
%13 = load i32, i32* %3
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %29
15: ; preds = %11
%16 = load i32*, i32** %2
%17 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%18 = load i32, i32* %6
%19 = load i32, i32* %5
%20 = icmp sgt i32 %18, %19
br i1 %20, label %21, label %24
21: ; preds = %15
%22 = load i32, i32* %7
%23 = add nsw i32 %22, 1
store i32 %23, i32* %7
br label %24
24: ; preds = %21, %15
%25 = load i32, i32* %6
store i32 %25, i32* %5
br label %26
26: ; preds = %24
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
br label %11
29: ; preds = %11
%30 = load i32*, i32** %2
%31 = call i32 @fclose(i32* %30)
%32 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %32, i32** %2
%33 = load i32*, i32** %2
%34 = load i32, i32* %7
%35 = call i32 @fprintf(i32* %33, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %34)
%36 = load i32*, i32** %2
%37 = call i32 @fclose(i32* %36)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"INP.TXT\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [8 x i8] c"OUT.TXT\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2)
%9 = load i32, i32* %1
%10 = icmp sgt i32 %9, 1
br i1 %10, label %11, label %23
11: ; preds = %0, %11
%12 = phi i32 [ %19, %11 ], [ 1, %0 ]
%13 = phi i32 [ %20, %11 ], [ 1, %0 ]
%14 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%15 = load i32, i32* %3
%16 = load i32, i32* %2
%17 = icmp sgt i32 %15, %16
%18 = zext i1 %17 to i32
%19 = add nuw nsw i32 %12, %18
store i32 %15, i32* %2
%20 = add nuw nsw i32 %13, 1
%21 = load i32, i32* %1
%22 = icmp slt i32 %20, %21
br i1 %22, label %11, label %23
23: ; preds = %11, %0
%24 = phi i32 [ 1, %0 ], [ %19, %11 ]
%25 = call i32 @fclose(i32* %4)
%26 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%27 = call i32 @fprintf(i32* %26, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %24)
%28 = call i32 @fclose(i32* %26)
ret i32 0
}