#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, ...);
int /*<<< orphan*/ puts(char *);
int rand();
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
int main() {
  int c, nr;
  int numere[49];
  puts("\t\t\tLoteria fantastica\n\n");
  puts("\t\tExtragere direct in direct\n\n");
  printf("Apasa balamuc pentru a incepe %c %c", 1, 10);
  getchar();
  srand((unsigned)time(NULL));
  for (c = 0; c < 49; c++)
    numere[c] = 0;
  for (c = 0; c < 6; c++) {
    do {
      nr = rand() % 49 + 1;
    } while (numere[nr]);
    numere[nr] = 1;
    printf("%2d ", nr);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe87(%rip),%rdi
call   1030 <puts@plt>
lea    0xe93(%rip),%rdi
call   1030 <puts@plt>
lea    0xea6(%rip),%rdi
mov    $0x1,%esi
mov    $0xa,%edx
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x31,-0x8(%rbp)
jge    11e7 <main+0x87>
movslq -0x8(%rbp),%rax
movl   $0x0,-0xd0(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11c0 <main+0x60>
movl   $0x0,-0x8(%rbp)
cmpl   $0x6,-0x8(%rbp)
jge    1252 <main+0xf2>
jmp    11fd <main+0x9d>
mov    $0x0,%al
call   1080 <rand@plt>
mov    $0x31,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq -0xc(%rbp),%rax
cmpl   $0x0,-0xd0(%rbp,%rax,4)
jne    11fd <main+0x9d>
movslq -0xc(%rbp),%rax
movl   $0x1,-0xd0(%rbp,%rax,4)
mov    -0xc(%rbp),%esi
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11ee <main+0x8e>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0xc8,%rsp
lea    0xe92(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9e(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb1(%rip),%rdi
mov    $0x1,%esi
mov    $0xa,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <getchar@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)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
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    1210 <main+0xb0>
add    $0x1,%rsi
movl   $0x1,(%rsp,%rsi,4)
lea    0xe0d(%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    1260 <main+0x100>
add    $0x1,%rsi
movl   $0x1,(%rsp,%rsi,4)
lea    0xdbd(%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    12b0 <main+0x150>
add    $0x1,%rsi
movl   $0x1,(%rsp,%rsi,4)
lea    0xd6d(%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    1300 <main+0x1a0>
add    $0x1,%rsi
movl   $0x1,(%rsp,%rsi,4)
lea    0xd1d(%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    1350 <main+0x1f0>
add    $0x1,%rsi
movl   $0x1,(%rsp,%rsi,4)
lea    0xccd(%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    13a0 <main+0x240>
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1,%esi
lea    0xc7f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xc8,%rsp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"\09\09\09Loteria fantastica\0A\0A\00"
@.str.1 = [31 x i8] c"\09\09Extragere direct in direct\0A\0A\00"
@.str.2 = [36 x i8] c"Apasa balamuc pentru a incepe %c %c\00"
@.str.3 = [5 x i8] c"%2d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [49 x i32]
store i32 0, i32* %1
%5 = call i32 @puts(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @puts(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 10)
%8 = call i32 (...) @getchar()
%9 = call i64 @time(i32* null)
%10 = trunc i64 %9 to i32
%11 = call i32 @srand(i32 %10)
store i32 0, i32* %2
br label %12
12: ; preds = %19, %0
%13 = load i32, i32* %2
%14 = icmp slt i32 %13, 49
br i1 %14, label %15, label %22
15: ; preds = %12
%16 = load i32, i32* %2
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [49 x i32], [49 x i32]* %4, i64 0, i64 %17
store i32 0, i32* %18
br label %19
19: ; preds = %15
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %12
22: ; preds = %12
store i32 0, i32* %2
br label %23
23: ; preds = %43, %22
%24 = load i32, i32* %2
%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* %3
br label %31
31: ; preds = %27
%32 = load i32, i32* %3
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [49 x i32], [49 x i32]* %4, 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* %3
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [49 x i32], [49 x i32]* %4, i64 0, i64 %39
store i32 1, i32* %40
%41 = load i32, i32* %3
%42 = call i32 (i8*, i32, ...) @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* %2
%45 = add nsw i32 %44, 1
store i32 %45, i32* %2
br label %23
46: ; preds = %23
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"\09\09\09Loteria fantastica\0A\0A\00"
@.str.1 = [31 x i8] c"\09\09Extragere direct in direct\0A\0A\00"
@.str.2 = [36 x i8] c"Apasa balamuc pentru a incepe %c %c\00"
@.str.3 = [5 x i8] c"%2d \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 ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 10)
%6 = tail call i32 (...) @getchar()
%7 = tail call i64 @time(i32* null)
%8 = trunc i64 %7 to i32
%9 = tail call i32 @srand(i32 %8)
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*, i32, ...) @printf(i8* 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*, i32, ...) @printf(i8* 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*, i32, ...) @printf(i8* 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*, i32, ...) @printf(i8* 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*, i32, ...) @printf(i8* 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*, i32, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %68)
ret i32 0
}