#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*/ printf(char *, int, ...);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int n, i;
  srand(time(NULL));
  for (i = 1; i <= 200; i++) {
    n = rand() % 6 + 1;
    i % 5 == 0 ? printf("Risultato lancio %d: 6\n", i)
               : printf("Risultato lancio %d: %d\n", i, n);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x1,-0xc(%rbp)
cmpl   $0xc8,-0xc(%rbp)
jg     11d4 <main+0x94>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x8(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11b2 <main+0x72>
mov    -0xc(%rbp),%esi
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c6 <main+0x86>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1166 <main+0x26>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x1,%r12d
lea    0xe9d(%rip),%r14
lea    0xeae(%rip),%r15
jmp    11ad <main+0x6d>
nopl   0x0(%rax)
cltq
imul   $0x2aaaaaab,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,2),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%edx
add    $0x1,%edx
mov    %r15,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%r12d
cmp    $0xc9,%r12d
je     11da <main+0x9a>
movzbl %r12b,%ebp
imul   $0xcd,%ebp,%eax
shr    $0xa,%eax
lea    (%rax,%rax,4),%ebx
neg    %ebx
xor    %eax,%eax
call   1060 <rand@plt>
add    %bl,%bpl
jne    1170 <main+0x30>
mov    %r14,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11a0 <main+0x60>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Risultato lancio %d: 6\0A\00"
@.str.1 = [25 x i8] c"Risultato lancio %d: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @time(i32* null)
%5 = call i32 @srand(i32 %4)
store i32 1, i32* %3
br label %6
6: ; preds = %25, %0
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 200
br i1 %8, label %9, label %28
9: ; preds = %6
%10 = call i32 (...) @rand()
%11 = srem i32 %10, 6
%12 = add nsw i32 %11, 1
store i32 %12, i32* %2
%13 = load i32, i32* %3
%14 = srem i32 %13, 5
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %9
%17 = load i32, i32* %3
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %23
19: ; preds = %9
%20 = load i32, i32* %3
%21 = load i32, i32* %2
%22 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %20, i32 %21)
br label %23
23: ; preds = %19, %16
%24 = phi i32 [ %18, %16 ], [ %22, %19 ]
br label %25
25: ; preds = %23
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %6
28: ; preds = %6
%29 = load i32, i32* %1
ret i32 %29
}

LLVM IR (-O2):
@.str = [24 x i8] c"Risultato lancio %d: 6\0A\00"
@.str.1 = [25 x i8] c"Risultato lancio %d: %d\0A\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
br label %3
3: ; preds = %0, %15
%4 = phi i32 [ 1, %0 ], [ %16, %15 ]
%5 = tail call i32 (...) @rand()
%6 = trunc i32 %4 to i8
%7 = urem i8 %6, 5
%8 = icmp eq i8 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %4)
br label %15
11: ; preds = %3
%12 = srem i32 %5, 6
%13 = add nsw i32 %12, 1
%14 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 %13)
br label %15
15: ; preds = %9, %11
%16 = add nuw nsw i32 %4, 1
%17 = icmp eq i32 %16, 201
br i1 %17, label %18, label %3
18: ; preds = %15
ret i32 0
}