#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stdin;
int main() {
  int day, weeks, days;
  scanf("%d", &day);
  while (day > 0) {
    weeks = day / 7;
    days = day % 7;
    printf("%d days are %d weeks, %d days\n", day, weeks, days);
    fflush(stdin);
    scanf("%d", &day);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jle    11ad <main+0x7d>
mov    -0x8(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
lea    0xe61(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
jmp    114f <main+0x1f>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xec1(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
jle    11b9 <main+0x89>
lea    0xeab(%rip),%r14
mov    0x2e89(%rip),%r12
lea    0xe9a(%rip),%r15
lea    0x4(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    %esi,%eax
imul   $0x24924925,%rax,%rax
shr    $0x20,%rax
mov    %esi,%edx
sub    %eax,%edx
shr    %edx
add    %eax,%edx
shr    $0x2,%edx
lea    0x0(,%rdx,8),%eax
mov    %edx,%ecx
sub    %eax,%ecx
add    %esi,%ecx
mov    %r14,%rdi
call   1030 <printf@plt>
mov    (%r12),%edi
call   1040 <fflush@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
jg     1170 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [31 x i8] c"%d days are %d weeks, %d days\0A\00"
@stdin = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %6
6: ; preds = %9, %0
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %21
9: ; preds = %6
%10 = load i32, i32* %2
%11 = sdiv i32 %10, 7
store i32 %11, i32* %3
%12 = load i32, i32* %2
%13 = srem i32 %12, 7
store i32 %13, i32* %4
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %14, i32 %15, i32 %16)
%18 = load i32, i32* @stdin
%19 = call i32 @fflush(i32 %18)
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %6
21: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [31 x i8] c"%d days are %d weeks, %d days\0A\00"
@stdin = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %16
6: ; preds = %0, %6
%7 = phi i32 [ %14, %6 ], [ %4, %0 ]
%8 = udiv i32 %7, 7
%9 = urem i32 %7, 7
%10 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %7, i32 %8, i32 %9)
%11 = load i32, i32* @stdin
%12 = call i32 @fflush(i32 %11)
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%14 = load i32, i32* %1
%15 = icmp sgt i32 %14, 0
br i1 %15, label %6, label %16
16: ; preds = %6, %0
ret i32 0
}