#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__ leapyear(int);
int pruefeDatum(int day, int month, int year) {
  static int days[] = {31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  days[1] = leapyear(year) ? 29 : 28;
  return !(month > 0 && month <= 12 && day > 0 && day <= days[month - 1]);
}


x86 assembly (clang, -O0):
<pruefeDatum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <leapyear@plt>
mov    %rax,%rdx
mov    $0x1c,%eax
mov    $0x1d,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    %eax,0x2ef1(%rip)
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0xd(%rbp)
jle    118c <pruefeDatum+0x7c>
xor    %eax,%eax
cmpl   $0xc,-0x8(%rbp)
mov    %al,-0xd(%rbp)
jg     118c <pruefeDatum+0x7c>
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0xd(%rbp)
jle    118c <pruefeDatum+0x7c>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rdx
lea    0x2ead(%rip),%rcx
cmp    (%rcx,%rdx,4),%eax
setle  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pruefeDatum>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
mov    %edx,%edi
call   1030 <leapyear@plt>
cmp    $0x1,%rax
mov    $0x1d,%eax
sbb    $0x0,%eax
mov    %eax,0x2f04(%rip)
mov    $0x1,%eax
test   %ebx,%ebx
jle    1152 <pruefeDatum+0x42>
add    $0xffffffff,%ebp
cmp    $0xb,%ebp
ja     1152 <pruefeDatum+0x42>
mov    %ebp,%ecx
lea    0x2ee6(%rip),%rdx
xor    %eax,%eax
cmp    %ebx,(%rdx,%rcx,4)
setl   %al
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@pruefeDatum.days = internal global [12 x i32] [i32 31, i32 0, i32 31, i32 30, i32 31, i32 30, i32 31, i32 31, i32 30, i32 31, i32 30, i32 31]
define i32 @pruefeDatum(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = call i64 @leapyear(i32 %7)
%9 = icmp ne i64 %8, 0
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 29, i32 28
store i32 %11, i32* getelementptr inbounds ([12 x i32], [12 x i32]* @pruefeDatum.days, i64 0, i64 1)
%12 = load i32, i32* %5
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %28
14: ; preds = %3
%15 = load i32, i32* %5
%16 = icmp sle i32 %15, 12
br i1 %16, label %17, label %28
17: ; preds = %14
%18 = load i32, i32* %4
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %28
20: ; preds = %17
%21 = load i32, i32* %4
%22 = load i32, i32* %5
%23 = sub nsw i32 %22, 1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [12 x i32], [12 x i32]* @pruefeDatum.days, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = icmp sle i32 %21, %26
br label %28
28: ; preds = %20, %17, %14, %3
%29 = phi i1 [ false, %17 ], [ false, %14 ], [ false, %3 ], [ %27, %20 ]
%30 = xor i1 %29, true
%31 = zext i1 %30 to i32
ret i32 %31
}

LLVM IR (-O2):
@pruefeDatum.days = internal unnamed_addr global [12 x i32] [i32 31, i32 0, i32 31, i32 30, i32 31, i32 30, i32 31, i32 31, i32 30, i32 31, i32 30, i32 31]
define i32 @pruefeDatum(i32 %0, i32 %1, i32 %2) {
%4 = tail call i64 @leapyear(i32 %2)
%5 = icmp eq i64 %4, 0
%6 = select i1 %5, i32 28, i32 29
store i32 %6, i32* getelementptr inbounds ([12 x i32], [12 x i32]* @pruefeDatum.days, i64 0, i64 1)
%7 = add i32 %1, -1
%8 = icmp ult i32 %7, 12
%9 = icmp sgt i32 %0, 0
%10 = and i1 %9, %8
br i1 %10, label %11, label %17
11: ; preds = %3
%12 = zext i32 %7 to i64
%13 = getelementptr inbounds [12 x i32], [12 x i32]* @pruefeDatum.days, i64 0, i64 %12
%14 = load i32, i32* %13
%15 = icmp slt i32 %14, %0
%16 = zext i1 %15 to i32
br label %17
17: ; preds = %11, %3
%18 = phi i32 [ 1, %3 ], [ %16, %11 ]
ret i32 %18
}