#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 CetnostZn(char *, char);
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
void priklad_tri() {
  printf("========== PRIKLAD 3 ==========\n");
  char znak;
  char str1[100];
  printf("Zadejte text pro priklad 3: ");
  gets(str1);
  printf("Zadejte pismeno pro hledani v textu: ");
  scanf("%c", &znak);
  printf("Pismeno nalezeno %dx\n", CetnostZn(str1, znak));
  printf("========== KONEC PRIKLADU 3 ==========\n");
}


x86 assembly (clang, -O0):
<priklad_tri>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1040 <gets@plt>
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
lea    -0x1(%rbp),%rsi
call   1060 <scanf@plt>
lea    -0x70(%rbp),%rdi
movsbl -0x1(%rbp),%esi
call   1050 <CetnostZn@plt>
mov    %eax,%esi
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<priklad_tri>:
push   %rbx
sub    $0x80,%rsp
lea    0xefd(%rip),%rdi
call   1030 <puts@plt>
lea    0xe95(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
lea    0xe97(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeaf(%rip),%rdi
lea    0xf(%rsp),%rsi
call   1070 <scanf@plt>
movsbl 0xf(%rsp),%esi
mov    %rbx,%rdi
call   1060 <CetnostZn@plt>
lea    0xe94(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"========== PRIKLAD 3 ==========\0A\00"
@.str.1 = [29 x i8] c"Zadejte text pro priklad 3: \00"
@.str.2 = [38 x i8] c"Zadejte pismeno pro hledani v textu: \00"
@.str.3 = [3 x i8] c"%c\00"
@.str.4 = [22 x i8] c"Pismeno nalezeno %dx\0A\00"
@.str.5 = [40 x i8] c"========== KONEC PRIKLADU 3 ==========\0A\00"
define void @priklad_tri() {
%1 = alloca i8
%2 = alloca [100 x i8]
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%6 = call i32 @gets(i8* %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %1)
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%10 = load i8, i8* %1
%11 = call i32 @CetnostZn(i8* %9, i8 signext %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [29 x i8] c"Zadejte text pro priklad 3: \00"
@.str.2 = [38 x i8] c"Zadejte pismeno pro hledani v textu: \00"
@.str.3 = [3 x i8] c"%c\00"
@.str.4 = [22 x i8] c"Pismeno nalezeno %dx\0A\00"
@str = [32 x i8] c"========== PRIKLAD 3 ==========\00"
@str.6 = [39 x i8] c"========== KONEC PRIKLADU 3 ==========\00"
define void @priklad_tri() {
%1 = alloca i8
%2 = alloca [100 x i8]
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @gets(i8* %4)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %1)
%9 = load i8, i8* %1
%10 = call i32 @CetnostZn(i8* %4, i8 signext %9)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %10)
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.6, i64 0, i64 0))
ret void
}