#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*/ puts(char *);
int rand();
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
int main() {
  int numbers[49];
  int c, ball;
  puts("\t\t\tLOTTO PICKER\n\n");
  srand((unsigned)time(NULL));
  for (c = 0; c < 49; c++)
    numbers[c] = 0;
  puts("Press Enter to get this week's numbers:");
  getchar();
  puts("Here they come..:");
  for (c = 0; c < 6; c++) {
    do {
      ball = rand() % 49 + 1;
    } while (numbers[ball]);
    numbers[ball] = 1;
    printf("%2d ", ball);
  }
  printf("\n\nGood luck in the drawing!\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe87(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
movl   $0x0,-0xd4(%rbp)
cmpl   $0x31,-0xd4(%rbp)
jge    11cb <main+0x6b>
movslq -0xd4(%rbp),%rax
movl   $0x0,-0xd0(%rbp,%rax,4)
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    1198 <main+0x38>
lea    0xe40(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
lea    0xe55(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0xd4(%rbp)
cmpl   $0x6,-0xd4(%rbp)
jge    126d <main+0x10d>
jmp    1206 <main+0xa6>
mov    $0x0,%al
call   1080 <rand@plt>
mov    $0x31,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0xd8(%rbp)
movslq -0xd8(%rbp),%rax
cmpl   $0x0,-0xd0(%rbp,%rax,4)
jne    1206 <main+0xa6>
movslq -0xd8(%rbp),%rax
movl   $0x1,-0xd0(%rbp,%rax,4)
mov    -0xd8(%rbp),%esi
lea    0xdfa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    11f4 <main+0x94>
lea    0xddd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0xc8,%rsp
lea    0xe92(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0xb0(%rsp)
movl   $0x0,0xc0(%rsp)
lea    0xe35(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
lea    0xe4a(%rip),%rdi
call   1030 <puts@plt>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x5397829d,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
imul   $0x31,%ecx,%ecx
sub    %ecx,%eax
movslq %eax,%rsi
cmpl   $0x0,0x4(%rsp,%rsi,4)
jne    1200 <main+0xa0>
add    $0x1,%rsi
movl   $0x1,(%rsp,%rsi,4)
lea    0xe0e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x5397829d,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
imul   $0x31,%ecx,%ecx
sub    %ecx,%eax
movslq %eax,%rsi
cmpl   $0x0,0x4(%rsp,%rsi,4)
jne    1250 <main+0xf0>
add    $0x1,%rsi
movl   $0x1,(%rsp,%rsi,4)
lea    0xdbe(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x5397829d,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
imul   $0x31,%ecx,%ecx
sub    %ecx,%eax
movslq %eax,%rsi
cmpl   $0x0,0x4(%rsp,%rsi,4)
jne    12a0 <main+0x140>
add    $0x1,%rsi
movl   $0x1,(%rsp,%rsi,4)
lea    0xd6e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x5397829d,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
imul   $0x31,%ecx,%ecx
sub    %ecx,%eax
movslq %eax,%rsi
cmpl   $0x0,0x4(%rsp,%rsi,4)
jne    12f0 <main+0x190>
add    $0x1,%rsi
movl   $0x1,(%rsp,%rsi,4)
lea    0xd1e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x5397829d,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
imul   $0x31,%ecx,%ecx
sub    %ecx,%eax
movslq %eax,%rsi
cmpl   $0x0,0x4(%rsp,%rsi,4)
jne    1340 <main+0x1e0>
add    $0x1,%rsi
movl   $0x1,(%rsp,%rsi,4)
lea    0xcce(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1080 <rand@plt>
movslq %eax,%rdx
imul   $0x5397829d,%rdx,%rcx
mov    %rcx,%rsi
shr    $0x3f,%rsi
sar    $0x24,%rcx
add    %esi,%ecx
imul   $0x31,%ecx,%ecx
sub    %ecx,%edx
movslq %edx,%rdx
cmpl   $0x0,0x4(%rsp,%rdx,4)
jne    1390 <main+0x230>
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1,%esi
lea    0xc80(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc77(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0xc8,%rsp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"\09\09\09LOTTO PICKER\0A\0A\00"
@.str.1 = [40 x i8] c"Press Enter to get this week's numbers:\00"
@.str.2 = [18 x i8] c"Here they come..:\00"
@.str.3 = [5 x i8] c"%2d \00"
@.str.4 = [30 x i8] c"\0A\0AGood luck in the drawing!\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [49 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @puts(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%6 = call i64 @time(i32* null)
%7 = trunc i64 %6 to i32
%8 = call i32 @srand(i32 %7)
store i32 0, i32* %3
br label %9
9: ; preds = %16, %0
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 49
br i1 %11, label %12, label %19
12: ; preds = %9
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [49 x i32], [49 x i32]* %2, i64 0, i64 %14
store i32 0, i32* %15
br label %16
16: ; preds = %12
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %9
19: ; preds = %9
%20 = call i32 @puts(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
%21 = call i32 (...) @getchar()
%22 = call i32 @puts(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %23
23: ; preds = %43, %19
%24 = load i32, i32* %3
%25 = icmp slt i32 %24, 6
br i1 %25, label %26, label %46
26: ; preds = %23
br label %27
27: ; preds = %31, %26
%28 = call i32 (...) @rand()
%29 = srem i32 %28, 49
%30 = add nsw i32 %29, 1
store i32 %30, i32* %4
br label %31
31: ; preds = %27
%32 = load i32, i32* %4
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [49 x i32], [49 x i32]* %2, i64 0, i64 %33
%35 = load i32, i32* %34
%36 = icmp ne i32 %35, 0
br i1 %36, label %27, label %37
37: ; preds = %31
%38 = load i32, i32* %4
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [49 x i32], [49 x i32]* %2, i64 0, i64 %39
store i32 1, i32* %40
%41 = load i32, i32* %4
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %41)
br label %43
43: ; preds = %37
%44 = load i32, i32* %3
%45 = add nsw i32 %44, 1
store i32 %45, i32* %3
br label %23
46: ; preds = %23
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"\09\09\09LOTTO PICKER\0A\0A\00"
@.str.1 = [40 x i8] c"Press Enter to get this week's numbers:\00"
@.str.2 = [18 x i8] c"Here they come..:\00"
@.str.3 = [5 x i8] c"%2d \00"
@str = [29 x i8] c"\0A\0AGood luck in the drawing!\0A\00"
define i32 @main() {
%1 = alloca [49 x i32]
%2 = bitcast [49 x i32]* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = tail call i64 @time(i32* null)
%5 = trunc i64 %4 to i32
%6 = tail call i32 @srand(i32 %5)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 (...) @getchar()
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %10
10: ; preds = %0, %10
%11 = tail call i32 (...) @rand()
%12 = srem i32 %11, 49
%13 = add nsw i32 %12, 1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [49 x i32], [49 x i32]* %1, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %10
18: ; preds = %10
%19 = getelementptr inbounds [49 x i32], [49 x i32]* %1, i64 0, i64 %14
store i32 1, i32* %19
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %13)
br label %21
21: ; preds = %21, %18
%22 = tail call i32 (...) @rand()
%23 = srem i32 %22, 49
%24 = add nsw i32 %23, 1
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [49 x i32], [49 x i32]* %1, i64 0, i64 %25
%27 = load i32, i32* %26
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %21
29: ; preds = %21
%30 = getelementptr inbounds [49 x i32], [49 x i32]* %1, i64 0, i64 %25
store i32 1, i32* %30
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %24)
br label %32
32: ; preds = %32, %29
%33 = tail call i32 (...) @rand()
%34 = srem i32 %33, 49
%35 = add nsw i32 %34, 1
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [49 x i32], [49 x i32]* %1, i64 0, i64 %36
%38 = load i32, i32* %37
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %32
40: ; preds = %32
%41 = getelementptr inbounds [49 x i32], [49 x i32]* %1, i64 0, i64 %36
store i32 1, i32* %41
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %35)
br label %43
43: ; preds = %43, %40
%44 = tail call i32 (...) @rand()
%45 = srem i32 %44, 49
%46 = add nsw i32 %45, 1
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [49 x i32], [49 x i32]* %1, i64 0, i64 %47
%49 = load i32, i32* %48
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %43
51: ; preds = %43
%52 = getelementptr inbounds [49 x i32], [49 x i32]* %1, i64 0, i64 %47
store i32 1, i32* %52
%53 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %46)
br label %54
54: ; preds = %54, %51
%55 = tail call i32 (...) @rand()
%56 = srem i32 %55, 49
%57 = add nsw i32 %56, 1
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [49 x i32], [49 x i32]* %1, i64 0, i64 %58
%60 = load i32, i32* %59
%61 = icmp eq i32 %60, 0
br i1 %61, label %62, label %54
62: ; preds = %54
%63 = getelementptr inbounds [49 x i32], [49 x i32]* %1, i64 0, i64 %58
store i32 1, i32* %63
%64 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %57)
br label %65
65: ; preds = %65, %62
%66 = tail call i32 (...) @rand()
%67 = srem i32 %66, 49
%68 = add nsw i32 %67, 1
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [49 x i32], [49 x i32]* %1, i64 0, i64 %69
%71 = load i32, i32* %70
%72 = icmp eq i32 %71, 0
br i1 %72, label %73, label %65
73: ; preds = %65
%74 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %68)
%75 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
ret i32 0
}