#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 strlen(char *);
main() {
  int k;
  char str1[] = "Slobomir";
  char *str2 = "FIT";
  char str3[101];
  char str4[] = {'O', 's', 'n', 'o', 'v', 'i', '\0'};
  printf("str4 = %s\n", str4);
  printf("duzina str4 = %d\n", strlen(str4));
  k = 0;
  while (str2[k] != '\0')
    k++;
  printf("k = %d\n", k);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x11(%rbp)
mov    0xec5(%rip),%al
mov    %al,-0x9(%rbp)
lea    0xebc(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb6(%rip),%eax
mov    %eax,-0x97(%rbp)
mov    0xead(%rip),%ax
mov    %ax,-0x93(%rbp)
mov    0xea2(%rip),%al
mov    %al,-0x91(%rbp)
lea    -0x97(%rbp),%rsi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x97(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%esi
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x8(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     11d2 <main+0xb2>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11af <main+0x8f>
mov    -0x8(%rbp),%esi
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x69766f,0xb(%rsp)
movl   $0x6f6e734f,0x8(%rsp)
6f
lea    0xecb(%rip),%rdi
lea    0x8(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0xeb8(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeba(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.str1 = [9 x i8] c"Slobomir\00"
@.str = [4 x i8] c"FIT\00"
@__const.main.str4 = [7 x i8] c"Osnovi\00"
@.str.1 = [11 x i8] c"str4 = %s\0A\00"
@.str.2 = [18 x i8] c"duzina str4 = %d\0A\00"
@.str.3 = [8 x i8] c"k = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [9 x i8]
%4 = alloca i8*
%5 = alloca [101 x i8]
%6 = alloca [7 x i8]
store i32 0, i32* %1
%7 = bitcast [9 x i8]* %3 to i8*
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %4
%8 = bitcast [7 x i8]* %6 to i8*
%9 = getelementptr inbounds [7 x i8], [7 x i8]* %6, i64 0, i64 0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [7 x i8], [7 x i8]* %6, i64 0, i64 0
%12 = call i32 @strlen(i8* %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %12)
store i32 0, i32* %2
br label %14
14: ; preds = %22, %0
%15 = load i8*, i8** %4
%16 = load i32, i32* %2
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %14
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 1
store i32 %24, i32* %2
br label %14
25: ; preds = %14
%26 = load i32, i32* %2
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %1
ret i32 %28
}

LLVM IR (-O2):
@__const.main.str4 = [7 x i8] c"Osnovi\00"
@.str.1 = [11 x i8] c"str4 = %s\0A\00"
@.str.2 = [18 x i8] c"duzina str4 = %d\0A\00"
@.str.3 = [8 x i8] c"k = %d\0A\00"
define i32 @main() {
%1 = alloca [7 x i8]
%2 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%4 = call i32 @strlen(i8* %2)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %4)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 3)
ret i32 0
}