#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_line_no_valid(char *a_string) {
  if (strlen(a_string) > 3) {
    printf("Line no is too long! (max 3 digits)\n");
    return 0;
  }
  if (!is_number(a_string)) {
    printf("Line no has to be number!\n");
    return 0;
  }
  return 1;
}


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

x86 assembly (clang, -O2):
<is_line_no_valid>:
push   %rbx
mov    %rdi,%rbx
call   1050 <strlen@plt>
cmp    $0x3,%eax
jle    1147 <is_line_no_valid+0x17>
lea    0xed5(%rip),%rdi
jmp    1163 <is_line_no_valid+0x33>
mov    %rbx,%rdi
call   1030 <is_number@plt>
mov    %eax,%ecx
mov    $0x1,%eax
test   %ecx,%ecx
je     115c <is_line_no_valid+0x2c>
pop    %rbx
ret
lea    0xe9d(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Line no is too long! (max 3 digits)\0A\00"
@.str.1 = [27 x i8] c"Line no has to be number!\0A\00"
define i32 @is_line_no_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 sgt i32 %5, 3
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 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 ([27 x i8], [27 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 = [26 x i8] c"Line no has to be number!\00"
@str.2 = [36 x i8] c"Line no is too long! (max 3 digits)\00"
define i32 @is_line_no_valid(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 3
br i1 %3, label %7, label %4
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 ([36 x i8], [36 x i8]* @str.2, i64 0, i64 0), %1 ], [ getelementptr inbounds ([26 x i8], [26 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
}