#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 *);
int main() {
  int i = 0, k = 0, j = 0, smqna, stop;
  int chislo[1000];
  while (i <= 1000) {
    printf("\n Vyvedete chislo %d", i);
    scanf("%d", &chislo[i]);
    if (chislo[i] == 42) {
      break;
    }
    i++;
  }
  while (k < i) {
    if (chislo[k] > chislo[k + 1]) {
      chislo[k + 1] = smqna;
      chislo[k] = chislo[k + 1];
      chislo[k] = smqna;
    }
    k++;
  }
  while (j < k) {
    printf("\n %d", chislo[j]);
    j++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xfc0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jg     11a6 <main+0x86>
mov    -0x8(%rbp),%esi
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
movslq -0x8(%rbp),%rax
lea    -0xfc0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe9b(%rip),%rdi
call   1040 <scanf@plt>
movslq -0x8(%rbp),%rax
cmpl   $0x2a,-0xfc0(%rbp,%rax,4)
2a
jne    1198 <main+0x78>
jmp    11a6 <main+0x86>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1147 <main+0x27>
jmp    11ab <main+0x8b>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1220 <main+0x100>
movslq -0xc(%rbp),%rax
mov    -0xfc0(%rbp,%rax,4),%eax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
cmp    -0xfc0(%rbp,%rcx,4),%eax
jle    1212 <main+0xf2>
mov    -0x14(%rbp),%ecx
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cltq
mov    %ecx,-0xfc0(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0xfc0(%rbp,%rax,4),%ecx
movslq -0xc(%rbp),%rax
mov    %ecx,-0xfc0(%rbp,%rax,4)
mov    -0x14(%rbp),%ecx
movslq -0xc(%rbp),%rax
mov    %ecx,-0xfc0(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ab <main+0x8b>
jmp    1225 <main+0x105>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1256 <main+0x136>
movslq -0x10(%rbp),%rax
mov    -0xfc0(%rbp,%rax,4),%esi
lea    0xdd2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1225 <main+0x105>
xor    %eax,%eax
add    $0xfc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xfa0,%rsp
xor    %r12d,%r12d
lea    0xec6(%rip),%r14
lea    0xed6(%rip),%r15
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %r13d,%esi
call   1030 <printf@plt>
lea    (%rsp,%r12,1),%rsi
mov    %r15,%rdi
call   1040 <scanf@plt>
cmpl   $0x2a,(%rsp,%r13,4)
je     1187 <main+0x67>
add    $0x1,%r13
add    $0x4,%r12
cmp    $0x3e9,%r13
jne    1150 <main+0x30>
mov    $0x3e9,%r13d
jmp    118c <main+0x6c>
test   %r13d,%r13d
je     11b4 <main+0x94>
xor    %ebx,%ebx
lea    0xe80(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%rsp,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    11a0 <main+0x80>
xor    %eax,%eax
add    $0xfa0,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [21 x i8] c"\0A Vyvedete chislo %d\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [5 x i8] c"\0A %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [1000 x i32]
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
br label %8
8: ; preds = %24, %0
%9 = load i32, i32* %2
%10 = icmp sle i32 %9, 1000
br i1 %10, label %11, label %27
11: ; preds = %8
%12 = load i32, i32* %2
%13 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [1000 x i32], [1000 x i32]* %7, i64 0, 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* %2
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [1000 x i32], [1000 x i32]* %7, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = icmp eq i32 %21, 42
br i1 %22, label %23, label %24
23: ; preds = %11
br label %27
24: ; preds = %11
%25 = load i32, i32* %2
%26 = add nsw i32 %25, 1
store i32 %26, i32* %2
br label %8
27: ; preds = %23, %8
br label %28
28: ; preds = %61, %27
%29 = load i32, i32* %3
%30 = load i32, i32* %2
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %64
32: ; preds = %28
%33 = load i32, i32* %3
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [1000 x i32], [1000 x i32]* %7, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = load i32, i32* %3
%38 = add nsw i32 %37, 1
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [1000 x i32], [1000 x i32]* %7, i64 0, i64 %39
%41 = load i32, i32* %40
%42 = icmp sgt i32 %36, %41
br i1 %42, label %43, label %61
43: ; preds = %32
%44 = load i32, i32* %5
%45 = load i32, i32* %3
%46 = add nsw i32 %45, 1
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [1000 x i32], [1000 x i32]* %7, i64 0, i64 %47
store i32 %44, i32* %48
%49 = load i32, i32* %3
%50 = add nsw i32 %49, 1
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [1000 x i32], [1000 x i32]* %7, i64 0, i64 %51
%53 = load i32, i32* %52
%54 = load i32, i32* %3
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [1000 x i32], [1000 x i32]* %7, i64 0, i64 %55
store i32 %53, i32* %56
%57 = load i32, i32* %5
%58 = load i32, i32* %3
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [1000 x i32], [1000 x i32]* %7, i64 0, i64 %59
store i32 %57, i32* %60
br label %61
61: ; preds = %43, %32
%62 = load i32, i32* %3
%63 = add nsw i32 %62, 1
store i32 %63, i32* %3
br label %28
64: ; preds = %28
br label %65
65: ; preds = %69, %64
%66 = load i32, i32* %4
%67 = load i32, i32* %3
%68 = icmp slt i32 %66, %67
br i1 %68, label %69, label %77
69: ; preds = %65
%70 = load i32, i32* %4
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [1000 x i32], [1000 x i32]* %7, i64 0, i64 %71
%73 = load i32, i32* %72
%74 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %73)
%75 = load i32, i32* %4
%76 = add nsw i32 %75, 1
store i32 %76, i32* %4
br label %65
77: ; preds = %65
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"\0A Vyvedete chislo %d\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [5 x i8] c"\0A %d\00"
define i32 @main() {
%1 = alloca [1000 x i32]
%2 = bitcast [1000 x i32]* %1 to i8*
br label %3
3: ; preds = %0, %11
%4 = phi i64 [ 0, %0 ], [ %12, %11 ]
%5 = trunc i64 %4 to i32
%6 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = getelementptr inbounds [1000 x i32], [1000 x i32]* %1, i64 0, i64 %4
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%9 = load i32, i32* %7
%10 = icmp eq i32 %9, 42
br i1 %10, label %14, label %11
11: ; preds = %3
%12 = add nuw nsw i64 %4, 1
%13 = icmp eq i64 %12, 1001
br i1 %13, label %17, label %3
14: ; preds = %3
%15 = trunc i64 %4 to i32
%16 = icmp eq i32 %15, 0
br i1 %16, label %27, label %17
17: ; preds = %11, %14
%18 = phi i64 [ %4, %14 ], [ 1001, %11 ]
%19 = and i64 %18, 4294967295
br label %20
20: ; preds = %17, %20
%21 = phi i64 [ 0, %17 ], [ %25, %20 ]
%22 = getelementptr inbounds [1000 x i32], [1000 x i32]* %1, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %23)
%25 = add nuw nsw i64 %21, 1
%26 = icmp eq i64 %25, %19
br i1 %26, label %27, label %20
27: ; preds = %20, %14
ret i32 0
}