#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*/ puts(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int get_reg_br(char *reg_br) {
  char tmp[10];
  printf("Registarska oznaka: ");
  scanf("%s", tmp);
  int len = strlen(tmp);
  if (len > 10) {
    printf("Registarska oznaka ne moze biti duza od %d karaktera.\n", 10);
    puts("Upisi ponovo.");
    return 0;
  } else {
    strcpy(reg_br, tmp);
    return 1;
  }
}


x86 assembly (clang, -O0):
<get_reg_br>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x1a(%rbp),%rsi
lea    0xea0(%rip),%rdi
call   1070 <scanf@plt>
lea    -0x1a(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0xa,-0x20(%rbp)
jle    11bb <get_reg_br+0x6b>
lea    0xe81(%rip),%rdi
mov    $0xa,%esi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xea5(%rip),%rdi
call   1040 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    11cf <get_reg_br+0x7f>
mov    -0x10(%rbp),%rdi
lea    -0x1a(%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_reg_br>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r14
lea    0xe9e(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xea3(%rip),%rdi
lea    0x6(%rsp),%rbx
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
cmp    $0xb,%eax
jl     11ad <get_reg_br+0x5d>
lea    0xe85(%rip),%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xea9(%rip),%rdi
call   1040 <puts@plt>
jmp    11bf <get_reg_br+0x6f>
lea    0x6(%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 = [21 x i8] c"Registarska oznaka: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [55 x i8] c"Registarska oznaka ne moze biti duza od %d karaktera.\0A\00"
@.str.3 = [14 x i8] c"Upisi ponovo.\00"
define i32 @get_reg_br(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [10 x i8]
%5 = alloca i32
store i8* %0, i8** %3
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [10 x i8], [10 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 [10 x i8], [10 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, 10
br i1 %12, label %13, label %16
13: ; preds = %1
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0), i32 10)
%15 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %2
br label %20
16: ; preds = %1
%17 = load i8*, i8** %3
%18 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%19 = call i32 @strcpy(i8* %17, i8* %18)
store i32 1, i32* %2
br label %20
20: ; preds = %16, %13
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
@.str = [21 x i8] c"Registarska oznaka: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [55 x i8] c"Registarska oznaka ne moze biti duza od %d karaktera.\0A\00"
@.str.3 = [14 x i8] c"Upisi ponovo.\00"
define i32 @get_reg_br(i8* %0) {
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 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, 10
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0), i32 10)
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
br label %13
11: ; preds = %1
%12 = call i32 @strcpy(i8* %0, i8* %3)
br label %13
13: ; preds = %11, %8
%14 = phi i32 [ 0, %8 ], [ 1, %11 ]
ret i32 %14
}