#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 *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int get_mesto(char *mesto) {
  char tmp[7];
  printf("Oznaka parking mesta: ");
  scanf("%s", tmp);
  int len = strlen(tmp);
  if (len > 7) {
    printf("Oznaka parking mesta ne moze biti duza od %d karaktera\n", 7);
    return 0;
  } else {
    strcpy(mesto, tmp);
    return 1;
  }
}


x86 assembly (clang, -O0):
<get_mesto>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x17(%rbp),%rsi
lea    0xeb2(%rip),%rdi
call   1060 <scanf@plt>
lea    -0x17(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x7,-0x1c(%rbp)
jle    119f <get_mesto+0x5f>
lea    0xe93(%rip),%rdi
mov    $0x7,%esi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11b3 <get_mesto+0x73>
mov    -0x10(%rbp),%rdi
lea    -0x17(%rbp),%rsi
call   1030 <strcpy@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_mesto>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r14
lea    0xeae(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb5(%rip),%rdi
lea    0x9(%rsp),%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0x8,%eax
jl     1191 <get_mesto+0x51>
lea    0xe97(%rip),%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11a3 <get_mesto+0x63>
lea    0x9(%rsp),%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Oznaka parking mesta: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [56 x i8] c"Oznaka parking mesta ne moze biti duza od %d karaktera\0A\00"
define i32 @get_mesto(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [7 x i8]
%5 = alloca i32
store i8* %0, i8** %3
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [7 x i8], [7 x i8]* %4, i64 0, i64 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [7 x i8], [7 x i8]* %4, i64 0, i64 0
%10 = call i32 @strlen(i8* %9)
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = icmp sgt i32 %11, 7
br i1 %12, label %13, label %15
13: ; preds = %1
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0), i32 7)
store i32 0, i32* %2
br label %19
15: ; preds = %1
%16 = load i8*, i8** %3
%17 = getelementptr inbounds [7 x i8], [7 x i8]* %4, i64 0, i64 0
%18 = call i32 @strcpy(i8* %16, i8* %17)
store i32 1, i32* %2
br label %19
19: ; preds = %15, %13
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
@.str = [23 x i8] c"Oznaka parking mesta: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [56 x i8] c"Oznaka parking mesta ne moze biti duza od %d karaktera\0A\00"
define i32 @get_mesto(i8* %0) {
%2 = alloca [7 x i8]
%3 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%6 = call i32 @strlen(i8* %3)
%7 = icmp sgt i32 %6, 7
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0), i32 7)
br label %12
10: ; preds = %1
%11 = call i32 @strcpy(i8* %0, i8* %3)
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ 0, %8 ], [ 1, %10 ]
ret i32 %13
}