#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 */
scalar_t__ check_date(int *);
int check_digit(int *);
scalar_t__ check_month(int *);
int check_UCN_validity(int *UCN) {
  if (check_month(UCN))
    return 0;
  else if (check_date(UCN))
    return 0;
  else if (check_digit(UCN) != UCN[9])
    return 0;
  else
    return 1;
}


x86 assembly (clang, -O0):
<check_UCN_validity>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <check_month@plt>
cmp    $0x0,%rax
je     115b <check_UCN_validity+0x2b>
movl   $0x0,-0x4(%rbp)
jmp    11a3 <check_UCN_validity+0x73>
mov    -0x10(%rbp),%rdi
call   1040 <check_date@plt>
cmp    $0x0,%rax
je     117a <check_UCN_validity+0x4a>
movl   $0x0,-0x4(%rbp)
jmp    11a3 <check_UCN_validity+0x73>
mov    -0x10(%rbp),%rdi
call   1050 <check_digit@plt>
mov    -0x10(%rbp),%rcx
cmp    0x24(%rcx),%eax
je     119c <check_UCN_validity+0x6c>
movl   $0x0,-0x4(%rbp)
jmp    11a3 <check_UCN_validity+0x73>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_UCN_validity>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <check_month@plt>
xor    %ebp,%ebp
test   %rax,%rax
jne    1160 <check_UCN_validity+0x30>
mov    %rbx,%rdi
call   1040 <check_date@plt>
test   %rax,%rax
jne    1160 <check_UCN_validity+0x30>
mov    %rbx,%rdi
call   1050 <check_digit@plt>
xor    %ebp,%ebp
cmp    0x24(%rbx),%eax
sete   %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @check_UCN_validity(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = call i64 @check_month(i32* %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 0, i32* %2
br label %22
8: ; preds = %1
%9 = load i32*, i32** %3
%10 = call i64 @check_date(i32* %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
store i32 0, i32* %2
br label %22
13: ; preds = %8
%14 = load i32*, i32** %3
%15 = call i32 @check_digit(i32* %14)
%16 = load i32*, i32** %3
%17 = getelementptr inbounds i32, i32* %16, i64 9
%18 = load i32, i32* %17
%19 = icmp ne i32 %15, %18
br i1 %19, label %20, label %21
20: ; preds = %13
store i32 0, i32* %2
br label %22
21: ; preds = %13
store i32 1, i32* %2
br label %22
22: ; preds = %21, %20, %12, %7
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
define i32 @check_UCN_validity(i32* %0) {
%2 = tail call i64 @check_month(i32* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %13
4: ; preds = %1
%5 = tail call i64 @check_date(i32* %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = tail call i32 @check_digit(i32* %0)
%9 = getelementptr inbounds i32, i32* %0, i64 9
%10 = load i32, i32* %9
%11 = icmp eq i32 %8, %10
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %7, %4, %1
%14 = phi i32 [ 0, %1 ], [ 0, %4 ], [ %12, %7 ]
ret i32 %14
}