#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*/ fprintf(int /*<<< orphan*/ *, char *, int, int, int);
int rand();
void ecrire_jour(FILE *fichier, int jour, int mois) {
  const int temp[] = {5, 7, 10, 11, 15, 17, 24, 22, 16, 15, 10, 7};
  int min = rand() % 10 + temp[mois - 1] - 12;
  int max = rand() % -10 + temp[mois - 1] + 2;
  fprintf(fichier, "\t\t%d : %d,%d\n", jour, min, max);
}


x86 assembly (clang, -O0):
<ecrire_jour>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xeb3(%rip),%rsi
mov    $0x30,%edx
call   1040 <memcpy@plt>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
add    -0x40(%rbp,%rcx,4),%eax
sub    $0xc,%eax
mov    %eax,-0x44(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0xfffffff6,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
add    -0x40(%rbp,%rcx,4),%eax
add    $0x2,%eax
mov    %eax,-0x48(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x44(%rbp),%ecx
mov    -0x48(%rbp),%r8d
lea    0xe7c(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ecrire_jour>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %esi,%r14d
mov    %rdi,%r15
xor    %eax,%eax
call   1040 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
movslq %ebp,%rcx
lea    0xea3(%rip),%rdx
mov    -0x4(%rdx,%rcx,4),%ebx
lea    (%rbx,%rax,1),%ebp
add    $0xfffffff4,%ebp
xor    %eax,%eax
call   1040 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
lea    (%rbx,%rax,1),%r8d
add    $0x2,%r8d
lea    0xe96(%rip),%rsi
mov    %r15,%rdi
mov    %r14d,%edx
mov    %ebp,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@__const.ecrire_jour.temp = [12 x i32] [i32 5, i32 7, i32 10, i32 11, i32 15, i32 17, i32 24, i32 22, i32 16, i32 15, i32 10, i32 7]
@.str = [14 x i8] c"\09\09%d : %d,%d\0A\00"
define void @ecrire_jour(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [12 x i32]
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%10 = bitcast [12 x i32]* %7 to i8*
%11 = call i32 (...) @rand()
%12 = srem i32 %11, 10
%13 = load i32, i32* %6
%14 = sub nsw i32 %13, 1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [12 x i32], [12 x i32]* %7, i64 0, i64 %15
%17 = load i32, i32* %16
%18 = add nsw i32 %12, %17
%19 = sub nsw i32 %18, 12
store i32 %19, i32* %8
%20 = call i32 (...) @rand()
%21 = srem i32 %20, -10
%22 = load i32, i32* %6
%23 = sub nsw i32 %22, 1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [12 x i32], [12 x i32]* %7, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = add nsw i32 %21, %26
%28 = add nsw i32 %27, 2
store i32 %28, i32* %9
%29 = load i32*, i32** %4
%30 = load i32, i32* %5
%31 = load i32, i32* %8
%32 = load i32, i32* %9
%33 = call i32 @fprintf(i32* %29, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %30, i32 %31, i32 %32)
ret void
}

LLVM IR (-O2):
@__const.ecrire_jour.temp = [12 x i32] [i32 5, i32 7, i32 10, i32 11, i32 15, i32 17, i32 24, i32 22, i32 16, i32 15, i32 10, i32 7]
@.str = [14 x i8] c"\09\09%d : %d,%d\0A\00"
define void @ecrire_jour(i32* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i32 (...) @rand()
%5 = srem i32 %4, 10
%6 = add nsw i32 %2, -1
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [12 x i32], [12 x i32]* @__const.ecrire_jour.temp, i64 0, i64 %7
%9 = load i32, i32* %8
%10 = add i32 %9, -12
%11 = add i32 %10, %5
%12 = tail call i32 (...) @rand()
%13 = srem i32 %12, 10
%14 = add i32 %9, 2
%15 = add i32 %14, %13
%16 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %11, i32 %15)
ret void
}