#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 month_to_i(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  char *months[] = {"JAN", "FEB", "MAR", "APR", "MAY", "JUN",
                    "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"};
  int counter = 0;
  for (int i = 0; i < 1200000000; ++i) {
    ++counter;
    if (month_to_i(months[i % 12]) != (1 + i % 12)) {
      printf("%s - %d Failed.\n", months[i % 12], i);
    }
  }
  printf("%d\n", counter);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x70(%rbp),%rdi
lea    0x2c6c(%rip),%rsi
mov    $0x60,%edx
call   1050 <memcpy@plt>
movl   $0x0,-0x74(%rbp)
movl   $0x0,-0x78(%rbp)
cmpl   $0x47868c00,-0x78(%rbp)
jge    11ed <main+0xbd>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
mov    -0x78(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
movslq %edx,%rax
mov    -0x70(%rbp,%rax,8),%rdi
call   1040 <month_to_i@plt>
mov    %eax,-0x7c(%rbp)
mov    -0x78(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
mov    -0x7c(%rbp),%eax
add    $0x1,%edx
cmp    %edx,%eax
je     11da <main+0xaa>
mov    -0x78(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
movslq %edx,%rax
mov    -0x70(%rbp,%rax,8),%rsi
mov    -0x78(%rbp),%edx
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11df <main+0xaf>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    116c <main+0x3c>
mov    -0x74(%rbp),%esi
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0x2c8e(%rip),%r12
mov    $0xaaaaaaab,%ebp
xor    %r14d,%r14d
jmp    114d <main+0x2d>
nopl   0x0(%rax)
add    $0x8,%r12
cmp    $0x47868c00,%r14d
je     11b5 <main+0x95>
mov    %r14,%rbx
add    $0x1,%r14
mov    %rbx,%rax
movabs $0xaaaaaaaaaaaaaaab,%rcx
aa aa aa
mul    %rcx
shl    $0x2,%rdx
and    $0xffffffffffffffe0,%rdx
lea    (%rdx,%rdx,2),%rax
mov    %r12,%rcx
sub    %rax,%rcx
mov    %ebx,%eax
imul   %rbp,%rax
shr    $0x23,%rax
shl    $0x2,%eax
lea    (%rax,%rax,2),%r13d
mov    (%rcx),%r15
mov    %r15,%rdi
call   1040 <month_to_i@plt>
neg    %r13d
lea    (%rbx,%r13,1),%ecx
add    $0x1,%ecx
cmp    %eax,%ecx
je     1140 <main+0x20>
lea    0xe89(%rip),%rdi
mov    %r15,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1140 <main+0x20>
lea    0xe85(%rip),%rdi
mov    $0x47868c00,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"JAN\00"
@.str.1 = [4 x i8] c"FEB\00"
@.str.2 = [4 x i8] c"MAR\00"
@.str.3 = [4 x i8] c"APR\00"
@.str.4 = [4 x i8] c"MAY\00"
@.str.5 = [4 x i8] c"JUN\00"
@.str.6 = [4 x i8] c"JUL\00"
@.str.7 = [4 x i8] c"AUG\00"
@.str.8 = [4 x i8] c"SEP\00"
@.str.9 = [4 x i8] c"OCT\00"
@.str.10 = [4 x i8] c"NOV\00"
@.str.11 = [4 x i8] c"DEC\00"
@__const.main.months = [12 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i32 0, i32 0)]
@.str.12 = [17 x i8] c"%s - %d Failed.\0A\00"
@.str.13 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [12 x i8*]
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = bitcast [12 x i8*]* %6 to i8*
store i32 0, i32* %7
store i32 0, i32* %8
br label %10
10: ; preds = %35, %2
%11 = load i32, i32* %8
%12 = icmp slt i32 %11, 1200000000
br i1 %12, label %13, label %38
13: ; preds = %10
%14 = load i32, i32* %7
%15 = add nsw i32 %14, 1
store i32 %15, i32* %7
%16 = load i32, i32* %8
%17 = srem i32 %16, 12
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [12 x i8*], [12 x i8*]* %6, i64 0, i64 %18
%20 = load i8*, i8** %19
%21 = call i32 @month_to_i(i8* %20)
%22 = load i32, i32* %8
%23 = srem i32 %22, 12
%24 = add nsw i32 1, %23
%25 = icmp ne i32 %21, %24
br i1 %25, label %26, label %34
26: ; preds = %13
%27 = load i32, i32* %8
%28 = srem i32 %27, 12
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [12 x i8*], [12 x i8*]* %6, i64 0, i64 %29
%31 = load i8*, i8** %30
%32 = load i32, i32* %8
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0), i8* %31, i32 %32)
br label %34
34: ; preds = %26, %13
br label %35
35: ; preds = %34
%36 = load i32, i32* %8
%37 = add nsw i32 %36, 1
store i32 %37, i32* %8
br label %10
38: ; preds = %10
%39 = load i32, i32* %7
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), i32 %39)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"JAN\00"
@.str.1 = [4 x i8] c"FEB\00"
@.str.2 = [4 x i8] c"MAR\00"
@.str.3 = [4 x i8] c"APR\00"
@.str.4 = [4 x i8] c"MAY\00"
@.str.5 = [4 x i8] c"JUN\00"
@.str.6 = [4 x i8] c"JUL\00"
@.str.7 = [4 x i8] c"AUG\00"
@.str.8 = [4 x i8] c"SEP\00"
@.str.9 = [4 x i8] c"OCT\00"
@.str.10 = [4 x i8] c"NOV\00"
@.str.11 = [4 x i8] c"DEC\00"
@__const.main.months = [12 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i32 0, i32 0)]
@.str.12 = [17 x i8] c"%s - %d Failed.\0A\00"
@.str.13 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %5
3: ; preds = %17
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), i32 1200000000)
ret i32 0
5: ; preds = %2, %17
%6 = phi i32 [ 0, %2 ], [ %7, %17 ]
%7 = add nuw nsw i32 %6, 1
%8 = urem i32 %6, 12
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds [12 x i8*], [12 x i8*]* @__const.main.months, i64 0, i64 %9
%11 = load i8*, i8** %10
%12 = tail call i32 @month_to_i(i8* %11)
%13 = add nuw nsw i32 %8, 1
%14 = icmp eq i32 %12, %13
br i1 %14, label %17, label %15
15: ; preds = %5
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0), i8* %11, i32 %6)
br label %17
17: ; preds = %5, %15
%18 = icmp eq i32 %7, 1200000000
br i1 %18, label %3, label %5
}