#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*/ is_number(char *);
int /*<<< orphan*/ printf(char *);
int strlen(char *);
int is_driver_pesel_valid(char *a_string) {
  if (strlen(a_string) != 11) {
    printf("PESEL has to be 11-digit long!\n");
    return 0;
  }
  if (!is_number(a_string)) {
    printf("PESEL has to be number!\n");
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<is_driver_pesel_valid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0xb,%eax
je     1166 <is_driver_pesel_valid+0x36>
lea    0xeab(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1197 <is_driver_pesel_valid+0x67>
mov    -0x10(%rbp),%rdi
call   1030 <is_number@plt>
cmp    $0x0,%eax
jne    1190 <is_driver_pesel_valid+0x60>
lea    0xea1(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1197 <is_driver_pesel_valid+0x67>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_driver_pesel_valid>:
push   %rbx
mov    %rdi,%rbx
call   1050 <strlen@plt>
cmp    $0xb,%eax
jne    1153 <is_driver_pesel_valid+0x23>
mov    %rbx,%rdi
call   1030 <is_number@plt>
mov    %eax,%ecx
mov    $0x1,%eax
test   %ecx,%ecx
je     115c <is_driver_pesel_valid+0x2c>
pop    %rbx
ret
lea    0xebe(%rip),%rdi
jmp    1163 <is_driver_pesel_valid+0x33>
lea    0xe9d(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"PESEL has to be 11-digit long!\0A\00"
@.str.1 = [25 x i8] c"PESEL has to be number!\0A\00"
define i32 @is_driver_pesel_valid(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @strlen(i8* %4)
%6 = icmp ne i32 %5, 11
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %16
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call i32 @is_number(i8* %10)
%12 = icmp ne i32 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %9
%14 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %2
br label %16
15: ; preds = %9
store i32 1, i32* %2
br label %16
16: ; preds = %15, %13, %7
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
@str = [24 x i8] c"PESEL has to be number!\00"
@str.2 = [31 x i8] c"PESEL has to be 11-digit long!\00"
define i32 @is_driver_pesel_valid(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp eq i32 %2, 11
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @is_number(i8* %0)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %4, %1
%8 = phi i8* [ getelementptr inbounds ([31 x i8], [31 x i8]* @str.2, i64 0, i64 0), %1 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0), %4 ]
%9 = tail call i32 @puts(i8* dereferenceable(1) %8)
br label %10
10: ; preds = %7, %4
%11 = phi i32 [ 1, %4 ], [ 0, %7 ]
ret i32 %11
}