#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*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ puts(char *);
int rand();
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
int main() {
  int x, y, z, numbers[6];
  for (x = 0; x < 6; x++)
    numbers[x] = -1;
  srand((unsigned)time(NULL));
  puts("\t\tTHE AMAZING LOTTERY\n\n");
  printf("Have you ever won at a lottery?\n");
  printf("You can try your luck now! %c\n\n", 2);
  printf("Quick, write down 6 numbers and then press \"Enter\"");
  getchar();
  for (y = 0; y < 6; y++) {
    printf("%d\n", y);
  label:
    z = rand() % 6 + 1;
    for (y = 0; y < 6; y++) {
      if (z == numbers[y])
        goto label;
      else if (numbers[y] != -1)
        continue;
      else {
        numbers[y] = z;
        break;
      }
    }
  }
  printf("\n\nToday's numbers are %c\a ", 16);
  for (x = 0; x < 6; x++)
    printf("%d, ", numbers[x]);
  printf("\n\n\nWell...\n\t..tough luck buddy..");
  printf("\n\n\n\tMaybe next time.. %c", 15);
  putchar('\n');
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x6,-0x8(%rbp)
jge    11aa <main+0x3a>
movslq -0x8(%rbp),%rax
movl   $0xffffffff,-0x30(%rbp,%rax,4)
ff
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1186 <main+0x16>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
lea    0xe3f(%rip),%rdi
call   1040 <puts@plt>
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe5e(%rip),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x6,-0xc(%rbp)
jge    129f <main+0x12f>
mov    -0xc(%rbp),%esi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1090 <rand@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x6,-0xc(%rbp)
jge    128c <main+0x11c>
mov    -0x10(%rbp),%eax
movslq -0xc(%rbp),%rcx
cmp    -0x30(%rbp,%rcx,4),%eax
jne    125a <main+0xea>
jmp    121e <main+0xae>
movslq -0xc(%rbp),%rax
cmpl   $0xffffffff,-0x30(%rbp,%rax,4)
je     126e <main+0xfe>
jmp    127e <main+0x10e>
mov    -0x10(%rbp),%ecx
movslq -0xc(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
jmp    128c <main+0x11c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    123a <main+0xca>
jmp    1291 <main+0x121>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1203 <main+0x93>
lea    0xdea(%rip),%rdi
mov    $0x10,%esi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x6,-0x8(%rbp)
jge    12e7 <main+0x177>
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    12b9 <main+0x149>
lea    0xdc2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdd5(%rip),%rdi
mov    $0xf,%esi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
pcmpeqd %xmm0,%xmm0
movdqa %xmm0,(%rsp)
movq   $0xffffffffffffffff,0x10(%rsp)
ff ff
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
lea    0xe5b(%rip),%rdi
call   1040 <puts@plt>
lea    0xf18(%rip),%rdi
call   1040 <puts@plt>
lea    0xe5b(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe68(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
mov    $0xffffffff,%ebp
xor    %esi,%esi
jmp    11fd <main+0x8d>
nopw   0x0(%rax,%rax,1)
xor    %esi,%esi
mov    %esi,%ecx
mov    %eax,(%rsp,%rcx,4)
add    $0x1,%esi
mov    (%rsp),%ebp
lea    0xe67(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%ebx
mov    0x8(%rsp),%r15d
mov    0xc(%rsp),%r12d
mov    0x10(%rsp),%r14d
mov    0x14(%rsp),%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1090 <rand@plt>
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
add    %ecx,%eax
add    $0x1,%eax
cmp    %ebp,%eax
je     1230 <main+0xc0>
cmp    $0xffffffff,%ebp
je     11f0 <main+0x80>
cmp    %ebx,%eax
je     1230 <main+0xc0>
cmp    $0xffffffff,%ebx
je     12a0 <main+0x130>
cmp    %r15d,%eax
je     1230 <main+0xc0>
cmp    $0xffffffff,%r15d
je     12aa <main+0x13a>
cmp    %r12d,%eax
je     1230 <main+0xc0>
cmp    $0xffffffff,%r12d
je     12b4 <main+0x144>
cmp    %r14d,%eax
je     1230 <main+0xc0>
cmp    $0xffffffff,%r14d
je     12be <main+0x14e>
cmp    %r13d,%eax
je     1230 <main+0xc0>
jmp    12c8 <main+0x158>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x1,%esi
jmp    11f2 <main+0x82>
mov    $0x2,%esi
jmp    11f2 <main+0x82>
mov    $0x3,%esi
jmp    11f2 <main+0x82>
mov    $0x4,%esi
jmp    11f2 <main+0x82>
cmp    $0xffffffff,%r13d
jne    12d2 <main+0x162>
mov    %eax,0x14(%rsp)
lea    0xd96(%rip),%rdi
mov    $0x10,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%esi
lea    0xd9b(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd49(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd5c(%rip),%rdi
mov    $0xf,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"\09\09THE AMAZING LOTTERY\0A\0A\00"
@.str.1 = [33 x i8] c"Have you ever won at a lottery?\0A\00"
@.str.2 = [32 x i8] c"You can try your luck now! %c\0A\0A\00"
@.str.3 = [51 x i8] c"Quick, write down 6 numbers and then press \22Enter\22\00"
@.str.4 = [4 x i8] c"%d\0A\00"
@.str.5 = [27 x i8] c"\0A\0AToday's numbers are %c\07 \00"
@.str.6 = [5 x i8] c"%d, \00"
@.str.7 = [33 x i8] c"\0A\0A\0AWell...\0A\09..tough luck buddy..\00"
@.str.8 = [25 x i8] c"\0A\0A\0A\09Maybe next time.. %c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [6 x i32]
store i32 0, i32* %1
store i32 0, i32* %2
br label %6
6: ; preds = %13, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 6
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = load i32, i32* %2
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [6 x i32], [6 x i32]* %5, i64 0, i64 %11
store i32 -1, i32* %12
br label %13
13: ; preds = %9
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
br label %6
16: ; preds = %6
%17 = call i64 @time(i32* null)
%18 = trunc i64 %17 to i32
%19 = call i32 @srand(i32 %18)
%20 = call i32 @puts(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 2)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0))
%24 = call i32 (...) @getchar()
store i32 0, i32* %3
br label %25
25: ; preds = %62, %16
%26 = load i32, i32* %3
%27 = icmp slt i32 %26, 6
br i1 %27, label %28, label %65
28: ; preds = %25
%29 = load i32, i32* %3
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %45, %28
%32 = call i32 (...) @rand()
%33 = srem i32 %32, 6
%34 = add nsw i32 %33, 1
store i32 %34, i32* %4
store i32 0, i32* %3
br label %35
35: ; preds = %58, %31
%36 = load i32, i32* %3
%37 = icmp slt i32 %36, 6
br i1 %37, label %38, label %61
38: ; preds = %35
%39 = load i32, i32* %4
%40 = load i32, i32* %3
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [6 x i32], [6 x i32]* %5, i64 0, i64 %41
%43 = load i32, i32* %42
%44 = icmp eq i32 %39, %43
br i1 %44, label %45, label %46
45: ; preds = %38
br label %31
46: ; preds = %38
%47 = load i32, i32* %3
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [6 x i32], [6 x i32]* %5, i64 0, i64 %48
%50 = load i32, i32* %49
%51 = icmp ne i32 %50, -1
br i1 %51, label %52, label %53
52: ; preds = %46
br label %58
53: ; preds = %46
%54 = load i32, i32* %4
%55 = load i32, i32* %3
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [6 x i32], [6 x i32]* %5, i64 0, i64 %56
store i32 %54, i32* %57
br label %61
58: ; preds = %52
%59 = load i32, i32* %3
%60 = add nsw i32 %59, 1
store i32 %60, i32* %3
br label %35
61: ; preds = %53, %35
br label %62
62: ; preds = %61
%63 = load i32, i32* %3
%64 = add nsw i32 %63, 1
store i32 %64, i32* %3
br label %25
65: ; preds = %25
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i32 16)
store i32 0, i32* %2
br label %67
67: ; preds = %76, %65
%68 = load i32, i32* %2
%69 = icmp slt i32 %68, 6
br i1 %69, label %70, label %79
70: ; preds = %67
%71 = load i32, i32* %2
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [6 x i32], [6 x i32]* %5, i64 0, i64 %72
%74 = load i32, i32* %73
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %74)
br label %76
76: ; preds = %70
%77 = load i32, i32* %2
%78 = add nsw i32 %77, 1
store i32 %78, i32* %2
br label %67
79: ; preds = %67
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0))
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i32 15)
%82 = call i32 @putchar(i8 signext 10)
%83 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"\09\09THE AMAZING LOTTERY\0A\0A\00"
@.str.2 = [32 x i8] c"You can try your luck now! %c\0A\0A\00"
@.str.3 = [51 x i8] c"Quick, write down 6 numbers and then press \22Enter\22\00"
@.str.4 = [4 x i8] c"%d\0A\00"
@.str.5 = [27 x i8] c"\0A\0AToday's numbers are %c\07 \00"
@.str.6 = [5 x i8] c"%d, \00"
@.str.7 = [33 x i8] c"\0A\0A\0AWell...\0A\09..tough luck buddy..\00"
@.str.8 = [25 x i8] c"\0A\0A\0A\09Maybe next time.. %c\00"
@str = [32 x i8] c"Have you ever won at a lottery?\00"
define i32 @main() {
%1 = alloca [6 x i32]
%2 = bitcast [6 x i32]* %1 to i8*
%3 = tail call i64 @time(i32* null)
%4 = trunc i64 %3 to i32
%5 = tail call i32 @srand(i32 %4)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 2)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0))
%10 = tail call i32 (...) @getchar()
%11 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 5
%12 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%13 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 1
%14 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 2
%15 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 3
%16 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 4
br label %17
17: ; preds = %56, %0
%18 = phi i32 [ -1, %0 ], [ %61, %56 ]
%19 = phi i32 [ 0, %0 ], [ %60, %56 ]
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %19)
%21 = icmp eq i32 %18, -1
%22 = load i32, i32* %13
%23 = icmp eq i32 %22, -1
%24 = load i32, i32* %14
%25 = icmp eq i32 %24, -1
%26 = load i32, i32* %15
%27 = icmp eq i32 %26, -1
%28 = load i32, i32* %16
%29 = icmp eq i32 %28, -1
%30 = load i32, i32* %11
br label %31
31: ; preds = %51, %17
%32 = tail call i32 (...) @rand()
%33 = srem i32 %32, 6
%34 = add nsw i32 %33, 1
%35 = icmp eq i32 %34, %18
br i1 %35, label %51, label %36
36: ; preds = %31
br i1 %21, label %56, label %37
37: ; preds = %36
%38 = icmp eq i32 %34, %22
br i1 %38, label %51, label %39
39: ; preds = %37
br i1 %23, label %56, label %40
40: ; preds = %39
%41 = icmp eq i32 %34, %24
br i1 %41, label %51, label %42
42: ; preds = %40
br i1 %25, label %56, label %43
43: ; preds = %42
%44 = icmp eq i32 %34, %26
br i1 %44, label %51, label %45
45: ; preds = %43
br i1 %27, label %56, label %46
46: ; preds = %45
%47 = icmp eq i32 %34, %28
br i1 %47, label %51, label %48
48: ; preds = %46
br i1 %29, label %56, label %49
49: ; preds = %48
%50 = icmp eq i32 %34, %30
br i1 %50, label %51, label %52
51: ; preds = %49, %46, %43, %40, %37, %31
br label %31
52: ; preds = %49
%53 = icmp eq i32 %30, -1
br i1 %53, label %54, label %62
54: ; preds = %52
%55 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 5
store i32 %34, i32* %55
br label %62
56: ; preds = %48, %45, %42, %39, %36
%57 = phi i32 [ 0, %36 ], [ 1, %39 ], [ 2, %42 ], [ 3, %45 ], [ 4, %48 ]
%58 = zext i32 %57 to i64
%59 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 %58
store i32 %34, i32* %59
%60 = add nuw nsw i32 %57, 1
%61 = load i32, i32* %12
br label %17
62: ; preds = %52, %54
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i32 16)
%64 = load i32, i32* %12
%65 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %64)
%66 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 1
%67 = load i32, i32* %66
%68 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %67)
%69 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 2
%70 = load i32, i32* %69
%71 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %70)
%72 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 3
%73 = load i32, i32* %72
%74 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %73)
%75 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 4
%76 = load i32, i32* %75
%77 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %76)
%78 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 5
%79 = load i32, i32* %78
%80 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %79)
%81 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0))
%82 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i32 15)
%83 = tail call i32 @putchar(i8 signext 10)
%84 = tail call i32 (...) @getchar()
ret i32 0
}