#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 *, float *, float *, float *, float *, float *,
                         float *);
int main() {
  float tablica[6];
  printf("Podaj 6 liczb rzeczywistych: \n");
  scanf("%f %f %f %f %f %f", &tablica[0], &tablica[1], &tablica[2], &tablica[3],
        &tablica[4], &tablica[5]);
  int dodatnie = 0;
  int niedodatnie = 0;
  for (int i = 0; i < 6; i++) {
    float tab = tablica[i];
    if (tab > 0) {
      dodatnie = dodatnie + 1;
    } else if (tab <= 0) {
      niedodatnie = niedodatnie + 1;
    }
  }
  printf("Liczba liczb dodatnich tablicy wynosi: %d\n", dodatnie);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    -0x20(%rbp),%rdx
add    $0x4,%rdx
lea    -0x20(%rbp),%rcx
add    $0x8,%rcx
lea    -0x20(%rbp),%r8
add    $0xc,%r8
lea    -0x20(%rbp),%r9
add    $0x10,%r9
lea    -0x20(%rbp),%rax
add    $0x14,%rax
lea    0xeaf(%rip),%rdi
mov    %rax,(%rsp)
call   1040 <scanf@plt>
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x6,-0x2c(%rbp)
jge    11f4 <main+0xd4>
movslq -0x2c(%rbp),%rax
movss  -0x20(%rbp,%rax,4),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x30(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    11c6 <main+0xa6>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11e1 <main+0xc1>
xorps  %xmm0,%xmm0
ucomiss -0x30(%rbp),%xmm0
jb     11dc <main+0xbc>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11e1 <main+0xc1>
jmp    11e6 <main+0xc6>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    118e <main+0x6e>
mov    -0x24(%rbp),%esi
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
lea    0xf02(%rip),%rdi
call   1030 <puts@plt>
lea    0x14(%rsp),%rdx
lea    0x18(%rsp),%rcx
lea    0x1c(%rsp),%r8
lea    0x20(%rsp),%r9
lea    0x24(%rsp),%rax
mov    %rax,(%rsp)
lea    0xe9c(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1050 <scanf@plt>
movss  0x10(%rsp),%xmm1
movss  0x14(%rsp),%xmm2
xorps  %xmm0,%xmm0
xor    %eax,%eax
ucomiss %xmm0,%xmm1
seta   %al
ucomiss %xmm0,%xmm2
lea    0x1(%rax),%ecx
cmovbe %eax,%ecx
movss  0x18(%rsp),%xmm1
xor    %eax,%eax
ucomiss %xmm0,%xmm1
seta   %al
add    %ecx,%eax
movss  0x1c(%rsp),%xmm1
xor    %ecx,%ecx
ucomiss %xmm0,%xmm1
seta   %cl
add    %eax,%ecx
movss  0x20(%rsp),%xmm1
xor    %eax,%eax
ucomiss %xmm0,%xmm1
seta   %al
add    %ecx,%eax
movss  0x24(%rsp),%xmm1
xor    %esi,%esi
ucomiss %xmm0,%xmm1
seta   %sil
add    %eax,%esi
lea    0xe3c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Podaj 6 liczb rzeczywistych: \0A\00"
@.str.1 = [18 x i8] c"%f %f %f %f %f %f\00"
@.str.2 = [43 x i8] c"Liczba liczb dodatnich tablicy wynosi: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x float]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [6 x float], [6 x float]* %2, i64 0, i64 0
%9 = getelementptr inbounds [6 x float], [6 x float]* %2, i64 0, i64 1
%10 = getelementptr inbounds [6 x float], [6 x float]* %2, i64 0, i64 2
%11 = getelementptr inbounds [6 x float], [6 x float]* %2, i64 0, i64 3
%12 = getelementptr inbounds [6 x float], [6 x float]* %2, i64 0, i64 4
%13 = getelementptr inbounds [6 x float], [6 x float]* %2, i64 0, i64 5
%14 = call i32 @scanf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), float* %8, float* %9, float* %10, float* %11, float* %12, float* %13)
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
br label %15
15: ; preds = %36, %0
%16 = load i32, i32* %5
%17 = icmp slt i32 %16, 6
br i1 %17, label %18, label %39
18: ; preds = %15
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [6 x float], [6 x float]* %2, i64 0, i64 %20
%22 = load float, float* %21
store float %22, float* %6
%23 = load float, float* %6
%24 = fcmp ogt float %23, 0.000000e+00
br i1 %24, label %25, label %28
25: ; preds = %18
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %35
28: ; preds = %18
%29 = load float, float* %6
%30 = fcmp ole float %29, 0.000000e+00
br i1 %30, label %31, label %34
31: ; preds = %28
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
store i32 %33, i32* %4
br label %34
34: ; preds = %31, %28
br label %35
35: ; preds = %34, %25
br label %36
36: ; preds = %35
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
store i32 %38, i32* %5
br label %15
39: ; preds = %15
%40 = load i32, i32* %3
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %1
ret i32 %42
}

LLVM IR (-O2):
@.str.1 = [18 x i8] c"%f %f %f %f %f %f\00"
@.str.2 = [43 x i8] c"Liczba liczb dodatnich tablicy wynosi: %d\0A\00"
@str = [30 x i8] c"Podaj 6 liczb rzeczywistych: \00"
define i32 @main() {
%1 = alloca [6 x float]
%2 = bitcast [6 x float]* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%4 = getelementptr inbounds [6 x float], [6 x float]* %1, i64 0, i64 0
%5 = getelementptr inbounds [6 x float], [6 x float]* %1, i64 0, i64 1
%6 = getelementptr inbounds [6 x float], [6 x float]* %1, i64 0, i64 2
%7 = getelementptr inbounds [6 x float], [6 x float]* %1, i64 0, i64 3
%8 = getelementptr inbounds [6 x float], [6 x float]* %1, i64 0, i64 4
%9 = getelementptr inbounds [6 x float], [6 x float]* %1, i64 0, i64 5
%10 = call i32 @scanf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), float* %4, float* %5, float* %6, float* %7, float* %8, float* %9)
%11 = load float, float* %4
%12 = fcmp ogt float %11, 0.000000e+00
%13 = zext i1 %12 to i32
%14 = load float, float* %5
%15 = fcmp ogt float %14, 0.000000e+00
%16 = select i1 %12, i32 2, i32 1
%17 = select i1 %15, i32 %16, i32 %13
%18 = load float, float* %6
%19 = fcmp ogt float %18, 0.000000e+00
%20 = zext i1 %19 to i32
%21 = add nuw nsw i32 %17, %20
%22 = load float, float* %7
%23 = fcmp ogt float %22, 0.000000e+00
%24 = zext i1 %23 to i32
%25 = add nuw nsw i32 %21, %24
%26 = load float, float* %8
%27 = fcmp ogt float %26, 0.000000e+00
%28 = zext i1 %27 to i32
%29 = add nuw nsw i32 %25, %28
%30 = load float, float* %9
%31 = fcmp ogt float %30, 0.000000e+00
%32 = zext i1 %31 to i32
%33 = add nuw nsw i32 %29, %32
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i32 %33)
ret i32 0
}