#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);
int /*<<< orphan*/ scanf(char *, int *);
void wczyt_vat(int vat[], int ile_towarow) {
  int i;
  int buf = 1;
  for (i = 0; i < ile_towarow; i++) {
    buf = 1;
    do {
      printf(
          "Podaj stawke VAT towaru %d (dopuszczalne wartosci: 0, 5, 8, 23): ",
          i + 1);
      scanf("%d", &buf);
      if (buf == 0 || buf == 5 || buf == 8 || buf == 23) {
        break;
      }
    } while (1 == 1);
    vat[i] = buf;
  }
}


x86 assembly (clang, -O0):
<wczyt_vat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11cf <wczyt_vat+0xaf>
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%esi
add    $0x1,%esi
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x14(%rbp)
je     119a <wczyt_vat+0x7a>
cmpl   $0x5,-0x14(%rbp)
je     119a <wczyt_vat+0x7a>
cmpl   $0x8,-0x14(%rbp)
je     119a <wczyt_vat+0x7a>
cmpl   $0x17,-0x14(%rbp)
jne    119f <wczyt_vat+0x7f>
jmp    11b3 <wczyt_vat+0x93>
jmp    11a4 <wczyt_vat+0x84>
mov    $0x1,%al
test   $0x1,%al
jne    1150 <wczyt_vat+0x30>
jmp    11b3 <wczyt_vat+0x93>
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113d <wczyt_vat+0x1d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wczyt_vat>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,0x10(%rsp)
test   %esi,%esi
jle    11a6 <wczyt_vat+0x86>
mov    %esi,%eax
mov    %rax,0x8(%rsp)
xor    %r14d,%r14d
lea    0xeb8(%rip),%r15
lea    0xef3(%rip),%r12
lea    0x4(%rsp),%r13
mov    $0x800121,%ebp
nopl   0x0(%rax)
movl   $0x1,0x4(%rsp)
lea    0x1(%r14),%rbx
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x17,%eax
ja     1170 <wczyt_vat+0x50>
bt     %eax,%ebp
jae    1170 <wczyt_vat+0x50>
mov    0x10(%rsp),%rcx
mov    %eax,(%rcx,%r14,4)
mov    %rbx,%r14
cmp    0x8(%rsp),%rbx
jne    1160 <wczyt_vat+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [66 x i8] c"Podaj stawke VAT towaru %d (dopuszczalne wartosci: 0, 5, 8, 23): \00"
@.str.1 = [3 x i8] c"%d\00"
define void @wczyt_vat(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 1, i32* %6
store i32 0, i32* %5
br label %7
7: ; preds = %37, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %40
11: ; preds = %7
store i32 1, i32* %6
br label %12
12: ; preds = %30, %11
%13 = load i32, i32* %5
%14 = add nsw i32 %13, 1
%15 = call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%17 = load i32, i32* %6
%18 = icmp eq i32 %17, 0
br i1 %18, label %28, label %19
19: ; preds = %12
%20 = load i32, i32* %6
%21 = icmp eq i32 %20, 5
br i1 %21, label %28, label %22
22: ; preds = %19
%23 = load i32, i32* %6
%24 = icmp eq i32 %23, 8
br i1 %24, label %28, label %25
25: ; preds = %22
%26 = load i32, i32* %6
%27 = icmp eq i32 %26, 23
br i1 %27, label %28, label %29
28: ; preds = %25, %22, %19, %12
br label %31
29: ; preds = %25
br label %30
30: ; preds = %29
br i1 true, label %12, label %31
31: ; preds = %30, %28
%32 = load i32, i32* %6
%33 = load i32*, i32** %3
%34 = load i32, i32* %5
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i32, i32* %33, i64 %35
store i32 %32, i32* %36
br label %37
37: ; preds = %31
%38 = load i32, i32* %5
%39 = add nsw i32 %38, 1
store i32 %39, i32* %5
br label %7
40: ; preds = %7
ret void
}

LLVM IR (-O2):
@.str = [66 x i8] c"Podaj stawke VAT towaru %d (dopuszczalne wartosci: 0, 5, 8, 23): \00"
@.str.1 = [3 x i8] c"%d\00"
define void @wczyt_vat(i32* nocapture writeonly %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %19
6: ; preds = %2
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %6, %16
%9 = phi i64 [ 0, %6 ], [ %10, %16 ]
store i32 1, i32* %3
%10 = add nuw nsw i64 %9, 1
%11 = trunc i64 %10 to i32
br label %12
12: ; preds = %12, %8
%13 = call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i32 %11)
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%15 = load i32, i32* %3
switch i32 %15, label %12 [
i32 23, label %16
i32 8, label %16
i32 5, label %16
i32 0, label %16
]
16: ; preds = %12, %12, %12, %12
%17 = getelementptr inbounds i32, i32* %0, i64 %9
store i32 %15, i32* %17
%18 = icmp eq i64 %10, %7
br i1 %18, label %19, label %8
19: ; preds = %16, %2
ret void
}