#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 */
scalar_t__ leap(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *, int *);
int sum_day(int, int);
int main() {
  int year, month, day, days;
  printf("输入年，月，日（格式：年，月，日）\n");
  scanf("%d,%d,%d", &year, &month, &day);
  days = sum_day(month, day);
  if (leap(year) && month >= 3)
    days += 1;
  printf("是该年的第%d天", days);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xed1(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1060 <scanf@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <sum_day@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <leap@plt>
cmp    $0x0,%rax
je     11a8 <main+0x68>
cmpl   $0x3,-0xc(%rbp)
jl     11a8 <main+0x68>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec2(%rip),%rdi
call   1040 <puts@plt>
lea    0xe98(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x4(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1070 <scanf@plt>
mov    0x4(%rsp),%edi
mov    0x8(%rsp),%esi
call   1050 <sum_day@plt>
mov    %eax,%ebx
mov    0xc(%rsp),%edi
call   1030 <leap@plt>
test   %rax,%rax
setne  %al
cmpl   $0x3,0x4(%rsp)
setge  %cl
and    %al,%cl
movzbl %cl,%esi
add    %ebx,%esi
lea    0xe59(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [53 x i8] c"\E8\BE\93\E5\85\A5\E5\B9\B4\EF\BC\8C\E6\9C\88\EF\BC\8C\E6\97\A5\EF\BC\88\E6\A0\BC\E5\BC\8F\EF\BC\9A\E5\B9\B4\EF\BC\8C\E6\9C\88\EF\BC\8C\E6\97\A5\EF\BC\89\0A\00"
@.str.1 = [9 x i8] c"%d,%d,%d\00"
@.str.2 = [21 x i8] c"\E6\98\AF\E8\AF\A5\E5\B9\B4\E7\9A\84\E7\AC\AC%d\E5\A4\A9\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = call i32 @sum_day(i32 %8, i32 %9)
store i32 %10, i32* %5
%11 = load i32, i32* %2
%12 = call i64 @leap(i32 %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %20
14: ; preds = %0
%15 = load i32, i32* %3
%16 = icmp sge i32 %15, 3
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %20
20: ; preds = %17, %14, %0
%21 = load i32, i32* %5
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"%d,%d,%d\00"
@.str.2 = [21 x i8] c"\E6\98\AF\E8\AF\A5\E5\B9\B4\E7\9A\84\E7\AC\AC%d\E5\A4\A9\00"
@str = [52 x i8] c"\E8\BE\93\E5\85\A5\E5\B9\B4\EF\BC\8C\E6\9C\88\EF\BC\8C\E6\97\A5\EF\BC\88\E6\A0\BC\E5\BC\8F\EF\BC\9A\E5\B9\B4\EF\BC\8C\E6\9C\88\EF\BC\8C\E6\97\A5\EF\BC\89\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = call i32 @sum_day(i32 %9, i32 %10)
%12 = load i32, i32* %1
%13 = call i64 @leap(i32 %12)
%14 = icmp ne i64 %13, 0
%15 = load i32, i32* %2
%16 = icmp sgt i32 %15, 2
%17 = select i1 %14, i1 %16, i1 false
%18 = zext i1 %17 to i32
%19 = add nsw i32 %11, %18
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %19)
ret i32 0
}