#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 *, ...);
void write_out(long int *matrix, long int range) {
  long int i;
  printf("\nLiczby pierwsze z tego przedzialu:\n \n");
  for (i = 2; i <= range; i++) {
    if (matrix[i] != 0) {
      printf("%d \n", matrix[i]);
    }
  }
}


x86 assembly (clang, -O0):
<write_out>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x2,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jg     1187 <write_out+0x77>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1171 <write_out+0x61>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1176 <write_out+0x66>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1136 <write_out+0x26>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_out>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
mov    %rdi,%r14
lea    0xed0(%rip),%rdi
call   1030 <puts@plt>
cmp    $0x2,%r12
jge    114c <write_out+0x2c>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
add    $0xffffffffffffffff,%r12
lea    0xea9(%rip),%r15
xor    %ebx,%ebx
jmp    1169 <write_out+0x49>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %rbx,%r12
je     1140 <write_out+0x20>
mov    0x10(%r14,%rbx,8),%rsi
test   %rsi,%rsi
je     1160 <write_out+0x40>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1160 <write_out+0x40>

LLVM IR (-O0):
@.str = [39 x i8] c"\0ALiczby pierwsze z tego przedzialu:\0A \0A\00"
@.str.1 = [5 x i8] c"%d \0A\00"
define void @write_out(i64* %0, i64 %1) {
%3 = alloca i64*
%4 = alloca i64
%5 = alloca i64
store i64* %0, i64** %3
store i64 %1, i64* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
store i64 2, i64* %5
br label %7
7: ; preds = %24, %2
%8 = load i64, i64* %5
%9 = load i64, i64* %4
%10 = icmp sle i64 %8, %9
br i1 %10, label %11, label %27
11: ; preds = %7
%12 = load i64*, i64** %3
%13 = load i64, i64* %5
%14 = getelementptr inbounds i64, i64* %12, i64 %13
%15 = load i64, i64* %14
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %11
%18 = load i64*, i64** %3
%19 = load i64, i64* %5
%20 = getelementptr inbounds i64, i64* %18, i64 %19
%21 = load i64, i64* %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %21)
br label %23
23: ; preds = %17, %11
br label %24
24: ; preds = %23
%25 = load i64, i64* %5
%26 = add nsw i64 %25, 1
store i64 %26, i64* %5
br label %7
27: ; preds = %7
ret void
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"%d \0A\00"
@str = [38 x i8] c"\0ALiczby pierwsze z tego przedzialu:\0A \00"
define void @write_out(i64* nocapture %0, i64 %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%4 = icmp slt i64 %1, 2
br i1 %4, label %15, label %5
5: ; preds = %2, %12
%6 = phi i64 [ %13, %12 ], [ 2, %2 ]
%7 = getelementptr inbounds i64, i64* %0, i64 %6
%8 = load i64, i64* %7
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %5
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %8)
br label %12
12: ; preds = %5, %10
%13 = add nuw i64 %6, 1
%14 = icmp eq i64 %6, %1
br i1 %14, label %15, label %5
15: ; preds = %12, %2
ret void
}