#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 ist_schaltjahr(int);
int ermittle_wieviel_tage_im_monat(int monat, int jahr) {
  int anzahl_tage = 0;
  if (monat == 4 || monat == 6 || monat == 9 || monat == 11) {
    anzahl_tage = 30;
  } else if (monat == 1 || monat == 3 || monat == 5 || monat == 7 ||
             monat == 8 || monat == 10 || monat == 12) {
    anzahl_tage = 31;
  } else {
    int schaltjahr = ist_schaltjahr(jahr);
    if (schaltjahr == 1) {
      anzahl_tage = 29;
    } else {
      anzahl_tage = 28;
    }
  }
  return anzahl_tage;
}


x86 assembly (clang, -O0):
<ermittle_wieviel_tage_im_monat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0x4(%rbp)
je     114d <ermittle_wieviel_tage_im_monat+0x3d>
cmpl   $0x6,-0x4(%rbp)
je     114d <ermittle_wieviel_tage_im_monat+0x3d>
cmpl   $0x9,-0x4(%rbp)
je     114d <ermittle_wieviel_tage_im_monat+0x3d>
cmpl   $0xb,-0x4(%rbp)
jne    1159 <ermittle_wieviel_tage_im_monat+0x49>
movl   $0x1e,-0xc(%rbp)
jmp    11dd <ermittle_wieviel_tage_im_monat+0xcd>
cmpl   $0x1,-0x4(%rbp)
je     119f <ermittle_wieviel_tage_im_monat+0x8f>
cmpl   $0x3,-0x4(%rbp)
je     119f <ermittle_wieviel_tage_im_monat+0x8f>
cmpl   $0x5,-0x4(%rbp)
je     119f <ermittle_wieviel_tage_im_monat+0x8f>
cmpl   $0x7,-0x4(%rbp)
je     119f <ermittle_wieviel_tage_im_monat+0x8f>
cmpl   $0x8,-0x4(%rbp)
je     119f <ermittle_wieviel_tage_im_monat+0x8f>
cmpl   $0xa,-0x4(%rbp)
je     119f <ermittle_wieviel_tage_im_monat+0x8f>
cmpl   $0xc,-0x4(%rbp)
jne    11ab <ermittle_wieviel_tage_im_monat+0x9b>
movl   $0x1f,-0xc(%rbp)
jmp    11d8 <ermittle_wieviel_tage_im_monat+0xc8>
mov    -0x8(%rbp),%edi
call   1030 <ist_schaltjahr@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    11cc <ermittle_wieviel_tage_im_monat+0xbc>
movl   $0x1d,-0xc(%rbp)
jmp    11d3 <ermittle_wieviel_tage_im_monat+0xc3>
movl   $0x1c,-0xc(%rbp)
jmp    11d8 <ermittle_wieviel_tage_im_monat+0xc8>
jmp    11dd <ermittle_wieviel_tage_im_monat+0xcd>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ermittle_wieviel_tage_im_monat>:
push   %rax
add    $0xffffffff,%edi
cmp    $0xc,%edi
jae    1123 <ermittle_wieviel_tage_im_monat+0x13>
mov    $0xffd,%eax
bt     %edi,%eax
jb     1139 <ermittle_wieviel_tage_im_monat+0x29>
mov    %esi,%edi
call   1030 <ist_schaltjahr@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
sete   %al
or     $0x1c,%eax
pop    %rcx
ret
movslq %edi,%rax
lea    0xebd(%rip),%rcx
mov    (%rcx,%rax,4),%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @ermittle_wieviel_tage_im_monat(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 4
br i1 %8, label %18, label %9
9: ; preds = %2
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, 6
br i1 %11, label %18, label %12
12: ; preds = %9
%13 = load i32, i32* %3
%14 = icmp eq i32 %13, 9
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = load i32, i32* %3
%17 = icmp eq i32 %16, 11
br i1 %17, label %18, label %19
18: ; preds = %15, %12, %9, %2
store i32 30, i32* %5
br label %50
19: ; preds = %15
%20 = load i32, i32* %3
%21 = icmp eq i32 %20, 1
br i1 %21, label %40, label %22
22: ; preds = %19
%23 = load i32, i32* %3
%24 = icmp eq i32 %23, 3
br i1 %24, label %40, label %25
25: ; preds = %22
%26 = load i32, i32* %3
%27 = icmp eq i32 %26, 5
br i1 %27, label %40, label %28
28: ; preds = %25
%29 = load i32, i32* %3
%30 = icmp eq i32 %29, 7
br i1 %30, label %40, label %31
31: ; preds = %28
%32 = load i32, i32* %3
%33 = icmp eq i32 %32, 8
br i1 %33, label %40, label %34
34: ; preds = %31
%35 = load i32, i32* %3
%36 = icmp eq i32 %35, 10
br i1 %36, label %40, label %37
37: ; preds = %34
%38 = load i32, i32* %3
%39 = icmp eq i32 %38, 12
br i1 %39, label %40, label %41
40: ; preds = %37, %34, %31, %28, %25, %22, %19
store i32 31, i32* %5
br label %49
41: ; preds = %37
%42 = load i32, i32* %4
%43 = call i32 @ist_schaltjahr(i32 %42)
store i32 %43, i32* %6
%44 = load i32, i32* %6
%45 = icmp eq i32 %44, 1
br i1 %45, label %46, label %47
46: ; preds = %41
store i32 29, i32* %5
br label %48
47: ; preds = %41
store i32 28, i32* %5
br label %48
48: ; preds = %47, %46
br label %49
49: ; preds = %48, %40
br label %50
50: ; preds = %49, %18
%51 = load i32, i32* %5
ret i32 %51
}

LLVM IR (-O2):
@switch.table.ermittle_wieviel_tage_im_monat = [12 x i32] [i32 31, i32 30, i32 31, i32 30, i32 31, i32 30, i32 31, i32 31, i32 30, i32 31, i32 30, i32 31]
define i32 @ermittle_wieviel_tage_im_monat(i32 %0, i32 %1) {
%3 = add i32 %0, -1
%4 = icmp ult i32 %3, 12
br i1 %4, label %9, label %5
5: ; preds = %9, %2
%6 = tail call i32 @ist_schaltjahr(i32 %1)
%7 = icmp eq i32 %6, 1
%8 = select i1 %7, i32 29, i32 28
br label %18
9: ; preds = %2
%10 = trunc i32 %3 to i16
%11 = lshr i16 4093, %10
%12 = and i16 %11, 1
%13 = icmp eq i16 %12, 0
br i1 %13, label %5, label %14
14: ; preds = %9
%15 = sext i32 %3 to i64
%16 = getelementptr inbounds [12 x i32], [12 x i32]* @switch.table.ermittle_wieviel_tage_im_monat, i64 0, i64 %15
%17 = load i32, i32* %16
br label %18
18: ; preds = %14, %5
%19 = phi i32 [ %8, %5 ], [ %17, %14 ]
ret i32 %19
}