#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*/ pause();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ system(char *);
void prob1(void) {
  system("clear");
  int dayloop;
  int weekloop;
  int mean[7] = {0, 0, 0, 0, 0, 0, 0};
  int hits[5][7] = {367, 654, 545, 556, 565, 526, 437, 389, 689, 554, 526, 625,
                    537, 468, 429, 644, 586, 626, 652, 546, 493, 449, 689, 597,
                    679, 696, 568, 522, 489, 729, 627, 729, 737, 598, 552};
  for (weekloop = 0; weekloop < 5; weekloop++) {
    for (dayloop = 0; dayloop < 7; dayloop++) {
      mean[dayloop] += hits[weekloop][dayloop];
    }
  }
  for (dayloop = 0; dayloop < 7; dayloop++) {
    mean[dayloop] /= 5;
  }
  printf("The mean number of hits for Mondays of this month was    %d\n",
         mean[0]);
  printf("The mean number of hits for Tuesdays of this month was   %d\n",
         mean[1]);
  printf("The mean number of hits for Wednesdays of this month was %d\n",
         mean[2]);
  printf("The mean number of hits for Thursdays of this month was  %d\n",
         mean[3]);
  printf("The mean number of hits for Fridays of this month was    %d\n",
         mean[4]);
  printf("The mean number of hits for Saturdays of this month was  %d\n",
         mean[5]);
  printf("The mean number of hits for Sundays of this month was    %d\n",
         mean[6]);
  pause();
}


