#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 *, ...);
int /*<<< orphan*/ scanf(char *, float *);
double sin(float);
main() {
  float a, b, c;
  double d, e, f;
  printf("请输入正整数。\n");
  scanf("%f", &a);
  b = 0;
  c = 0;
  f = 0;
  while (b <= a) {
    e = sin(b);
    printf("sin(%f)=%f\n", b, e);
    {
      if (e >= f) {
        f = e;
        c = b;
      } else
        ;
    }
    b++;
  }
  printf("%f的正弦最大，\n最大值为%f", c, f);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef4(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movss  -0xc(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jb     11f8 <main+0xc8>
movss  -0xc(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x20(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xe6f(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jb     11dc <main+0xac>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    11e1 <main+0xb1>
jmp    11e1 <main+0xb1>
movss  0xe17(%rip),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1175 <main+0x45>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  -0x28(%rbp),%xmm1
lea    0xe1a(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xed9(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
movss  0xc(%rsp),%xmm1
xorps  %xmm0,%xmm0
xorps  %xmm2,%xmm2
ucomiss %xmm2,%xmm1
xorps  %xmm1,%xmm1
jb     1211 <main+0xd1>
xorps  %xmm1,%xmm1
lea    0xe80(%rip),%rbx
xorps  %xmm0,%xmm0
movss  %xmm0,0x4(%rsp)
jmp    11b8 <main+0x78>
nop
movapd %xmm1,%xmm0
cmpnlesd %xmm3,%xmm0
andpd  %xmm0,%xmm1
andnpd %xmm3,%xmm0
orpd   %xmm0,%xmm1
addss  0xe53(%rip),%xmm2
movss  0xc(%rsp),%xmm0
ucomiss %xmm2,%xmm0
jb     1207 <main+0xc7>
movss  %xmm2,0x8(%rsp)
movaps %xmm1,0x20(%rsp)
movaps %xmm2,%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm1
movaps %xmm0,0x10(%rsp)
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movapd 0x10(%rsp),%xmm3
movss  0x8(%rsp),%xmm2
movapd 0x20(%rsp),%xmm1
ucomisd %xmm1,%xmm3
jb     1190 <main+0x50>
movss  %xmm2,0x4(%rsp)
jmp    1190 <main+0x50>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdf8(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E6\AD\A3\E6\95\B4\E6\95\B0\E3\80\82\0A\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [12 x i8] c"sin(%f)=%f\0A\00"
@.str.3 = [36 x i8] c"%f\E7\9A\84\E6\AD\A3\E5\BC\A6\E6\9C\80\E5\A4\A7\EF\BC\8C\0A\E6\9C\80\E5\A4\A7\E5\80\BC\E4\B8\BA%f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca double
%6 = alloca double
%7 = alloca double
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
store float 0.000000e+00, float* %3
store float 0.000000e+00, float* %4
store double 0.000000e+00, double* %7
br label %10
10: ; preds = %28, %0
%11 = load float, float* %3
%12 = load float, float* %2
%13 = fcmp ole float %11, %12
br i1 %13, label %14, label %31
14: ; preds = %10
%15 = load float, float* %3
%16 = call double @sin(float %15)
store double %16, double* %6
%17 = load float, float* %3
%18 = fpext float %17 to double
%19 = load double, double* %6
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), double %18, double %19)
%21 = load double, double* %6
%22 = load double, double* %7
%23 = fcmp oge double %21, %22
br i1 %23, label %24, label %27
24: ; preds = %14
%25 = load double, double* %6
store double %25, double* %7
%26 = load float, float* %3
store float %26, float* %4
br label %28
27: ; preds = %14
br label %28
28: ; preds = %27, %24
%29 = load float, float* %3
%30 = fadd float %29, 1.000000e+00
store float %30, float* %3
br label %10
31: ; preds = %10
%32 = load float, float* %4
%33 = fpext float %32 to double
%34 = load double, double* %7
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), double %33, double %34)
%36 = load i32, i32* %1
ret i32 %36
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [12 x i8] c"sin(%f)=%f\0A\00"
@.str.3 = [36 x i8] c"%f\E7\9A\84\E6\AD\A3\E5\BC\A6\E6\9C\80\E5\A4\A7\EF\BC\8C\0A\E6\9C\80\E5\A4\A7\E5\80\BC\E4\B8\BA%f\00"
@str = [22 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E6\AD\A3\E6\95\B4\E6\95\B0\E3\80\82\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%5 = load float, float* %1
%6 = fcmp ult float %5, 0.000000e+00
br i1 %6, label %22, label %7
7: ; preds = %0, %7
%8 = phi double [ %16, %7 ], [ 0.000000e+00, %0 ]
%9 = phi float [ %17, %7 ], [ 0.000000e+00, %0 ]
%10 = phi float [ %15, %7 ], [ 0.000000e+00, %0 ]
%11 = call double @sin(float %9)
%12 = fpext float %9 to double
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), double %12, double %11)
%14 = fcmp ult double %11, %8
%15 = select i1 %14, float %10, float %9
%16 = select i1 %14, double %8, double %11
%17 = fadd float %9, 1.000000e+00
%18 = load float, float* %1
%19 = fcmp ugt float %17, %18
br i1 %19, label %20, label %7
20: ; preds = %7
%21 = fpext float %15 to double
br label %22
22: ; preds = %20, %0
%23 = phi double [ 0.000000e+00, %0 ], [ %21, %20 ]
%24 = phi double [ 0.000000e+00, %0 ], [ %16, %20 ]
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), double %23, double %24)
ret i32 0
}