#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 calkowita, suma, licznik;
  suma = 0;
  calkowita = 3;
  do {
    if (calkowita <= 2) {
      printf("Podales liczbe mniejsza lub rowna 2! ");
    }
    printf("Podaj liczbe calkowita wieksza od 2 \n");
    scanf("%d", &calkowita);
    printf("-------- \n");
  } while (calkowita <= 2);
  for (licznik = 1; licznik <= calkowita; licznik++) {
    suma = suma + licznik;
    printf("%d \n", licznik);
  }
  printf("-------- \n = %d \n", suma);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x3,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jg     1155 <main+0x35>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x2,-0x8(%rbp)
jle    113d <main+0x1d>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11c6 <main+0xa6>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%esi
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1192 <main+0x72>
mov    -0xc(%rbp),%esi
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x3,0x4(%rsp)
mov    $0x3,%eax
lea    0xeb1(%rip),%r14
lea    0xee5(%rip),%r15
lea    0xec9(%rip),%r12
lea    0x4(%rsp),%r13
lea    0xef7(%rip),%rbx
jmp    1194 <main+0x64>
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%eax
cmp    $0x3,%eax
jge    11a5 <main+0x75>
cmp    $0x2,%eax
jg     1170 <main+0x40>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1170 <main+0x40>
lea    0xe8a(%rip),%r14
xor    %eax,%eax
xor    %ebx,%ebx
mov    %eax,%ebp
add    $0x1,%ebp
add    %eax,%ebx
add    $0x1,%ebx
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%eax
cmp    0x4(%rsp),%ebp
jl     11b0 <main+0x80>
lea    0xe54(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Podales liczbe mniejsza lub rowna 2! \00"
@.str.1 = [38 x i8] c"Podaj liczbe calkowita wieksza od 2 \0A\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [11 x i8] c"-------- \0A\00"
@.str.4 = [5 x i8] c"%d \0A\00"
@.str.5 = [18 x i8] c"-------- \0A = %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 3, i32* %2
br label %5
5: ; preds = %14, %0
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %5
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %14
14: ; preds = %10
%15 = load i32, i32* %2
%16 = icmp sle i32 %15, 2
br i1 %16, label %5, label %17
17: ; preds = %14
store i32 1, i32* %4
br label %18
18: ; preds = %28, %17
%19 = load i32, i32* %4
%20 = load i32, i32* %2
%21 = icmp sle i32 %19, %20
br i1 %21, label %22, label %31
22: ; preds = %18
%23 = load i32, i32* %3
%24 = load i32, i32* %4
%25 = add nsw i32 %23, %24
store i32 %25, i32* %3
%26 = load i32, i32* %4
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %22
%29 = load i32, i32* %4
%30 = add nsw i32 %29, 1
store i32 %30, i32* %4
br label %18
31: ; preds = %18
%32 = load i32, i32* %3
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i32 %32)
ret i32 0
}

LLVM IR (-O2):
@.str = [38 x i8] c"Podales liczbe mniejsza lub rowna 2! \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.4 = [5 x i8] c"%d \0A\00"
@.str.5 = [18 x i8] c"-------- \0A = %d \0A\00"
@str = [37 x i8] c"Podaj liczbe calkowita wieksza od 2 \00"
@str.6 = [10 x i8] c"-------- \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 3, i32* %1
br label %3
3: ; preds = %8, %0
%4 = phi i32 [ %12, %8 ], [ 3, %0 ]
%5 = icmp slt i32 %4, 3
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.6, i64 0, i64 0))
%12 = load i32, i32* %1
%13 = icmp slt i32 %12, 3
br i1 %13, label %3, label %14
14: ; preds = %8, %14
%15 = phi i32 [ %19, %14 ], [ 1, %8 ]
%16 = phi i32 [ %17, %14 ], [ 0, %8 ]
%17 = add nuw nsw i32 %15, %16
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %15)
%19 = add nuw nsw i32 %15, 1
%20 = load i32, i32* %1
%21 = icmp slt i32 %15, %20
br i1 %21, label %14, label %22
22: ; preds = %14
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i32 %17)
ret i32 0
}