x86 assembly (clang, -O0):
<prob1>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
lea    0xe9e(%rip),%rdi
call   1030 <system@plt>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x1c,%edx
call   1050 <memset@plt>
lea    -0xc0(%rbp),%rdi
lea    0x103b(%rip),%rsi
mov    $0x8c,%edx
call   1060 <memcpy@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    11f7 <prob1+0xa7>
movl   $0x0,-0x4(%rbp)
cmpl   $0x7,-0x4(%rbp)
jge    11e4 <prob1+0x94>
movslq -0x8(%rbp),%rcx
lea    -0xc0(%rbp),%rax
imul   $0x1c,%rcx,%rcx
add    %rcx,%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
movslq -0x4(%rbp),%rax
add    -0x30(%rbp,%rax,4),%ecx
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11a7 <prob1+0x57>
jmp    11e9 <prob1+0x99>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1196 <prob1+0x46>
movl   $0x0,-0x4(%rbp)
cmpl   $0x7,-0x4(%rbp)
jge    123a <prob1+0xea>
movslq -0x4(%rbp),%rax
mov    %rax,-0xc8(%rbp)
mov    -0x30(%rbp,%rax,4),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc8(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11fe <prob1+0xae>
mov    -0x30(%rbp),%esi
lea    0xdc2(%rip),%rdi
call   1040 <printf@plt>
mov    -0x2c(%rbp),%esi
lea    0xdf0(%rip),%rdi
call   1040 <printf@plt>
mov    -0x28(%rbp),%esi
lea    0xe1e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xe4c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xe7a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xea8(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xed6(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1070 <pause@plt>
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prob1>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <system@plt>
lea    0xec2(%rip),%rdi
mov    $0x1a8,%esi
call   1040 <printf@plt>
lea    0xeee(%rip),%rdi
mov    $0x2a9,%esi
call   1040 <printf@plt>
lea    0xf1a(%rip),%rdi
mov    $0x245,%esi
call   1040 <printf@plt>
lea    0xf46(%rip),%rdi
mov    $0x26f,%esi
call   1040 <printf@plt>
lea    0xf72(%rip),%rdi
mov    $0x28f,%esi
call   1040 <printf@plt>
lea    0xf9e(%rip),%rdi
mov    $0x22b,%esi
call   1040 <printf@plt>
lea    0xfca(%rip),%rdi
mov    $0x1ee,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <pause@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@__const.prob1.hits = [5 x [7 x i32]] [[7 x i32] [i32 367, i32 654, i32 545, i32 556, i32 565, i32 526, i32 437], [7 x i32] [i32 389, i32 689, i32 554, i32 526, i32 625, i32 537, i32 468], [7 x i32] [i32 429, i32 644, i32 586, i32 626, i32 652, i32 546, i32 493], [7 x i32] [i32 449, i32 689, i32 597, i32 679, i32 696, i32 568, i32 522], [7 x i32] [i32 489, i32 729, i32 627, i32 729, i32 737, i32 598, i32 552]]
@.str.1 = [61 x i8] c"The mean number of hits for Mondays of this month was %d\0A\00"
@.str.2 = [61 x i8] c"The mean number of hits for Tuesdays of this month was %d\0A\00"
@.str.3 = [61 x i8] c"The mean number of hits for Wednesdays of this month was %d\0A\00"
@.str.4 = [61 x i8] c"The mean number of hits for Thursdays of this month was %d\0A\00"
@.str.5 = [61 x i8] c"The mean number of hits for Fridays of this month was %d\0A\00"
@.str.6 = [61 x i8] c"The mean number of hits for Saturdays of this month was %d\0A\00"
@.str.7 = [61 x i8] c"The mean number of hits for Sundays of this month was %d\0A\00"
define void @prob1() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [7 x i32]
%4 = alloca [5 x [7 x i32]]
%5 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = bitcast [7 x i32]* %3 to i8*
%7 = bitcast [5 x [7 x i32]]* %4 to i8*
store i32 0, i32* %2
br label %8
8: ; preds = %32, %0
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 5
br i1 %10, label %11, label %35
11: ; preds = %8
store i32 0, i32* %1
br label %12
12: ; preds = %28, %11
%13 = load i32, i32* %1
%14 = icmp slt i32 %13, 7
br i1 %14, label %15, label %31
15: ; preds = %12
%16 = load i32, i32* %2
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [5 x [7 x i32]], [5 x [7 x i32]]* %4, i64 0, i64 %17
%19 = load i32, i32* %1
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [7 x i32], [7 x i32]* %18, i64 0, i64 %20
%22 = load i32, i32* %21
%23 = load i32, i32* %1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = add nsw i32 %26, %22
store i32 %27, i32* %25
br label %28
28: ; preds = %15
%29 = load i32, i32* %1
%30 = add nsw i32 %29, 1
store i32 %30, i32* %1
br label %12
31: ; preds = %12
br label %32
32: ; preds = %31
%33 = load i32, i32* %2
%34 = add nsw i32 %33, 1
store i32 %34, i32* %2
br label %8
35: ; preds = %8
store i32 0, i32* %1
br label %36
36: ; preds = %45, %35
%37 = load i32, i32* %1
%38 = icmp slt i32 %37, 7
br i1 %38, label %39, label %48
39: ; preds = %36
%40 = load i32, i32* %1
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 %41
%43 = load i32, i32* %42
%44 = sdiv i32 %43, 5
store i32 %44, i32* %42
br label %45
45: ; preds = %39
%46 = load i32, i32* %1
%47 = add nsw i32 %46, 1
store i32 %47, i32* %1
br label %36
48: ; preds = %36
%49 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 0
%50 = load i32, i32* %49
%51 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0), i32 %50)
%52 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 1
%53 = load i32, i32* %52
%54 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.2, i64 0, i64 0), i32 %53)
%55 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 2
%56 = load i32, i32* %55
%57 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.3, i64 0, i64 0), i32 %56)
%58 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 3
%59 = load i32, i32* %58
%60 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.4, i64 0, i64 0), i32 %59)
%61 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 4
%62 = load i32, i32* %61
%63 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0), i32 %62)
%64 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 5
%65 = load i32, i32* %64
%66 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.6, i64 0, i64 0), i32 %65)
%67 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 6
%68 = load i32, i32* %67
%69 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.7, i64 0, i64 0), i32 %68)
%70 = call i32 (...) @pause()
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.1 = [61 x i8] c"The mean number of hits for Mondays of this month was %d\0A\00"
@.str.2 = [61 x i8] c"The mean number of hits for Tuesdays of this month was %d\0A\00"
@.str.3 = [61 x i8] c"The mean number of hits for Wednesdays of this month was %d\0A\00"
@.str.4 = [61 x i8] c"The mean number of hits for Thursdays of this month was %d\0A\00"
@.str.5 = [61 x i8] c"The mean number of hits for Fridays of this month was %d\0A\00"
@.str.6 = [61 x i8] c"The mean number of hits for Saturdays of this month was %d\0A\00"
@.str.7 = [61 x i8] c"The mean number of hits for Sundays of this month was %d\0A\00"
define void @prob1() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0), i32 424)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.2, i64 0, i64 0), i32 681)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.3, i64 0, i64 0), i32 581)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.4, i64 0, i64 0), i32 623)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0), i32 655)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.6, i64 0, i64 0), i32 555)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.7, i64 0, i64 0), i32 494)
%9 = tail call i32 (...) @pause()
ret void
}