#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, int);
int /*<<< orphan*/ putchar(int);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  FILE *f = fopen("lastSong.txt", "w");
  if (f == NULL)
    return 0;
  int num = 6;
  srand(time(NULL));
  int a[num];
  int i;
  for (i = 0; i < num; i++) {
    a[i] = rand() % 50 + 1;
    fprintf(f, "a[%d]: %d\n", i, a[i]);
  }
  fclose(f);
  for (i = 0;; i++) {
    putchar(((i * (i >> a[0] | i >> a[1]) & a[2] & i >> a[3])) ^
            (i & i >> a[4] | i >> a[5]));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe7a(%rip),%rdi
lea    0xe80(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11a8 <main+0x38>
xor    %eax,%eax
mov    %rbp,%rsp
pop    %rbp
ret
movl   $0x6,-0x14(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    -0x14(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    123e <main+0xce>
mov    $0x0,%al
call   1090 <rand@plt>
mov    $0x32,%ecx
cltd
idiv   %ecx
mov    -0x38(%rbp),%rax
add    $0x1,%edx
movslq -0x2c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%rdi
mov    -0x2c(%rbp),%edx
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
lea    0xde4(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11ed <main+0x7d>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x38(%rbp),%rcx
mov    -0x2c(%rbp),%edi
mov    -0x2c(%rbp),%eax
mov    (%rcx),%ecx
sar    %cl,%eax
mov    -0x38(%rbp),%rcx
mov    -0x2c(%rbp),%edx
mov    0x4(%rcx),%ecx
sar    %cl,%edx
mov    -0x38(%rbp),%rcx
or     %edx,%eax
imul   %eax,%edi
and    0x8(%rcx),%edi
mov    -0x2c(%rbp),%eax
mov    0xc(%rcx),%ecx
sar    %cl,%eax
mov    -0x38(%rbp),%rcx
and    %eax,%edi
mov    -0x2c(%rbp),%eax
mov    -0x2c(%rbp),%edx
mov    0x10(%rcx),%ecx
sar    %cl,%edx
mov    -0x38(%rbp),%rcx
and    %edx,%eax
mov    -0x2c(%rbp),%edx
mov    0x14(%rcx),%ecx
sar    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
xor    %eax,%edi
call   1030 <putchar@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    124e <main+0xde>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe7b(%rip),%rdi
lea    0xe81(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     1384 <main+0x214>
mov    %rax,%r14
xor    %r12d,%r12d
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
xor    %eax,%eax
call   1090 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
imul   $0x32,%ecx,%ecx
neg    %ecx
add    %eax,%ecx
add    $0x1,%ecx
lea    0xe33(%rip),%rbp
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %edx,%edx
mov    %ecx,0xc(%rsp)
call   1060 <fprintf@plt>
xor    %eax,%eax
call   1090 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
imul   $0x32,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%r13d
add    $0x1,%r13d
mov    %r14,%rdi
mov    %rbp,%rsi
mov    $0x1,%edx
mov    %r13d,%ecx
call   1060 <fprintf@plt>
xor    %eax,%eax
call   1090 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
imul   $0x32,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebx
add    $0x1,%ebx
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %rbp,%r15
mov    $0x2,%edx
mov    %ebx,%ecx
call   1060 <fprintf@plt>
xor    %eax,%eax
call   1090 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
imul   $0x32,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebp
add    $0x1,%ebp
mov    %r14,%rdi
mov    %r14,0x10(%rsp)
mov    %r15,%rsi
mov    $0x3,%edx
mov    %ebp,%ecx
call   1060 <fprintf@plt>
xor    %eax,%eax
call   1090 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
imul   $0x32,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%r15d
add    $0x1,%r15d
mov    %r14,%rdi
lea    0xd35(%rip),%rsi
mov    $0x4,%edx
mov    %r15d,%ecx
call   1060 <fprintf@plt>
xor    %eax,%eax
call   1090 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
imul   $0x32,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%r14d
add    $0x1,%r14d
mov    0x10(%rsp),%rdi
lea    0xcf2(%rip),%rsi
mov    $0x5,%edx
mov    %r14d,%ecx
call   1060 <fprintf@plt>
mov    0x10(%rsp),%rdi
call   1040 <fclose@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r12d,%eax
mov    0xc(%rsp),%ecx
shr    %cl,%eax
mov    %r12d,%edx
mov    %r13d,%ecx
shr    %cl,%edx
or     %eax,%edx
mov    %r12d,%eax
mov    %ebp,%ecx
shr    %cl,%eax
imul   %r12d,%edx
mov    %r12d,%esi
mov    %r15d,%ecx
shr    %cl,%esi
and    %ebx,%edx
mov    %r12d,%edi
mov    %r14d,%ecx
shr    %cl,%edi
and    %edx,%eax
and    %r12d,%esi
or     %esi,%edi
xor    %eax,%edi
call   1030 <putchar@plt>
add    $0x1,%r12d
jmp    1340 <main+0x1d0>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"lastSong.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [11 x i8] c"a[%d]: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %2
%8 = load i32*, i32** %2
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %11
10: ; preds = %0
ret i32 0
11: ; preds = %0
store i32 6, i32* %3
%12 = call i32 @time(i32* null)
%13 = call i32 @srand(i32 %12)
%14 = load i32, i32* %3
%15 = zext i32 %14 to i64
%16 = call i8* @llvm.stacksave()
store i8* %16, i8** %4
%17 = alloca i32, i64 %15
store i64 %15, i64* %5
store i32 0, i32* %6
br label %18
18: ; preds = %36, %11
%19 = load i32, i32* %6
%20 = load i32, i32* %3
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %39
22: ; preds = %18
%23 = call i32 (...) @rand()
%24 = srem i32 %23, 50
%25 = add nsw i32 %24, 1
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %17, i64 %27
store i32 %25, i32* %28
%29 = load i32*, i32** %2
%30 = load i32, i32* %6
%31 = load i32, i32* %6
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %17, i64 %32
%34 = load i32, i32* %33
%35 = call i32 @fprintf(i32* %29, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %30, i32 %34)
br label %36
36: ; preds = %22
%37 = load i32, i32* %6
%38 = add nsw i32 %37, 1
store i32 %38, i32* %6
br label %18
39: ; preds = %18
%40 = load i32*, i32** %2
%41 = call i32 @fclose(i32* %40)
store i32 0, i32* %6
br label %42
42: ; preds = %75, %39
%43 = load i32, i32* %6
%44 = load i32, i32* %6
%45 = getelementptr inbounds i32, i32* %17, i64 0
%46 = load i32, i32* %45
%47 = ashr i32 %44, %46
%48 = load i32, i32* %6
%49 = getelementptr inbounds i32, i32* %17, i64 1
%50 = load i32, i32* %49
%51 = ashr i32 %48, %50
%52 = or i32 %47, %51
%53 = mul nsw i32 %43, %52
%54 = getelementptr inbounds i32, i32* %17, i64 2
%55 = load i32, i32* %54
%56 = and i32 %53, %55
%57 = load i32, i32* %6
%58 = getelementptr inbounds i32, i32* %17, i64 3
%59 = load i32, i32* %58
%60 = ashr i32 %57, %59
%61 = and i32 %56, %60
%62 = load i32, i32* %6
%63 = load i32, i32* %6
%64 = getelementptr inbounds i32, i32* %17, i64 4
%65 = load i32, i32* %64
%66 = ashr i32 %63, %65
%67 = and i32 %62, %66
%68 = load i32, i32* %6
%69 = getelementptr inbounds i32, i32* %17, i64 5
%70 = load i32, i32* %69
%71 = ashr i32 %68, %70
%72 = or i32 %67, %71
%73 = xor i32 %61, %72
%74 = call i32 @putchar(i32 %73)
br label %75
75: ; preds = %42
%76 = load i32, i32* %6
%77 = add nsw i32 %76, 1
store i32 %77, i32* %6
br label %42
}

LLVM IR (-O2):
@.str = [13 x i8] c"lastSong.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [11 x i8] c"a[%d]: %d\0A\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32* %1, null
br i1 %2, label %3, label %4
3: ; preds = %0
ret i32 0
4: ; preds = %0
%5 = tail call i32 @time(i32* null)
%6 = tail call i32 @srand(i32 %5)
%7 = tail call i32 (...) @rand()
%8 = srem i32 %7, 50
%9 = add nsw i32 %8, 1
%10 = tail call i32 @fprintf(i32* %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 %9)
%11 = tail call i32 (...) @rand()
%12 = srem i32 %11, 50
%13 = add nsw i32 %12, 1
%14 = tail call i32 @fprintf(i32* %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 %13)
%15 = tail call i32 (...) @rand()
%16 = srem i32 %15, 50
%17 = add nsw i32 %16, 1
%18 = tail call i32 @fprintf(i32* %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 2, i32 %17)
%19 = tail call i32 (...) @rand()
%20 = srem i32 %19, 50
%21 = add nsw i32 %20, 1
%22 = tail call i32 @fprintf(i32* %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 3, i32 %21)
%23 = tail call i32 (...) @rand()
%24 = srem i32 %23, 50
%25 = add nsw i32 %24, 1
%26 = tail call i32 @fprintf(i32* %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 4, i32 %25)
%27 = tail call i32 (...) @rand()
%28 = srem i32 %27, 50
%29 = add nsw i32 %28, 1
%30 = tail call i32 @fprintf(i32* %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 5, i32 %29)
%31 = tail call i32 @fclose(i32* %1)
br label %32
32: ; preds = %32, %4
%33 = phi i32 [ 0, %4 ], [ %47, %32 ]
%34 = lshr i32 %33, %9
%35 = lshr i32 %33, %13
%36 = or i32 %35, %34
%37 = mul nsw i32 %36, %33
%38 = and i32 %37, %17
%39 = lshr i32 %33, %21
%40 = and i32 %38, %39
%41 = lshr i32 %33, %25
%42 = and i32 %41, %33
%43 = lshr i32 %33, %29
%44 = or i32 %42, %43
%45 = xor i32 %44, %40
%46 = tail call i32 @putchar(i32 %45)
%47 = add nuw nsw i32 %33, 1
br label %32
}