#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*/ assert(int);
int longueur_mois(int an, int mois) {
  assert(1 <= mois && mois <= 12);
  return mois == 2 ? an % 4 ? 28 : 29 : 30 + (((mois * 9) / 8) & 1);
}


x86 assembly (clang, -O0):
<longueur_mois>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %eax,%eax
mov    $0x1,%ecx
cmp    -0x8(%rbp),%ecx
mov    %al,-0x9(%rbp)
jg     113b <longueur_mois+0x2b>
cmpl   $0xc,-0x8(%rbp)
setle  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x2,-0x8(%rbp)
jne    1175 <longueur_mois+0x65>
mov    -0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    $0x1d,%eax
mov    $0x1c,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x10(%rbp)
jmp    118a <longueur_mois+0x7a>
imul   $0x9,-0x8(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
and    $0x1,%eax
add    $0x1e,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<longueur_mois>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
lea    -0x1(%rbx),%eax
xor    %edi,%edi
cmp    $0xc,%eax
setb   %dil
call   1030 <assert@plt>
cmp    $0x2,%ebx
jne    113b <longueur_mois+0x2b>
xor    %eax,%eax
test   $0x3,%bpl
sete   %al
or     $0x1c,%eax
jmp    1152 <longueur_mois+0x42>
lea    (%rbx,%rbx,8),%ecx
lea    (%rbx,%rbx,8),%eax
add    $0x7,%eax
test   %ecx,%ecx
cmovns %ecx,%eax
shr    $0x3,%eax
and    $0x1,%eax
or     $0x1e,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @longueur_mois(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp sle i32 1, %5
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* %4
%9 = icmp sle i32 %8, 12
br label %10
10: ; preds = %7, %2
%11 = phi i1 [ false, %2 ], [ %9, %7 ]
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 2
br i1 %15, label %16, label %22
16: ; preds = %10
%17 = load i32, i32* %3
%18 = srem i32 %17, 4
%19 = icmp ne i32 %18, 0
%20 = zext i1 %19 to i64
%21 = select i1 %19, i32 28, i32 29
br label %28
22: ; preds = %10
%23 = load i32, i32* %4
%24 = mul nsw i32 %23, 9
%25 = sdiv i32 %24, 8
%26 = and i32 %25, 1
%27 = add nsw i32 30, %26
br label %28
28: ; preds = %22, %16
%29 = phi i32 [ %21, %16 ], [ %27, %22 ]
ret i32 %29
}

LLVM IR (-O2):
define i32 @longueur_mois(i32 %0, i32 %1) {
%3 = add i32 %1, -1
%4 = icmp ult i32 %3, 12
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = icmp eq i32 %1, 2
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = and i32 %0, 3
%10 = icmp eq i32 %9, 0
%11 = select i1 %10, i32 29, i32 28
br label %17
12: ; preds = %2
%13 = mul nsw i32 %1, 9
%14 = sdiv i32 %13, 8
%15 = and i32 %14, 1
%16 = or i32 %15, 30
br label %17
17: ; preds = %12, %8
%18 = phi i32 [ %11, %8 ], [ %16, %12 ]
ret i32 %18
}