#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 main() {
  int tab[6];
  int max, min;
  int i = 0;
  while (i < 6) {
    printf("Podaj liczbę calkowita: ");
    scanf("%d", &tab[i]);
    ++i;
  }
  max = tab[0];
  for (i = 0; i < 6; i++) {
    if (tab[i] > max)
      max = tab[i];
  }
  min = tab[0];
  for (i = 0; i < 6; i++) {
    if (tab[i] < min)
      min = tab[i];
  }
  printf("Liczba maksymalna to: %d, a minimalna to: %d\n", max, min);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x6,-0x2c(%rbp)
jge    1177 <main+0x57>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x2c(%rbp),%rax
lea    -0x20(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xeb6(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1136 <main+0x16>
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x6,-0x2c(%rbp)
jge    11bd <main+0x9d>
movslq -0x2c(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
cmp    -0x24(%rbp),%eax
jle    11aa <main+0x8a>
movslq -0x2c(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
mov    %eax,-0x24(%rbp)
jmp    11af <main+0x8f>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1184 <main+0x64>
mov    -0x20(%rbp),%eax
mov    %eax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x6,-0x2c(%rbp)
jge    1203 <main+0xe3>
movslq -0x2c(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
cmp    -0x28(%rbp),%eax
jge    11f0 <main+0xd0>
movslq -0x2c(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
mov    %eax,-0x28(%rbp)
jmp    11f5 <main+0xd5>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11ca <main+0xaa>
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
lea    0xe0d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xed2(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedb(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    (%rsp),%edx
mov    0x4(%rsp),%eax
cmp    %edx,%eax
mov    %edx,%esi
cmovg  %eax,%esi
cmovl  %eax,%edx
mov    0x8(%rsp),%eax
cmp    %esi,%eax
cmovg  %eax,%esi
mov    0xc(%rsp),%ecx
cmp    %esi,%ecx
cmovg  %ecx,%esi
mov    0x10(%rsp),%edi
cmp    %esi,%edi
cmovg  %edi,%esi
cmp    %edx,%eax
cmovl  %eax,%edx
cmp    %edx,%ecx
cmovl  %ecx,%edx
cmp    %edx,%edi
cmovl  %edi,%edx
mov    0x14(%rsp),%eax
cmp    %edx,%eax
cmovl  %eax,%edx
cmp    %esi,%eax
cmovg  %eax,%esi
lea    0xe10(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Podaj liczb\C4\99 calkowita: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [46 x i8] c"Liczba maksymalna to: %d, a minimalna to: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
br label %6
6: ; preds = %9, %0
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 6
br i1 %8, label %9, label %17
9: ; preds = %6
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 %12
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %13)
%15 = load i32, i32* %5
%16 = add nsw i32 %15, 1
store i32 %16, i32* %5
br label %6
17: ; preds = %6
%18 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%19 = load i32, i32* %18
store i32 %19, i32* %3
store i32 0, i32* %5
br label %20
20: ; preds = %36, %17
%21 = load i32, i32* %5
%22 = icmp slt i32 %21, 6
br i1 %22, label %23, label %39
23: ; preds = %20
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 %25
%27 = load i32, i32* %26
%28 = load i32, i32* %3
%29 = icmp sgt i32 %27, %28
br i1 %29, label %30, label %35
30: ; preds = %23
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 %32
%34 = load i32, i32* %33
store i32 %34, i32* %3
br label %35
35: ; preds = %30, %23
br label %36
36: ; preds = %35
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
store i32 %38, i32* %5
br label %20
39: ; preds = %20
%40 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%41 = load i32, i32* %40
store i32 %41, i32* %4
store i32 0, i32* %5
br label %42
42: ; preds = %58, %39
%43 = load i32, i32* %5
%44 = icmp slt i32 %43, 6
br i1 %44, label %45, label %61
45: ; preds = %42
%46 = load i32, i32* %5
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 %47
%49 = load i32, i32* %48
%50 = load i32, i32* %4
%51 = icmp slt i32 %49, %50
br i1 %51, label %52, label %57
52: ; preds = %45
%53 = load i32, i32* %5
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 %54
%56 = load i32, i32* %55
store i32 %56, i32* %4
br label %57
57: ; preds = %52, %45
br label %58
58: ; preds = %57
%59 = load i32, i32* %5
%60 = add nsw i32 %59, 1
store i32 %60, i32* %5
br label %42
61: ; preds = %42
%62 = load i32, i32* %3
%63 = load i32, i32* %4
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), i32 %62, i32 %63)
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"Podaj liczb\C4\99 calkowita: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [46 x i8] c"Liczba maksymalna to: %d, a minimalna to: %d\0A\00"
define i32 @main() {
%1 = alloca [6 x i32]
%2 = bitcast [6 x i32]* %1 to i8*
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 2
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%13 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 3
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %13)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%16 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 4
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%19 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 5
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %19)
%21 = load i32, i32* %4
%22 = load i32, i32* %7
%23 = icmp sgt i32 %22, %21
%24 = select i1 %23, i32 %22, i32 %21
%25 = load i32, i32* %10
%26 = icmp sgt i32 %25, %24
%27 = select i1 %26, i32 %25, i32 %24
%28 = load i32, i32* %13
%29 = icmp sgt i32 %28, %27
%30 = select i1 %29, i32 %28, i32 %27
%31 = load i32, i32* %16
%32 = icmp sgt i32 %31, %30
%33 = select i1 %32, i32 %31, i32 %30
%34 = load i32, i32* %19
%35 = icmp sgt i32 %34, %33
%36 = icmp slt i32 %22, %21
%37 = select i1 %36, i32 %22, i32 %21
%38 = icmp slt i32 %25, %37
%39 = select i1 %38, i32 %25, i32 %37
%40 = icmp slt i32 %28, %39
%41 = select i1 %40, i32 %28, i32 %39
%42 = icmp slt i32 %31, %41
%43 = select i1 %42, i32 %31, i32 %41
%44 = icmp slt i32 %34, %43
%45 = select i1 %44, i32 %34, i32 %43
%46 = select i1 %35, i32 %34, i32 %33
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), i32 %46, i32 %45)
ret i32 0
}