#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*/ time_t;
struct tm {
  int tm_min;
  int tm_hour;
};

/* Variables and functions */
int is_last_sunday_april(struct tm *);
int is_last_sunday_october(struct tm *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  time_t currentTime;
  time(&currentTime);
  struct tm *timeinfo = localtime(&currentTime);
  int lastOct = is_last_sunday_october(timeinfo),
      lastApr = is_last_sunday_april(timeinfo);
  char zero = (timeinfo->tm_min < 10) ? '0' : 0;
  switch (lastOct) {
  case 0:
    printf("Cette nuit, on change d'heure ! À 3h, il sera 2h !\n\n");
    break;
  case 1:
    printf("Cette nuit, on a changé d'heure !\nReculez vos horloges d'une "
           "heure, il est %dh%c%d !\n\n",
           timeinfo->tm_hour, zero, timeinfo->tm_min);
    break;
  }
  switch (lastApr) {
  case 0:
    printf("Cette nuit, on change d'heure ! À 2h, il sera 3h !\n\n");
    break;
  case 1:
    printf("Cette nuit, on a changé d'heure !\nAvancez vos horloges d'une "
           "heure, il est %dh%c%d !\n\n",
           timeinfo->tm_hour, zero, timeinfo->tm_min);
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
mov    %rdi,-0x28(%rbp)
call   1060 <time@plt>
mov    -0x28(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <is_last_sunday_october@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <is_last_sunday_april@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
xor    %eax,%eax
sub    $0xa,%ecx
mov    $0x30,%ecx
cmovl  %ecx,%eax
mov    %al,-0x19(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
test   %eax,%eax
je     11cb <main+0x7b>
jmp    11ba <main+0x6a>
mov    -0x20(%rbp),%eax
sub    $0x1,%eax
je     11de <main+0x8e>
jmp    11fd <main+0xad>
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11fd <main+0xad>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%esi
movsbl -0x19(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x2c(%rbp)
test   %eax,%eax
je     1221 <main+0xd1>
jmp    1210 <main+0xc0>
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
je     1234 <main+0xe4>
jmp    1253 <main+0x103>
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1253 <main+0x103>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%esi
movsbl -0x19(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0x4(%rsp),%rbx
mov    %rbx,%rdi
call   1070 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1080 <is_last_sunday_october@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <is_last_sunday_april@plt>
mov    %eax,%r14d
mov    (%rbx),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    $0x30,%r15d
cmovge %eax,%r15d
cmp    $0x1,%ebp
je     11d3 <main+0x73>
test   %ebp,%ebp
jne    11ba <main+0x5a>
lea    0xf30(%rip),%rdi
call   1040 <puts@plt>
cmp    $0x1,%r14d
je     11ee <main+0x8e>
test   %r14d,%r14d
jne    1205 <main+0xa5>
lea    0xee4(%rip),%rdi
call   1040 <puts@plt>
jmp    1205 <main+0xa5>
mov    0x4(%rbx),%esi
movzbl %r15b,%edx
lea    0xe1f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x1,%r14d
jne    11c0 <main+0x60>
mov    (%rbx),%ecx
mov    0x4(%rbx),%esi
movzbl %r15b,%edx
lea    0xe5a(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32 }
@.str = [54 x i8] c"Cette nuit, on change d'heure ! \C3\80 3h, il sera 2h !\0A\0A\00"
@.str.1 = [88 x i8] c"Cette nuit, on a chang\C3\A9 d'heure !\0AReculez vos horloges d'une heure, il est %dh%c%d !\0A\0A\00"
@.str.2 = [54 x i8] c"Cette nuit, on change d'heure ! \C3\80 2h, il sera 3h !\0A\0A\00"
@.str.3 = [88 x i8] c"Cette nuit, on a chang\C3\A9 d'heure !\0AAvancez vos horloges d'une heure, il est %dh%c%d !\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.tm*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
store i32 0, i32* %1
%7 = call i32 @time(i32* %2)
%8 = call %struct.tm* @localtime(i32* %2)
store %struct.tm* %8, %struct.tm** %3
%9 = load %struct.tm*, %struct.tm** %3
%10 = call i32 @is_last_sunday_october(%struct.tm* %9)
store i32 %10, i32* %4
%11 = load %struct.tm*, %struct.tm** %3
%12 = call i32 @is_last_sunday_april(%struct.tm* %11)
store i32 %12, i32* %5
%13 = load %struct.tm*, %struct.tm** %3
%14 = getelementptr inbounds %struct.tm, %struct.tm* %13, i32 0, i32 0
%15 = load i32, i32* %14
%16 = icmp slt i32 %15, 10
%17 = zext i1 %16 to i64
%18 = select i1 %16, i32 48, i32 0
%19 = trunc i32 %18 to i8
store i8 %19, i8* %6
%20 = load i32, i32* %4
switch i32 %20, label %33 [
i32 0, label %21
i32 1, label %23
]
21: ; preds = %0
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
br label %33
23: ; preds = %0
%24 = load %struct.tm*, %struct.tm** %3
%25 = getelementptr inbounds %struct.tm, %struct.tm* %24, i32 0, i32 1
%26 = load i32, i32* %25
%27 = load i8, i8* %6
%28 = sext i8 %27 to i32
%29 = load %struct.tm*, %struct.tm** %3
%30 = getelementptr inbounds %struct.tm, %struct.tm* %29, i32 0, i32 0
%31 = load i32, i32* %30
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str.1, i64 0, i64 0), i32 %26, i32 %28, i32 %31)
br label %33
33: ; preds = %0, %23, %21
%34 = load i32, i32* %5
switch i32 %34, label %47 [
i32 0, label %35
i32 1, label %37
]
35: ; preds = %33
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0))
br label %47
37: ; preds = %33
%38 = load %struct.tm*, %struct.tm** %3
%39 = getelementptr inbounds %struct.tm, %struct.tm* %38, i32 0, i32 1
%40 = load i32, i32* %39
%41 = load i8, i8* %6
%42 = sext i8 %41 to i32
%43 = load %struct.tm*, %struct.tm** %3
%44 = getelementptr inbounds %struct.tm, %struct.tm* %43, i32 0, i32 0
%45 = load i32, i32* %44
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str.3, i64 0, i64 0), i32 %40, i32 %42, i32 %45)
br label %47
47: ; preds = %33, %37, %35
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32, i32 }
@.str.1 = [88 x i8] c"Cette nuit, on a chang\C3\A9 d'heure !\0AReculez vos horloges d'une heure, il est %dh%c%d !\0A\0A\00"
@.str.3 = [88 x i8] c"Cette nuit, on a chang\C3\A9 d'heure !\0AAvancez vos horloges d'une heure, il est %dh%c%d !\0A\0A\00"
@str = [53 x i8] c"Cette nuit, on change d'heure ! \C3\80 2h, il sera 3h !\0A\00"
@str.4 = [53 x i8] c"Cette nuit, on change d'heure ! \C3\80 3h, il sera 2h !\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @time(i32* %1)
%4 = call %struct.tm* @localtime(i32* %1)
%5 = call i32 @is_last_sunday_october(%struct.tm* %4)
%6 = call i32 @is_last_sunday_april(%struct.tm* %4)
%7 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%8 = load i32, i32* %7
%9 = icmp slt i32 %8, 10
%10 = select i1 %9, i8 48, i8 0
switch i32 %5, label %18 [
i32 0, label %11
i32 1, label %13
]
11: ; preds = %0
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.4, i64 0, i64 0))
br label %18
13: ; preds = %0
%14 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 1
%15 = load i32, i32* %14
%16 = zext i8 %10 to i32
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([88 x i8], [88 x i8]* @.str.1, i64 0, i64 0), i32 %15, i32 %16, i32 %8)
br label %18
18: ; preds = %0, %13, %11
switch i32 %6, label %27 [
i32 0, label %19
i32 1, label %21
]
19: ; preds = %18
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str, i64 0, i64 0))
br label %27
21: ; preds = %18
%22 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 1
%23 = load i32, i32* %22
%24 = zext i8 %10 to i32
%25 = load i32, i32* %7
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([88 x i8], [88 x i8]* @.str.3, i64 0, i64 0), i32 %23, i32 %24, i32 %25)
br label %27
27: ; preds = %18, %21, %19
ret i32 0
}