#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 const);
int main(void) {
  const int days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31};
  int index;
  for (index = 0; index < sizeof days / sizeof days[0]; index++)
    printf("Month %2d has %d days.\n", index + 1, days[index]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xec6(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x34(%rbp)
movslq -0x34(%rbp),%rax
cmp    $0xa,%rax
jae    1181 <main+0x61>
mov    -0x34(%rbp),%esi
add    $0x1,%esi
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    114b <main+0x2b>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1f,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x1c,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x1f,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x1e,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x1f,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    $0x1e,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    $0x1f,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
mov    $0x1f,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
mov    $0x1e,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0x1f,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.days = [10 x i32] [i32 31, i32 28, i32 31, i32 30, i32 31, i32 30, i32 31, i32 31, i32 30, i32 31]
@.str = [24 x i8] c"Month %2d has %d days.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [10 x i32]* %2 to i8*
store i32 0, i32* %3
br label %5
5: ; preds = %17, %0
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = icmp ult i64 %7, 10
br i1 %8, label %9, label %20
9: ; preds = %5
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %15)
br label %17
17: ; preds = %9
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %5
20: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"Month %2d has %d days.\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 1, i32 31)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 2, i32 28)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 3, i32 31)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 4, i32 30)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 5, i32 31)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 6, i32 30)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 7, i32 31)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 8, i32 31)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 9, i32 30)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 10, i32 31)
ret i32 0
}