#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*/ snprintf(char *, size_t, char *, ...);
unsigned int strlen(char const *);
int validation_url(const char *pparam, char *perr, size_t size) {
  const char *pcomm = "url is invalid value";
  unsigned int ilen;
  if (pparam == NULL) {
    (void)snprintf(perr, size, "url is NULL");
    return 1;
  }
  ilen = strlen(pparam);
  if (ilen > (unsigned int)2083) {
    (void)snprintf(perr, size, "%s", pcomm);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<validation_url>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
lea    0xec5(%rip),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116c <validation_url+0x4c>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    0xebc(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11b2 <validation_url+0x92>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x823,-0x2c(%rbp)
jbe    11ab <validation_url+0x8b>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rcx
lea    0xe89(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11b2 <validation_url+0x92>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validation_url>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
test   %rdi,%rdi
je     115d <validation_url+0x3d>
call   1030 <strlen@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x824,%ecx
jb     1176 <validation_url+0x56>
lea    0xeda(%rip),%rdx
lea    0xeb2(%rip),%rcx
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <snprintf@plt>
jmp    1171 <validation_url+0x51>
lea    0xeb1(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <snprintf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [21 x i8] c"url is invalid value\00"
@.str.1 = [12 x i8] c"url is NULL\00"
@.str.2 = [3 x i8] c"%s\00"
define i32 @validation_url(i8* %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8** %8
%10 = load i8*, i8** %5
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %16
12: ; preds = %3
%13 = load i8*, i8** %6
%14 = load i64, i64* %7
%15 = call i32 (i8*, i64, i8*, ...) @snprintf(i8* %13, i64 %14, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %4
br label %27
16: ; preds = %3
%17 = load i8*, i8** %5
%18 = call i32 @strlen(i8* %17)
store i32 %18, i32* %9
%19 = load i32, i32* %9
%20 = icmp ugt i32 %19, 2083
br i1 %20, label %21, label %26
21: ; preds = %16
%22 = load i8*, i8** %6
%23 = load i64, i64* %7
%24 = load i8*, i8** %8
%25 = call i32 (i8*, i64, i8*, ...) @snprintf(i8* %22, i64 %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %24)
store i32 1, i32* %4
br label %27
26: ; preds = %16
store i32 0, i32* %4
br label %27
27: ; preds = %26, %21, %12
%28 = load i32, i32* %4
ret i32 %28
}

LLVM IR (-O2):
@.str = [21 x i8] c"url is invalid value\00"
@.str.1 = [12 x i8] c"url is NULL\00"
@.str.2 = [3 x i8] c"%s\00"
define i32 @validation_url(i8* %0, i8* nocapture writeonly %1, i64 %2) {
%4 = icmp eq i8* %0, null
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 (i8*, i64, i8*, ...) @snprintf(i8* %1, i64 %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %12
7: ; preds = %3
%8 = tail call i32 @strlen(i8* %0)
%9 = icmp ugt i32 %8, 2083
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i32 (i8*, i64, i8*, ...) @snprintf(i8* %1, i64 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %7, %10, %5
%13 = phi i32 [ 1, %5 ], [ 1, %10 ], [ 0, %7 ]
ret i32 %13
}