#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 */

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
void validity(int nv, int nk) {
  int min;
  int chk = 0;
  for (int j = 0; j < nv; j++) {
    scanf("%d ", &min);
    if (min <= 0) {
      chk = chk + 1;
    }
  }
  if (chk >= nk) {
    printf("NO\n");
  } else {
    printf("YES\n");
  }
}


x86 assembly (clang, -O0):
<validity>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    117e <validity+0x5e>
lea    0xeb1(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
jg     116b <validity+0x4b>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1170 <validity+0x50>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113c <validity+0x1c>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     119b <validity+0x7b>
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
jmp    11a7 <validity+0x87>
lea    0xe66(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validity>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %esi,%r14d
test   %edi,%edi
jle    116e <validity+0x4e>
mov    %edi,%ebp
xor    %ebx,%ebx
lea    0xec2(%rip),%r15
lea    0xc(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
xor    %eax,%eax
cmpl   $0x0,0xc(%rsp)
setle  %al
add    %eax,%ebx
add    $0xffffffff,%ebp
jne    1150 <validity+0x30>
jmp    1170 <validity+0x50>
xor    %ebx,%ebx
cmp    %r14d,%ebx
lea    0xe8a(%rip),%rax
lea    0xe87(%rip),%rdi
cmovl  %rax,%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
@.str.1 = [4 x i8] c"NO\0A\00"
@.str.2 = [5 x i8] c"YES\0A\00"
define void @validity(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %20, %2
%9 = load i32, i32* %7
%10 = load i32, i32* %3
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %23
12: ; preds = %8
%13 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %5)
%14 = load i32, i32* %5
%15 = icmp sle i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = load i32, i32* %6
%18 = add nsw i32 %17, 1
store i32 %18, i32* %6
br label %19
19: ; preds = %16, %12
br label %20
20: ; preds = %19
%21 = load i32, i32* %7
%22 = add nsw i32 %21, 1
store i32 %22, i32* %7
br label %8
23: ; preds = %8
%24 = load i32, i32* %6
%25 = load i32, i32* %4
%26 = icmp sge i32 %24, %25
br i1 %26, label %27, label %29
27: ; preds = %23
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %31
29: ; preds = %23
%30 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %31
31: ; preds = %29, %27
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
@str = [4 x i8] c"YES\00"
@str.3 = [3 x i8] c"NO\00"
define void @validity(i32 %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = icmp sgt i32 %0, 0
br i1 %5, label %11, label %6
6: ; preds = %11, %2
%7 = phi i32 [ 0, %2 ], [ %18, %11 ]
%8 = icmp slt i32 %7, %1
%9 = select i1 %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @str.3, i64 0, i64 0)
%10 = call i32 @puts(i8* dereferenceable(1) %9)
ret void
11: ; preds = %2, %11
%12 = phi i32 [ %19, %11 ], [ 0, %2 ]
%13 = phi i32 [ %18, %11 ], [ 0, %2 ]
%14 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %3)
%15 = load i32, i32* %3
%16 = icmp slt i32 %15, 1
%17 = zext i1 %16 to i32
%18 = add nuw nsw i32 %13, %17
%19 = add nuw nsw i32 %12, 1
%20 = icmp eq i32 %19, %0
br i1 %20, label %6, label %11
}