#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 *);
int wczytaj_dane(int tablica[], int k) {
  int i = 0, podano_liczbe_parzysta = 0;
  while (i < k) {
    printf("Podaj liczbę: ");
    scanf("%d", &tablica[i]);
    if (tablica[i] % 2 == 0)
      podano_liczbe_parzysta = 1;
    ++i;
  }
  return podano_liczbe_parzysta;
}


x86 assembly (clang, -O0):
<wczytaj_dane>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a1 <wczytaj_dane+0x81>
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xea5(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1193 <wczytaj_dane+0x73>
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113d <wczytaj_dane+0x1d>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wczytaj_dane>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1176 <wczytaj_dane+0x56>
mov    %rdi,%rbx
mov    %esi,%ebp
xor    %r12d,%r12d
lea    0xec2(%rip),%r14
lea    0xecb(%rip),%r15
mov    $0x1,%r13d
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
testb  $0x1,(%rbx)
cmove  %r13d,%r12d
add    $0x4,%rbx
add    $0xffffffffffffffff,%rbp
jne    1150 <wczytaj_dane+0x30>
jmp    1179 <wczytaj_dane+0x59>
xor    %r12d,%r12d
mov    %r12d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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