#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*/ gets(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int strlen(char *);
void priklad_jedna() {
  printf("========== PRIKLAD 1 ==========\n");
  char str[50];
  printf("Zadejte text: ");
  gets(str);
  int delka = strlen(str);
  for (int i = 2; i < delka; i += 3) {
    str[i] = '*';
  }
  puts(str);
  printf("========== KONEC PRIKLADU 1 ==========\n");
}


x86 assembly (clang, -O0):
<priklad_jedna>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    0xeb1(%rip),%rdi
call   1050 <printf@plt>
lea    0xec6(%rip),%rdi
call   1050 <printf@plt>
lea    -0x40(%rbp),%rdi
call   1060 <gets@plt>
lea    -0x40(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x44(%rbp)
movl   $0x2,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    119f <priklad_jedna+0x5f>
movslq -0x48(%rbp),%rax
movb   $0x2a,-0x40(%rbp,%rax,1)
mov    -0x48(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x48(%rbp)
jmp    117c <priklad_jedna+0x3c>
lea    -0x40(%rbp),%rdi
call   1030 <puts@plt>
lea    0xe81(%rip),%rdi
call   1050 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<priklad_jedna>:
push   %rbx
sub    $0x40,%rsp
lea    0xec3(%rip),%rdi
call   1030 <puts@plt>
lea    0xea8(%rip),%rdi
call   1050 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1060 <gets@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0x3,%eax
jl     118d <priklad_jedna+0x4d>
mov    %eax,%eax
mov    $0x2,%ecx
nopl   0x0(%rax)
movb   $0x2a,(%rsp,%rcx,1)
add    $0x3,%rcx
cmp    %rax,%rcx
jb     1180 <priklad_jedna+0x40>
mov    %rsp,%rdi
call   1030 <puts@plt>
lea    0xe93(%rip),%rdi
call   1030 <puts@plt>
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"========== PRIKLAD 1 ==========\0A\00"
@.str.1 = [15 x i8] c"Zadejte text: \00"
@.str.2 = [40 x i8] c"========== KONEC PRIKLADU 1 ==========\0A\00"
define void @priklad_jedna() {
%1 = alloca [50 x i8]
%2 = alloca i32
%3 = alloca i32
%4 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%7 = call i32 @gets(i8* %6)
%8 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%9 = call i32 @strlen(i8* %8)
store i32 %9, i32* %2
store i32 2, i32* %3
br label %10
10: ; preds = %18, %0
%11 = load i32, i32* %3
%12 = load i32, i32* %2
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %21
14: ; preds = %10
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %16
store i8 42, i8* %17
br label %18
18: ; preds = %14
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 3
store i32 %20, i32* %3
br label %10
21: ; preds = %10
%22 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%23 = call i32 @puts(i8* %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [15 x i8] c"Zadejte text: \00"
@str = [32 x i8] c"========== PRIKLAD 1 ==========\00"
@str.3 = [39 x i8] c"========== KONEC PRIKLADU 1 ==========\00"
define void @priklad_jedna() {
%1 = alloca [50 x i8]
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%3 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @gets(i8* %3)
%6 = call i32 @strlen(i8* %3)
%7 = icmp sgt i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = zext i32 %6 to i64
br label %13
10: ; preds = %13, %0
%11 = call i32 @puts(i8* %3)
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.3, i64 0, i64 0))
ret void
13: ; preds = %8, %13
%14 = phi i64 [ 2, %8 ], [ %16, %13 ]
%15 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %14
store i8 42, i8* %15
%16 = add nuw nsw i64 %14, 3
%17 = icmp ult i64 %16, %9
br i1 %17, label %13, label %10
}