#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*/ alarm(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void gst(int sig) {
  static int cpt = 1;
  switch (cpt) {
  case 1:
    printf("Veuillez repondre plus vite !\n");
    cpt++;
    alarm(3);
    return;
    break;
  case 2:
    printf("Veuillez repondre encore plus vite !\n");
    cpt++;
    alarm(3);
    return;
    break;
  case 3:
    printf("Trop tard\n");
    exit(1);
    break;
  }
}


x86 assembly (clang, -O0):
<gst>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ef7(%rip),%eax
mov    %eax,-0x8(%rbp)
sub    $0x1,%eax
je     1174 <gst+0x44>
jmp    1152 <gst+0x22>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
je     119e <gst+0x6e>
jmp    1163 <gst+0x33>
mov    -0x8(%rbp),%eax
sub    $0x3,%eax
je     11c8 <gst+0x98>
jmp    11de <gst+0xae>
lea    0xe85(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eb2(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2ea9(%rip)
mov    $0x3,%edi
call   1040 <alarm@plt>
jmp    11de <gst+0xae>
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e88(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2e7f(%rip)
mov    $0x3,%edi
call   1040 <alarm@plt>
jmp    11de <gst+0xae>
lea    0xe76(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gst>:
push   %rax
mov    0x2f01(%rip),%eax
cmp    $0x1,%eax
je     1148 <gst+0x18>
cmp    $0x2,%eax
je     1151 <gst+0x21>
cmp    $0x3,%eax
je     116f <gst+0x3f>
pop    %rax
ret
lea    0xee0(%rip),%rdi
jmp    1158 <gst+0x28>
lea    0xeb2(%rip),%rdi
call   1030 <puts@plt>
addl   $0x1,0x2ed4(%rip)
mov    $0x3,%edi
pop    %rax
jmp    1040 <alarm@plt>
lea    0xe8a(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@gst.cpt = internal global i32 1
@.str = [31 x i8] c"Veuillez repondre plus vite !\0A\00"
@.str.1 = [38 x i8] c"Veuillez repondre encore plus vite !\0A\00"
@.str.2 = [11 x i8] c"Trop tard\0A\00"
define void @gst(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @gst.cpt
switch i32 %3, label %17 [
i32 1, label %4
i32 2, label %9
i32 3, label %14
]
4: ; preds = %1
%5 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @gst.cpt
%7 = add nsw i32 %6, 1
store i32 %7, i32* @gst.cpt
%8 = call i32 @alarm(i32 3)
br label %17
9: ; preds = %1
%10 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32, i32* @gst.cpt
%12 = add nsw i32 %11, 1
store i32 %12, i32* @gst.cpt
%13 = call i32 @alarm(i32 3)
br label %17
14: ; preds = %1
%15 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %4, %9, %1
ret void
}

LLVM IR (-O2):
@gst.cpt = internal unnamed_addr global i32 1
@str = [10 x i8] c"Trop tard\00"
@str.3 = [37 x i8] c"Veuillez repondre encore plus vite !\00"
@str.4 = [30 x i8] c"Veuillez repondre plus vite !\00"
define void @gst(i32 %0) {
%2 = load i32, i32* @gst.cpt
switch i32 %2, label %13 [
i32 1, label %7
i32 2, label %3
i32 3, label %4
]
3: ; preds = %1
br label %7
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %1, %3
%8 = phi i8* [ getelementptr inbounds ([37 x i8], [37 x i8]* @str.3, i64 0, i64 0), %3 ], [ getelementptr inbounds ([30 x i8], [30 x i8]* @str.4, i64 0, i64 0), %1 ]
%9 = tail call i32 @puts(i8* dereferenceable(1) %8)
%10 = load i32, i32* @gst.cpt
%11 = add nsw i32 %10, 1
store i32 %11, i32* @gst.cpt
%12 = tail call i32 @alarm(i32 3)
br label %13
13: ; preds = %7, %1
ret void
}