#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 *, ...);
void printMonth(int iStDay, int iNoDays) {
  int i;
  printf("\nSun\tMon\tTue\tWed\tThu\tFri\tSat\n");
  for (i = 0; i < iStDay; i++)
    printf("\t");
  i = 1;
  while (i <= iNoDays) {
    printf("%3d\t", i);
    if (0 == (i + iStDay) % 7)
      printf("\n");
    i++;
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<printMonth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    115b <printMonth+0x4b>
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <printMonth+0x23>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11b3 <printMonth+0xa3>
mov    -0xc(%rbp),%esi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    -0x4(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
xor    %eax,%eax
cmp    %edx,%eax
jne    11a5 <printMonth+0x95>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1162 <printMonth+0x52>
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printMonth>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %esi,%r12d
mov    %edi,%r14d
lea    0xec0(%rip),%rdi
call   1040 <puts@plt>
test   %r14d,%r14d
jle    116f <printMonth+0x3f>
mov    %r14d,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x9,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1160 <printMonth+0x30>
test   %r12d,%r12d
jle    11d1 <printMonth+0xa1>
neg    %r12d
mov    $0x1,%ebx
lea    0xe7d(%rip),%r15
jmp    11a3 <printMonth+0x73>
cs nopw 0x0(%rax,%rax,1)
nop
lea    (%r12,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
je     11d1 <printMonth+0xa1>
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    (%r14,%rbx,1),%eax
imul   $0xb6db6db7,%eax,%eax
add    $0x12492492,%eax
cmp    $0x24924924,%eax
ja     1190 <printMonth+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1190 <printMonth+0x60>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"\0ASun\09Mon\09Tue\09Wed\09Thu\09Fri\09Sat\0A\00"
@.str.1 = [2 x i8] c"\09\00"
@.str.2 = [5 x i8] c"%3d\09\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @printMonth(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %7
7: ; preds = %13, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %3
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %11
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 1
store i32 %15, i32* %5
br label %7
16: ; preds = %7
store i32 1, i32* %5
br label %17
17: ; preds = %31, %16
%18 = load i32, i32* %5
%19 = load i32, i32* %4
%20 = icmp sle i32 %18, %19
br i1 %20, label %21, label %34
21: ; preds = %17
%22 = load i32, i32* %5
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %22)
%24 = load i32, i32* %5
%25 = load i32, i32* %3
%26 = add nsw i32 %24, %25
%27 = srem i32 %26, 7
%28 = icmp eq i32 0, %27
br i1 %28, label %29, label %31
29: ; preds = %21
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %31
31: ; preds = %29, %21
%32 = load i32, i32* %5
%33 = add nsw i32 %32, 1
store i32 %33, i32* %5
br label %17
34: ; preds = %17
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.2 = [5 x i8] c"%3d\09\00"
@str = [29 x i8] c"\0ASun\09Mon\09Tue\09Wed\09Thu\09Fri\09Sat\00"
define void @printMonth(i32 %0, i32 %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%4 = icmp sgt i32 %0, 0
br i1 %4, label %7, label %5
5: ; preds = %7, %2
%6 = icmp slt i32 %1, 1
br i1 %6, label %23, label %12
7: ; preds = %2, %7
%8 = phi i32 [ %10, %7 ], [ 0, %2 ]
%9 = tail call i32 @putchar(i32 9)
%10 = add nuw nsw i32 %8, 1
%11 = icmp eq i32 %10, %0
br i1 %11, label %5, label %7
12: ; preds = %5, %20
%13 = phi i32 [ %21, %20 ], [ 1, %5 ]
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%15 = add nsw i32 %13, %0
%16 = srem i32 %15, 7
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = tail call i32 @putchar(i32 10)
br label %20
20: ; preds = %18, %12
%21 = add nuw i32 %13, 1
%22 = icmp eq i32 %13, %1
br i1 %22, label %23, label %12
23: ; preds = %20, %5
%24 = tail call i32 @putchar(i32 10)
ret void
}