#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ ecrire_jour(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int longueur_mois(int, int);
void ecrire_mois(FILE *fichier, int an, int mois) {
  int jour;
  fprintf(fichier, "\t%d :\n", mois);
  for (jour = 1; jour <= longueur_mois(an, mois); ++jour)
    ecrire_jour(fichier, jour, mois);
}


x86 assembly (clang, -O0):
<ecrire_mois>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%edx
lea    0xeb0(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1050 <longueur_mois@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jg     1197 <ecrire_mois+0x67>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <ecrire_jour@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115c <ecrire_mois+0x2c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ecrire_mois>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,%r14d
mov    %rdi,%r15
lea    0xeba(%rip),%rsi
call   1040 <fprintf@plt>
mov    %r14d,%edi
mov    %ebx,%esi
call   1050 <longueur_mois@plt>
test   %eax,%eax
jle    117d <ecrire_mois+0x4d>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <ecrire_jour@plt>
mov    %r14d,%edi
mov    %ebx,%esi
call   1050 <longueur_mois@plt>
cmp    %eax,%ebp
jl     1160 <ecrire_mois+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"\09%d :\0A\00"
define void @ecrire_mois(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32*, i32** %4
%9 = load i32, i32* %6
%10 = call i32 @fprintf(i32* %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %9)
store i32 1, i32* %7
br label %11
11: ; preds = %22, %3
%12 = load i32, i32* %7
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = call i32 @longueur_mois(i32 %13, i32 %14)
%16 = icmp sle i32 %12, %15
br i1 %16, label %17, label %25
17: ; preds = %11
%18 = load i32*, i32** %4
%19 = load i32, i32* %7
%20 = load i32, i32* %6
%21 = call i32 @ecrire_jour(i32* %18, i32 %19, i32 %20)
br label %22
22: ; preds = %17
%23 = load i32, i32* %7
%24 = add nsw i32 %23, 1
store i32 %24, i32* %7
br label %11
25: ; preds = %11
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"\09%d :\0A\00"
define void @ecrire_mois(i32* %0, i32 %1, i32 %2) {
%4 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %2)
%5 = tail call i32 @longueur_mois(i32 %1, i32 %2)
%6 = icmp slt i32 %5, 1
br i1 %6, label %13, label %7
7: ; preds = %3, %7
%8 = phi i32 [ %10, %7 ], [ 1, %3 ]
%9 = tail call i32 @ecrire_jour(i32* %0, i32 %8, i32 %2)
%10 = add nuw nsw i32 %8, 1
%11 = tail call i32 @longueur_mois(i32 %1, i32 %2)
%12 = icmp slt i32 %8, %11
br i1 %12, label %7, label %13
13: ; preds = %7, %3
ret void
}