#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 EOF;
scalar_t__ getchar();
int klucz(int /*<<< orphan*/);
int /*<<< orphan*/ pakowanie(int *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i = 0;
  int tab[4];
  tab[i] = (int)getchar();
  while (tab[i] != EOF) {
    i++;
    if (i == 4) {
      printf("%i\n", klucz(pakowanie(tab)));
      i = 0;
    }
    tab[i] = (int)getchar();
  }
  if (i > 0) {
    int j;
    for (j = i; j < 4; j++)
      tab[j] = ' ';
    printf("%i\n", klucz(pakowanie(tab)));
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %eax,%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
movslq -0x8(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
mov    0x2e72(%rip),%rcx
cmp    (%rcx),%eax
je     11cc <main+0x8c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jne    11b6 <main+0x76>
lea    -0x20(%rbp),%rdi
call   1040 <pakowanie@plt>
mov    %eax,%edi
call   1030 <klucz@plt>
mov    %eax,%esi
lea    0xe56(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %eax,%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
jmp    1167 <main+0x27>
cmpl   $0x0,-0x8(%rbp)
jle    121e <main+0xde>
mov    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x4,-0x24(%rbp)
jge    1200 <main+0xc0>
movslq -0x24(%rbp),%rax
movl   $0x20,-0x20(%rbp,%rax,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11dc <main+0x9c>
lea    -0x20(%rbp),%rdi
call   1040 <pakowanie@plt>
mov    %eax,%edi
call   1030 <klucz@plt>
mov    %eax,%esi
lea    0xde7(%rip),%rdi
call   1050 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,(%rsp)
mov    0x2e8d(%rip),%rbx
cmp    %eax,(%rbx)
je     11fc <main+0xbc>
mov    %rsp,%r14
lea    0xe93(%rip),%r15
xor    %ebp,%ebp
jmp    1191 <main+0x51>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <getchar@plt>
movslq %ebp,%rcx
mov    %eax,(%rsp,%rcx,4)
cmp    %eax,(%rbx)
je     11b6 <main+0x76>
add    $0x1,%ebp
cmp    $0x4,%ebp
jne    1180 <main+0x40>
mov    %r14,%rdi
call   1040 <pakowanie@plt>
mov    %eax,%edi
call   1030 <klucz@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
xor    %ebp,%ebp
jmp    1180 <main+0x40>
test   %ebp,%ebp
jle    11fc <main+0xbc>
cmp    $0x3,%ebp
ja     11df <main+0x9f>
mov    %ebp,%eax
movl   $0x20,(%rsp,%rax,4)
je     11df <main+0x9f>
movl   $0x20,0x4(%rsp,%rax,4)
cmp    $0x2,%eax
je     11df <main+0x9f>
movl   $0x20,0x8(%rsp,%rax,4)
mov    %rsp,%rdi
call   1040 <pakowanie@plt>
mov    %eax,%edi
call   1030 <klucz@plt>
lea    0xe0b(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
@.str = [4 x i8] c"%i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [4 x i32]
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%5 = call i64 (...) @getchar()
%6 = trunc i64 %5 to i32
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 %8
store i32 %6, i32* %9
br label %10
10: ; preds = %27, %0
%11 = load i32, i32* %2
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 %12
%14 = load i32, i32* %13
%15 = load i32, i32* @EOF
%16 = icmp ne i32 %14, %15
br i1 %16, label %17, label %33
17: ; preds = %10
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
%20 = load i32, i32* %2
%21 = icmp eq i32 %20, 4
br i1 %21, label %22, label %27
22: ; preds = %17
%23 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%24 = call i32 @pakowanie(i32* %23)
%25 = call i32 @klucz(i32 %24)
%26 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %25)
store i32 0, i32* %2
br label %27
27: ; preds = %22, %17
%28 = call i64 (...) @getchar()
%29 = trunc i64 %28 to i32
%30 = load i32, i32* %2
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 %31
store i32 %29, i32* %32
br label %10
33: ; preds = %10
%34 = load i32, i32* %2
%35 = icmp sgt i32 %34, 0
br i1 %35, label %36, label %53
36: ; preds = %33
%37 = load i32, i32* %2
store i32 %37, i32* %4
br label %38
38: ; preds = %45, %36
%39 = load i32, i32* %4
%40 = icmp slt i32 %39, 4
br i1 %40, label %41, label %48
41: ; preds = %38
%42 = load i32, i32* %4
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 %43
store i32 32, i32* %44
br label %45
45: ; preds = %41
%46 = load i32, i32* %4
%47 = add nsw i32 %46, 1
store i32 %47, i32* %4
br label %38
48: ; preds = %38
%49 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%50 = call i32 @pakowanie(i32* %49)
%51 = call i32 @klucz(i32 %50)
%52 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %51)
br label %53
53: ; preds = %48, %33
%54 = load i32, i32* %1
ret i32 %54
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [4 x i8] c"%i\0A\00"
define i32 @main() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = tail call i64 (...) @getchar()
%4 = trunc i64 %3 to i32
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
store i32 %4, i32* %5
%6 = load i32, i32* @EOF
%7 = icmp eq i32 %6, %4
br i1 %7, label %45, label %8
8: ; preds = %0, %16
%9 = phi i32 [ %17, %16 ], [ 0, %0 ]
%10 = add nsw i32 %9, 1
%11 = icmp eq i32 %10, 4
br i1 %11, label %12, label %16
12: ; preds = %8
%13 = call i32 @pakowanie(i32* %5)
%14 = call i32 @klucz(i32 %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
br label %16
16: ; preds = %12, %8
%17 = phi i32 [ 0, %12 ], [ %10, %8 ]
%18 = call i64 (...) @getchar()
%19 = trunc i64 %18 to i32
%20 = sext i32 %17 to i64
%21 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 %20
store i32 %19, i32* %21
%22 = load i32, i32* @EOF
%23 = icmp eq i32 %22, %19
br i1 %23, label %24, label %8
24: ; preds = %16
%25 = icmp sgt i32 %17, 0
br i1 %25, label %26, label %45
26: ; preds = %24
%27 = icmp ult i32 %17, 4
br i1 %27, label %28, label %41
28: ; preds = %26
%29 = zext i32 %17 to i64
%30 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 %29
store i32 32, i32* %30
%31 = add nuw nsw i64 %29, 1
%32 = trunc i64 %31 to i32
%33 = icmp eq i32 %32, 4
br i1 %33, label %41, label %34
34: ; preds = %28
%35 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 %31
store i32 32, i32* %35
%36 = add nuw nsw i64 %29, 2
%37 = trunc i64 %36 to i32
%38 = icmp eq i32 %37, 4
br i1 %38, label %41, label %39
39: ; preds = %34
%40 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 %36
store i32 32, i32* %40
br label %41
41: ; preds = %28, %34, %39, %26
%42 = call i32 @pakowanie(i32* %5)
%43 = call i32 @klucz(i32 %42)
%44 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %43)
br label %45
45: ; preds = %0, %41, %24
ret i32 0
}