#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 validate_name(char const *);
int validate_version(char const *);
int validate_dependency(const char *name, const char *version) {
  if (name == NULL || version == NULL) {
    return -1;
  }
  if (validate_name(name) == -1) {
    return -1;
  }
  if (validate_version(version) == -1) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<validate_dependency>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1146 <validate_dependency+0x26>
cmpq   $0x0,-0x18(%rbp)
jne    1152 <validate_dependency+0x32>
movl   $0xffffffff,-0x4(%rbp)
jmp    1195 <validate_dependency+0x75>
mov    -0x10(%rbp),%rdi
call   1030 <validate_name@plt>
cmp    $0xffffffff,%eax
jne    1170 <validate_dependency+0x50>
movl   $0xffffffff,-0x4(%rbp)
jmp    1195 <validate_dependency+0x75>
mov    -0x18(%rbp),%rdi
call   1040 <validate_version@plt>
cmp    $0xffffffff,%eax
jne    118e <validate_dependency+0x6e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1195 <validate_dependency+0x75>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validate_dependency>:
push   %r14
push   %rbx
push   %rax
mov    $0xffffffff,%ebx
test   %rdi,%rdi
je     1152 <validate_dependency+0x32>
mov    %rsi,%r14
test   %rsi,%rsi
je     1152 <validate_dependency+0x32>
call   1030 <validate_name@plt>
cmp    $0xffffffff,%eax
je     1152 <validate_dependency+0x32>
mov    %r14,%rdi
call   1040 <validate_version@plt>
xor    %ebx,%ebx
cmp    $0xffffffff,%eax
sete   %bl
neg    %ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @validate_dependency(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = icmp eq i8* %6, null
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %12
11: ; preds = %8, %2
store i32 -1, i32* %3
br label %23
12: ; preds = %8
%13 = load i8*, i8** %4
%14 = call i32 @validate_name(i8* %13)
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %17
16: ; preds = %12
store i32 -1, i32* %3
br label %23
17: ; preds = %12
%18 = load i8*, i8** %5
%19 = call i32 @validate_version(i8* %18)
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %22
21: ; preds = %17
store i32 -1, i32* %3
br label %23
22: ; preds = %17
store i32 0, i32* %3
br label %23
23: ; preds = %22, %21, %16, %11
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @validate_dependency(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
%4 = icmp eq i8* %1, null
%5 = or i1 %3, %4
br i1 %5, label %13, label %6
6: ; preds = %2
%7 = tail call i32 @validate_name(i8* %0)
%8 = icmp eq i32 %7, -1
br i1 %8, label %13, label %9
9: ; preds = %6
%10 = tail call i32 @validate_version(i8* %1)
%11 = icmp eq i32 %10, -1
%12 = sext i1 %11 to i32
br label %13
13: ; preds = %9, %6, %2
%14 = phi i32 [ -1, %2 ], [ -1, %6 ], [ %12, %9 ]
ret i32 %14
}