#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*/ printf(char *, int);
int main() {
  int temperature_readings[30][24];
  int averageMonth, averageDay;
  for (int i = 0; i < 30; i++) {
    for (int j = 0; j < 24; j++) {
      averageDay += temperature_readings[i][j];
    }
    averageMonth += (averageDay / 24);
    averageDay = 0;
  }
  printf("average temperature:%d", averageMonth / 30);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xb5c(%rbp)
cmpl   $0x1e,-0xb5c(%rbp)
jge    11c7 <main+0xb7>
movl   $0x0,-0xb60(%rbp)
cmpl   $0x18,-0xb60(%rbp)
jge    118f <main+0x7f>
movslq -0xb5c(%rbp),%rcx
lea    -0xb50(%rbp),%rax
imul   $0x60,%rcx,%rcx
add    %rcx,%rax
movslq -0xb60(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
add    -0xb58(%rbp),%eax
mov    %eax,-0xb58(%rbp)
mov    -0xb60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb60(%rbp)
jmp    1143 <main+0x33>
mov    -0xb58(%rbp),%eax
mov    $0x18,%ecx
cltd
idiv   %ecx
add    -0xb54(%rbp),%eax
mov    %eax,-0xb54(%rbp)
movl   $0x0,-0xb58(%rbp)
mov    -0xb5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb5c(%rbp)
jmp    112c <main+0x1c>
mov    -0xb54(%rbp),%eax
mov    $0x1e,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xe22(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xb60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0xb48,%rsp
mov    $0x20,%eax
nopl   0x0(%rax)
movdqa -0x20(%rsp,%rax,1),%xmm0
movdqa (%rsp,%rax,1),%xmm1
movdqa 0x10(%rsp,%rax,1),%xmm2
paddd  0x30(%rsp,%rax,1),%xmm2
paddd  0x20(%rsp,%rax,1),%xmm1
paddd  %xmm2,%xmm1
pshufd $0xee,%xmm1,%xmm2
paddd  %xmm1,%xmm2
pshufd $0x55,%xmm2,%xmm1
paddd  %xmm2,%xmm1
movd   %xmm1,%edx
paddd  -0x10(%rsp,%rax,1),%xmm0
pshufd $0xee,%xmm0,%xmm1
paddd  %xmm0,%xmm1
pshufd $0x55,%xmm1,%xmm0
paddd  %xmm1,%xmm0
movd   %xmm0,%esi
add    %edx,%esi
movslq %esi,%rdx
imul   $0x2aaaaaab,%rdx,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rdx
add    %esi,%edx
add    %edx,%ecx
add    $0x60,%rax
cmp    $0xb60,%rax
jne    1120 <main+0x10>
movslq %ecx,%rsi
imul   $0xffffffff88888889,%rsi,%rax
shr    $0x20,%rax
add    %eax,%esi
mov    %esi,%eax
shr    $0x1f,%eax
sar    $0x4,%esi
add    %eax,%esi
lea    0xe45(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xb48,%rsp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"average temperature:%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [30 x [24 x i32]]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
br label %7
7: ; preds = %32, %0
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 30
br i1 %9, label %10, label %35
10: ; preds = %7
store i32 0, i32* %6
br label %11
11: ; preds = %24, %10
%12 = load i32, i32* %6
%13 = icmp slt i32 %12, 24
br i1 %13, label %14, label %27
14: ; preds = %11
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [30 x [24 x i32]], [30 x [24 x i32]]* %2, i64 0, i64 %16
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [24 x i32], [24 x i32]* %17, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = load i32, i32* %4
%23 = add nsw i32 %22, %21
store i32 %23, i32* %4
br label %24
24: ; preds = %14
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %11
27: ; preds = %11
%28 = load i32, i32* %4
%29 = sdiv i32 %28, 24
%30 = load i32, i32* %3
%31 = add nsw i32 %30, %29
store i32 %31, i32* %3
store i32 0, i32* %4
br label %32
32: ; preds = %27
%33 = load i32, i32* %5
%34 = add nsw i32 %33, 1
store i32 %34, i32* %5
br label %7
35: ; preds = %7
%36 = load i32, i32* %3
%37 = sdiv i32 %36, 30
%38 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %37)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"average temperature:%d\00"
define i32 @main() {
%1 = alloca [30 x [24 x i32]]
%2 = bitcast [30 x [24 x i32]]* %1 to i8*
br label %3
3: ; preds = %0, %3
%4 = phi i64 [ 0, %0 ], [ %17, %3 ]
%5 = phi i32 [ undef, %0 ], [ %16, %3 ]
%6 = getelementptr inbounds [30 x [24 x i32]], [30 x [24 x i32]]* %1, i64 0, i64 %4, i64 0
%7 = bitcast i32* %6 to <8 x i32>*
%8 = load <8 x i32>, <8 x i32>* %7
%9 = getelementptr inbounds [30 x [24 x i32]], [30 x [24 x i32]]* %1, i64 0, i64 %4, i64 8
%10 = bitcast i32* %9 to <16 x i32>*
%11 = load <16 x i32>, <16 x i32>* %10
%12 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> %11)
%13 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %8)
%14 = add nsw i32 %12, %13
%15 = sdiv i32 %14, 24
%16 = add nsw i32 %15, %5
%17 = add nuw nsw i64 %4, 1
%18 = icmp eq i64 %17, 30
br i1 %18, label %19, label %3
19: ; preds = %3
%20 = sdiv i32 %16, 30
%21 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %20)
ret i32 0
}