#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 */
typedef scalar_t__ time_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ print_day(scalar_t__, int /*<<< orphan*/ *);
int /*<<< orphan*/ print_gap(int, int /*<<< orphan*/ *);
void print_weeks(int weeknum, time_t info, FILE *fp) {
  int i;
  print_gap(2, fp);
  fprintf(fp, "WEEK %02d\n=======", weeknum);
  for (i = 0; i < 7; i++) {
    print_day(info + i * 60 * 60 * 24, fp);
  }
  print_gap(1, fp);
  fprintf(fp, "WEEK %02d\n=======", weeknum + 1);
}


x86 assembly (clang, -O0):
<print_weeks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
mov    $0x2,%edi
call   1030 <print_gap@plt>
mov    -0x18(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xea1(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x7,-0x1c(%rbp)
jge    119f <print_weeks+0x6f>
mov    -0x10(%rbp),%rdi
imul   $0x3c,-0x1c(%rbp),%eax
imul   $0x3c,%eax,%eax
imul   $0x18,%eax,%eax
cltq
add    %rax,%rdi
mov    -0x18(%rbp),%rsi
call   1050 <print_day@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    116b <print_weeks+0x3b>
mov    -0x18(%rbp),%rsi
mov    $0x1,%edi
call   1030 <print_gap@plt>
mov    -0x18(%rbp),%rdi
mov    -0x4(%rbp),%edx
add    $0x1,%edx
lea    0xe42(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_weeks>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%rbp
mov    %edi,%r15d
mov    $0x2,%edi
mov    %rdx,%rsi
call   1030 <print_gap@plt>
lea    0xeac(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1040 <fprintf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1050 <print_day@plt>
lea    0x15180(%rbp),%rdi
mov    %rbx,%rsi
call   1050 <print_day@plt>
lea    0x2a300(%rbp),%rdi
mov    %rbx,%rsi
call   1050 <print_day@plt>
lea    0x3f480(%rbp),%rdi
mov    %rbx,%rsi
call   1050 <print_day@plt>
lea    0x54600(%rbp),%rdi
mov    %rbx,%rsi
call   1050 <print_day@plt>
lea    0x69780(%rbp),%rdi
mov    %rbx,%rsi
call   1050 <print_day@plt>
add    $0x7e900,%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1050 <print_day@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
call   1030 <print_gap@plt>
add    $0x1,%r15d
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fprintf@plt>

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

LLVM IR (-O2):
@.str = [18 x i8] c"WEEK %02d\0A=======\00"
define void @print_weeks(i32 %0, i64 %1, i32* %2) {
%4 = tail call i32 @print_gap(i32 2, i32* %2)
%5 = tail call i32 @fprintf(i32* %2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %0)
%6 = tail call i32 @print_day(i64 %1, i32* %2)
%7 = add nsw i64 %1, 86400
%8 = tail call i32 @print_day(i64 %7, i32* %2)
%9 = add nsw i64 %1, 172800
%10 = tail call i32 @print_day(i64 %9, i32* %2)
%11 = add nsw i64 %1, 259200
%12 = tail call i32 @print_day(i64 %11, i32* %2)
%13 = add nsw i64 %1, 345600
%14 = tail call i32 @print_day(i64 %13, i32* %2)
%15 = add nsw i64 %1, 432000
%16 = tail call i32 @print_day(i64 %15, i32* %2)
%17 = add nsw i64 %1, 518400
%18 = tail call i32 @print_day(i64 %17, i32* %2)
%19 = tail call i32 @print_gap(i32 1, i32* %2)
%20 = add nsw i32 %0, 1
%21 = tail call i32 @fprintf(i32* %2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %20)
ret void
}