+
    ii                    D   R t ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RI	H
t
 ^ RIHtHt ^ RIHtHtHtHtHtHtHtHtHtHtHtHtHtHtHtHtHtH t H!t!H"t"H#t#H$t$H%t%H&t&H't'H(t(H)t) ^ RI*H+t+H,t, ^ R	I-H.t.H/t/ ^ R
I0H1t1 ^ RI*H2t2H3t3 / RR R3R R3.bRRbRRbRRbRRbRRbRRbRRbRRbRRbRRbRRbRRbRRbRRbRR bR!R!bt4]5! ]43/ / R"R"bR#R#bR$R$bR%R%bR&R'bR(R(bR)R)bR*R+bR,R,bR-R.bR/R0bR1R1bR2R2bR3R3bR4R4bR5R6bB t6. R7NR8NR9NR:NR;NR<NR=NR>NR?NR@NRANRBNRCNRDNRENRFNRGNRHNRINRJNRKNRLNRMNRNNRONRPNRQNRRNRSNRTNRUNRVNRWNt7RXRY.t8RZ t9R[ t: ! R\ R]]+4      t; ! R^ R_];4      t<R`P{                  4        F  t>]?! ]<Ra]>,          ]<P                  4       K   	   ! Rb Rc]<4      tARd];Re]<Rf]A/tBRg# )ha  
C code printer

The C89CodePrinter & C99CodePrinter converts single SymPy expressions into
single C expressions, using the functions defined in math.h where possible.

A complete code generator, which uses ccode extensively, can be found in
sympy.utilities.codegen. The codegen module can be used to generate complete
source code files that are compilable without further modifications.


)annotations)Anywraps)chain)S)equal_valuedFloat)
AssignmentPointerVariableDeclarationTyperealcomplex_integerbool_float32float64float80	complex64
complex128intcvalue_constpointer_constint8int16int32int64uint8uint16uint32uint64untypednone)CodePrinterrequires)
precedence
PRECEDENCE)Range)ccodeprint_ccodeAbsc                $    V P                   '       * # N
is_integerxs   &p/Users/tonyclaw/.openclaw/workspace/skills/math-calculator/venv/lib/python3.14/site-packages/sympy/printing/c.py<lambda>r4   (   s    1<<'    fabsc                    V P                   # r.   r/   r1   s   &r3   r4   r4   (   s    Q\\r5   abssincostanasinacosatanatan2exploglog10sinhcoshtanhfloorceilingceilsqrtexp2expm1log2log1pCbrtcbrthypotfmaloggammalgammaerfcMaxfmaxMinfminasinhacoshatanherfgammatgammaautobreakcasecharconstcontinuedefaultdodoubleelseenumexternfloatforgotoifintlongregisterreturnshortsignedsizeofstaticstructentryswitchtypedefunionunsignedvoidvolatilewhileinlinerestrictc                    ^ RI Hp Hp ^ RIHp ^ RIHp / \        P                  RbV ! \        P                  4      Rb^V! ^4      ,          RbV! ^4      RbV! ^
4      Rb\        P                  Rb\        P                  ^,          R	b\        P                  ^,          R
b^\        P                  ,          Rb^\        P                  ,          Rb^V! \        P                  4      ,          Rb^V! \        P                  4      ,          RbV! ^4      RbV! ^4      Rb^V! ^4      ,          Rb^V! ^4      ,          Rb# )a9  Returns a dictionary with math-related macros from math.h/cmath

Note that these macros are not strictly required by the C/C++-standard.
For MSVC they are enabled by defining "_USE_MATH_DEFINES" (preferably
via a compilation flag).

Returns
=======

Dictionary mapping SymPy expressions to strings (macro names)

)rL   Sqrt)rA   )rI   M_EM_LOG2EM_LN2M_LN10M_PIM_PI_2M_PI_4M_1_PIM_2_PI
M_2_SQRTPIM_SQRT2	M_SQRT1_2)
sympy.codegen.cfunctionsrL   r   &sympy.functions.elementary.exponentialrA   (sympy.functions.elementary.miscellaneousrI   r   Exp1Pi)rL   r   rA   rI   s       r3   get_math_macrosr   [   sC    4:=	QVVi 	
#a&) 	A	
 	B 	
f 	
Q 	
Q 	
!$$ 	
!$$ 	
$qtt*l 	
$qtt*l 	Q 	Q 	
$q'	;  	
$q'	;! r5   c                0   a  \        S 4      V 3R l4       pV# )al  Decorator for printer methods

When a Printer's method is decorated using this decorator the expressions printed
will first be looked for in the attribute ``math_macros``, and if present it will
print the macro name in ``math_macros`` followed by a type suffix for the type
``real``. e.g. printing ``sympy.pi`` would print ``M_PIl`` if real is mapped to float80.

c                   < WP                   9   d-   V P                   V,          : V P                  \        4      : 2# S! W3/ VB # r.   )math_macros_get_math_macro_suffixr   )selfexprkwargsmeths   &&,r3   _meth_wrapper+_as_macro_if_defined.<locals>._meth_wrapper   sA    ###!--d3T5P5PQU5VWW-f--r5   r   )r   r   s   f r3   _as_macro_if_definedr      s#     4[. . r5   c                  6  a  ] tR t^t$ RtRtRtRt]! ]	4      t	]
! ]P                  3/ R^R/ RRR	]! 4       R
R/B tR]R&   ]]]]]]/t]R]R]R]R]R]R]R]R]R]R]R]R]R]R/tR]R&   ]R0]R0]R0]R0]R0]R0]R0]R0]R0/	t / t!R]R&   ]R]R]"R/t#]R]R]"R /t$]"R/t%R!t&Rt'](t)R]R"&   R[V 3R# llt*R$ t+R% t,R& t-R' t.R( t/R) t0]1V 3R* l4       t2]1R+ 4       t3R, t4R- t5R. t6]1V 3R/ l4       t7R0 t8R1 t9R2 t:R3 t;R4 t<V 3R5 lt=R6 t>R7 t?R8 t@R9 tAR: tBR; tCR< tDR= tER> tFR? tG]GtHR@ tIRA tJRB tK]L! R0RC7      RD 4       tM]L! R0RC7      RE 4       tNRF tORG tPRH tQRI tR]L! RJ0RC7      RK 4       tSRL tTRM tURN tVRO tWRP tXRQ tYRR tZRS t[RT t\RU t]RV t^RW t_RX t`RY ta]_tbRZtcV ;td# )\C89CodePrinterz<A printer to convert Python expressions to strings of C code_ccodeCC89	precisionuser_functionscontractTdereferenceerror_on_reservedFdict[str, Any]_default_settingsrg   ro   rk   boolint8_tint16_tint32_tint64_tzdict[Type, Any]type_mappingsz	stdbool.hzstdint.hzdict[Type, tuple[str, ...]]type_macrosf lFLN_kfc           	     	  < T;'       g    / pV P                   f    VP                  R\        4       4      V n         \        \	        V P
                  P                  4       VP                  R/ 4      P                  4       4      4      V n        \        \	        V P                  P                  4       VP                  R/ 4      P                  4       4      4      V n        \        \	        V P                  P                  4       VP                  R/ 4      P                  4       4      4      V n        \        \	        V P                  P                  4       VP                  R/ 4      P                  4       4      4      V n	        \        \	        V P                  P                  4       VP                  R/ 4      P                  4       4      4      V n
        \        \	        V P                  P                  4       VP                  R/ 4      P                  4       4      4      V n        \        \	        V P                  P                  4       VP                  R/ 4      P                  4       4      4      V n        \        SV `9  V4       \        V P                  3/ VP!                  R	/ 4      B V n        \%        VP!                  R
. 4      4      V n        \%        4       V n        \%        4       V n        \%        4       V n        R # )Nr   type_aliasesr   type_headersr   type_func_suffixestype_literal_suffixestype_math_macro_suffixesr   r   )r   popr   dictr   r   itemsr   r   r   r   r   r   super__init__r   getknown_functionsset_dereferenceheaders	librariesmacros)r   settings	__class__s   &&r3   r   C89CodePrinter.__init__   sH   >>r#'||M?;LMD t'8'8'>'>'@'/||NB'G'M'M'O"Q R!%(:(:(@(@(B(0_b(I(O(O(Q#S T t'8'8'>'>'@'/||NB'G'M'M'O"Q Rd&6&6&<&<&>'/||M2'F'L'L'N!P Q"&uT-D-D-J-J-L(05I2(N(T(T(V(X #Y%)%0J0J0P0P0R(05Lb(Q(W(W(Y+[ &\"(,U43P3P3V3V3X(05OQS(T(Z(Z(\.^ )_%"#DHHS=Mr0RS]B ?@uer5   c                	    V^,          # )    )r   ps   &&r3   _rate_index_position#C89CodePrinter._rate_index_position   s    s
r5   c                F    VP                  R4      '       d   V# VR,           # )z?Get code string as a statement - i.e. ending with a semicolon. ;)endswith)r   
codestrings   &&r3   _get_statementC89CodePrinter._get_statement   s"    '0055zK:;KKr5   c                	$    R P                  V4      # )z/* {} */)format)r   texts   &&r3   _get_commentC89CodePrinter._get_comment   s      &&r5   c                	    V P                   \        ,          p\        WVP                  VP                  4      \
        0R 7      p\        V4      pV P                  V P                  V4      4      # ))typevalueattrs)	r   r   r   evalfdecimal_digr   r   r   _print)r   namer   type_vardecls   &&&   r3   _declare_number_const$C89CodePrinter._declare_number_const  sW    !!$'tu{{5;L;L/MVaUbc3""4;;t#455r5   c                	$    V P                  V4      # r.   )indent_code)r   liness   &&r3   _format_codeC89CodePrinter._format_code  s    &&r5   c                	L   a VP                   w  poV3R  l\        V4       4       # )c              3  N   <"   T F  p\        S4       F  q!V3x  K
  	  K  	  R # 5ir.   )range).0ijcolss   &  r3   	<genexpr>:C89CodePrinter._traverse_matrix_indices.<locals>.<genexpr>  s     A1U4[A[s   "%)shaper   )r   matrowsr   s   && @r3   _traverse_matrix_indices'C89CodePrinter._traverse_matrix_indices
  s    YY
dAdAAr5   c                	&   < \         SV `  ! V3/ VB # r.   )r   
_print_Mul)r   r   r   r   s   &&,r3   r  C89CodePrinter._print_Mul  s    w!$1&11r5   c           	     	:   R V P                   9   d   V P                  V4      # \        V4      pV P                  \        4      p\        VP                  R4      '       d<   V P                  \        R4      4      : RV P                  VP                  V4      : 2# \        VP                  R4      '       d2   V P                  : RV: RV P                  VP                  4      : R2# VP                  \        P                  ^,          8X  dC   V P                  R8w  d2   V P                  : RV: RV P                  VP                  4      : R2# V P                  : R	V: RV P                  VP                  4      : R
V P                  VP                  4      : R2# )Powg      ?/g      ?rI   ()r   rO   pow, )r   _print_Functionr'   _get_func_suffixr   r   r@   _print_Floatr	   parenthesizebase_nsr   r   Onestandard)r   r   PRECsuffixs   &&  r3   
_print_PowC89CodePrinter._print_Pow  s   D(((''--$&&t,"%%"//c
;T=N=NtyyZ^=_``$((C((%)XXvt{{4997MNNXXq T]]e%;%)XXvt{{4997MNN(,&$++dii:P#';;txx#8: :r5   c                	   VP                   w  r#VP                  '       d   VP                  '       d   \        V4      pVP                    Uu. uF  qPP                  WT4      NK  	  upw  rgVP                  '       d   VP                  '       g%   VP
                  '       d   VP
                  '       d   V R V 2# RV R V RV RV 2# V P                  VRR7      # u upi )z % ((z) + z) % fmod)known)argsr0   r'   r  is_nonnegativeis_nonpositive_print_math_func)r   r   numdenr  argsnumsdens   &&      r3   
_print_ModC89CodePrinter._print_Mod"  s    99>>>cnnnd#DBF))L)3++C6)LJD """s'9'9'9"""s'9'9'9s4&))vSd4&TF;;$$T$88 Ms   Cc                	    \        VP                  4      \        VP                  4      r2V P                  \        4      pR W$W43,          # )z%d.0%s/%d.0%s)ro   r   q_get_literal_suffixr   )r   r   r   r'  r  s   &&   r3   _print_RationalC89CodePrinter._print_Rational1  s9    466{CK1))$/!Q!777r5   c                	   \        VP                  R \        P                  4      p\        VP                  RR4      pVP                  pVe   \        V\        4      '       d   VP                  p\        P                  pRpVR8X  g   Vf,   \        \        VP                  4      4      pVRRR	1,          pMVR8X  d   \        VP                  4      pX F  p	Wv3,          pWeV	,          ,          pK  	  Tp\        R \        WC4       4       4      V,           p
V P                  VP                  P                  4      : RV P                  V
4      : R2# )
offsetstridesNr   r   c              3  N   "   T F  q^ ,          V^,          ,          x  K  	  R# 5i)    Nr   )r   r2   s   & r3   r   0C89CodePrinter._print_Indexed.<locals>.<genexpr>J  s     B,Aq1ad,As   #%[]r   r
  )getattrr  r   Zeroindices
isinstancestrr   r  reversedr   ranksumzipr   label)r   r   r,  r-  r5  dimsshifttemp	traversalr   
flat_indexs   &&         r3   _print_IndexedC89CodePrinter._print_Indexed6  s   Haff5$))Y5,,?j#66::DEEED#~$U499%56	!$B$-C!$)),	 a   GBC,ABBVK
;;tyy7;;z24 	4r5   c                	"   < \         SV `  V4      # r.   )r   _print_NumberSymbol)r   r   r   s   &&r3   rE  "C89CodePrinter._print_NumberSymbolN  s    w*400r5   c                	    R # )HUGE_VALr   r   r   s   &&r3   _print_InfinityC89CodePrinter._print_InfinityR      r5   c                	    R # )z	-HUGE_VALr   rI  s   &&r3   _print_NegativeInfinity&C89CodePrinter._print_NegativeInfinityU      r5   c           
     	   VP                   R,          P                  R8w  d   \        R4      h. pVP                  \        4      '       d   \        VP                   4       F  w  pw  rEV^ 8X  d)   VP                  RV P                  V4      ,          4       MaV\        VP                   4      ^,
          8X  d   VR8X  d   VP                  R4       M'VP                  RV P                  V4      ,          4       V P                  V4      pVP                  V4       VP                  R4       K  	  RP                  V4      # VP                   RR  UUu. uF.  w  rER	V P                  V4      : R
V P                  V4      : R2NK0  	  pppRV P                  VP                   R,          P                  4      ,          pRP                  V4      V,           RP                  R\        V4      ,          .4      ,           # u uppi )   TzAll Piecewise expressions must contain an (expr, True) statement to be used as a default condition. Without one, the generated expression may not evaluate to anything under some condition.z	if (%s) {zelse {zelse if (%s) {}
Nr  z) ? (
z
)
z: (
%s
)z:  r  r
  )r  cond
ValueErrorhasr
   	enumerateappendr   lenjoinr   )	r   r   r   r   eccode0ecpairs	last_lines	   &&       r3   _print_PiecewiseC89CodePrinter._print_PiecewiseX  s   99R=%  / 0 0
 88J&tyy1	6A6LLt{{1~!=>#dii.1,,dLL*LL!1DKKN!BCAU#S! 2 99U## !%		#20 .1 04{{1~/3{{1~? .  0 %t{{499R=3E3E'FFI99W%	1CHHc#g,>N=O4PPP	0s   4G;c                	R    ^ RI Hp V P                  VP                  VRR7      4      # )r/  )	PiecewiseF)deep)sympy.functionsre  r   rewrite)r   r   re  s   && r3   
_print_ITEC89CodePrinter._print_ITEy  s!    -{{4<<	<>??r5   c                	    R P                  V P                  VP                  \        R,          RR7      VP                  VP
                  VP                  P                  ^,          ,          ,           4      # )z{}[{}]AtomT)strict)r   r  parentr(   r   r   r   rI  s   &&r3   _print_MatrixElement#C89CodePrinter._print_MatrixElement}  s[    t00j>P  1  &&466$++*;*;A*>#>>@ 	@r5   c                	v   < \         SV `  V4      pWP                  R ,          9   d   RP                  V4      # V# )r   z(*{}))r   _print_Symbol	_settingsr   )r   r   r   r   s   && r3   rr  C89CodePrinter._print_Symbol  s5    w$T*>>-00>>$''Kr5   c                	    V P                  VP                  4      pV P                  VP                  4      pVP                  pR P	                  W$V4      # )z{} {} {})r   lhsrhsrel_opr   )r   r   lhs_coderhs_codeops   &&   r3   _print_Relational C89CodePrinter._print_Relational  sB    ;;txx(;;txx([[  x88r5   c                	    V P                  VP                  4      p\        VP                  \        4      '       d   VP                  P
                  w  r4pM\        R 4      hV P                  VP                  4      pRP                  W#WEVR7      # )z*Only iterable currently supported is RangezLfor ({target} = {start}; {target} < {stop}; {target} += {step}) {{
{body}
}})targetstartstopstepbody)	r   r  r6  iterabler)   r  NotImplementedErrorr  r   )r   r   r  r  r  r  r  s   &&     r3   
_print_ForC89CodePrinter._print_For  sw    T[[)dmmU++ $ 2 2E%&RSS{{499%)*0&4 +1 +1	1r5   c                	d    R P                  V P                  VP                  ^ ,          4      4      # )z((({0}) > 0) - (({0}) < 0)))r   r   r  )r   funcs   &&r3   _print_signC89CodePrinter._print_sign  s$    ,33DKK		!4MNNr5   c                	|   a a R S P                   9   d   S P                  V4      # VV 3R loS! VP                  4      # )rU   c           	        < \        V 4      ^8X  d   SP                  V ^ ,          4      # \        V 4      ^,          pRRS! V RV 4      RS! WR 4      /,          # )rR  z!((%(a)s > %(b)s) ? %(a)s : %(b)s)aNbr[  r   )r  halfinner_print_maxr   s   & r3   r  2C89CodePrinter._print_Max.<locals>.inner_print_max  ^    4yA~{{47++t9>D6_T%4[1_T%[1:  r5   r   r  r  )r   r   r  s   f&@r3   
_print_MaxC89CodePrinter._print_Max  8    D(((''--	 tyy))r5   c                	|   a a R S P                   9   d   S P                  V4      # VV 3R loS! VP                  4      # )rW   c           	        < \        V 4      ^8X  d   SP                  V ^ ,          4      # \        V 4      ^,          pRRS! V RV 4      RS! WR 4      /,          # )rR  z!((%(a)s < %(b)s) ? %(a)s : %(b)s)r  Nr  r  )r  r  inner_print_minr   s   & r3   r  2C89CodePrinter._print_Min.<locals>.inner_print_min  r  r5   r  )r   r   r  s   f&@r3   
_print_MinC89CodePrinter._print_Min  r  r5   c                   \        V\        4      '       d2   V P                  VP                  R4      4      pRP	                  V4      # RpRpRpV Uu. uF  qfP                  R4      NK  	  ppV Uu. uF+  p\        \        \        VP                  V4      4      4      NK-  	  ppV Uu. uF+  p\        \        \        VP                  V4      4      4      NK-  	  pp. p	^ p
\        V4       FZ  w  rVR9   d   V	P                  V4       K  WV,          ,          p
V	P                  W:,          : V: 24       WV,          ,          p
K\  	  V	# u upi u upi u upi )z0Accepts a string of code or a list of code linesTr   z   z 	){r  z{
z(
)rS  r  )r   rT  )r6  r7  r   
splitlinesr\  lstripro   anymapr   
startswithrY  rZ  )r   code
code_linestab	inc_token	dec_tokenlineincreasedecreaseprettylevelns   &&          r3   r   C89CodePrinter.indent_code  s#    dC  ))$//$*?@J77:&&,		/34ttE"t4HLMCCy9:;MJNO$$CC;<=$O GAz!d#a[ EMMCIt45a[ E '  5MOs   E
11E(1Ec                	Z    V P                   V P                  P                  W4      ,          # r.   )r   r   r   r   r   s   &&r3   r  C89CodePrinter._get_func_suffix  s$    &&t'8'8'<'<U'JKKr5   c                	Z    V P                   V P                  P                  W4      ,          # r.   )r   r   r   r  s   &&r3   r(  "C89CodePrinter._get_literal_suffix  s$    ))$*;*;*?*?*MNNr5   c                	    V P                   P                  W4      pV P                  P                  VR 4      pV P                  P                  W4      # )r   )r   r   r   )r   r   aliasdflts   &&  r3   r   %C89CodePrinter._get_math_macro_suffix  sG    !!%%e3,,00;,,00==r5   c                	V   a  R RP                  V 3R lV 4       4      ,           R,           # )r  r	  c              3  F   <"   T F  pSP                  V4      x  K  	  R # 5ir.   r   )r   r]  r   s   & r3   r   .C89CodePrinter._print_Tuple.<locals>.<genexpr>  s     :TT[[^^T   !rS  )r\  rI  s   f&r3   _print_TupleC89CodePrinter._print_Tuple  s"    499:T:::3>>r5   c                	^   V P                   P                  V P                  P                  V\	        4       4      4       V P
                  P                  V P                  P                  V\	        4       4      4       V P                  V P                  P                  WP                  4      4      # r.   )
r   updater   r   r   r   r   r   r   r   r  s   &&r3   _print_TypeC89CodePrinter._print_Type  st    D--11%?@4++//su=>{{4--11%DEEr5   c           	     	*   ^ RI Hp VP                  pVP                  pVP                  \
        8X  d   \        R4      h\        V\        4      '       d   RP                  \        VP                  9   d   RMRV P                  VP                  4      \        VP                  9   d   RMRW#P                  9   d   RMRV P                  VP                  4      R7      pM\        V\        4      '       d_   R	P                  \        VP                  9   d   RMRV P                  VP                  4      V P                  VP                  4      R
7      pM\!        R\	        V4      ,          4      hVR8w  d    VRV P                  V4      ,          ,          pV# )r/  )r   z$C does not support untyped variablesz{vc}{t} *{pc} {r}{s}zconst r   z constz	restrict )vctpcrsz{vc}{t} {s})r  r  r  zUnknown type of var: %sNz = %s)sympy.codegen.cnodesr   variabler   r   r#   rW  r6  r   r   r   r   r   r   symbolr   r  )r   r   r   r   valresults   &&    r3   _print_Declaration!C89CodePrinter._print_Declaration  s.   1mmii88wCDDc7##+22*cii78R++chh',		98r!)YY!6+B++cjj) 3 F X&&"))*cii78R++chh'++cjj) * F &&?$s)&KLL$;gC 000Fr5   c                	J   V P                   P                  \        \        4      pV P                  P	                  V P
                  P                  V\        4       4      4       V P                  V4      p\        VP                  VP                  4      4      pR V9  d   RV9  d
   VR,          pVP                  R 4      pV^ ,          P                  R4      V^ &   V^ ,          P                  R4      '       d   V^ ;;,          R,          uu&   R P                  V4      V,           # )r]  .z.00)r   r   r   r   r  r   r   r(  r7  r   r   splitrstripr   r\  )r   fltr   r  r  	num_partss   &&    r3   r  C89CodePrinter._print_Float  s    !!%%dD14++//su=>))%0#))E--./c>cn4KCIIcN	 |**3/	!Q<  %%aLCLxx	"V++r5   r   c                	    R # )truer   rI  s   &&r3   _print_BooleanTrue!C89CodePrinter._print_BooleanTrue  s    r5   c                	    R # )falser   rI  s   &&r3   _print_BooleanFalse"C89CodePrinter._print_BooleanFalse  s    r5   c                	  a  VP                   R 8X  dC   VP                  R 8w  d   \        R4      hRP                  V 3R lVP                   4       4      pMd\        R \        VP                  VP                   4       4       4      pVP                  R 8w  d   W1P                  ,          pS P                  V4      pRP                  S P                  VP                  4      VR7      # )Nz%Expected strides when offset is givenz][c              3  F   <"   T F  pSP                  V4      x  K  	  R # 5ir.   r  r   r!  r   s   & r3   r   0C89CodePrinter._print_Element.<locals>.<genexpr>  s     G,3dkk#..,r  c              3  6   "   T F  w  rW,          x  K  	  R # 5ir.   r   )r   r   r  s   &  r3   r   r    s     M-LTQQSS-Ls   z{symb}[{idxs}])symbidxs)
r-  r,  rW  r\  r5  r:  r;  r   r   r  )r   elemr  
global_idxs   f&  r3   _print_ElementC89CodePrinter._print_Element  s    <<4{{d" !HII99G$,,GHDMSt||-LMMJ{{d"kk)
;;z*D&&T[[) ' 
 	
r5   c           
         RP                  VP                   Uu. uF"  q P                  V P                  V4      4      NK$  	  up4      # u upi )z/Elements of code blocks printed as statements. rT  )r\  r  r   r   )r   r   r   s   && r3   _print_CodeBlockC89CodePrinter._print_CodeBlock&  s8    yytyyQy!--dkk!n=yQRRQs   (A	c                	P   a  R P                   ! R/ VP                  V 3R lR7      B # )z while ({condition}) {{
{body}
}}c                &   < SP                  V 4      # r.   r  )r!  r   s   &r3   r4   -C89CodePrinter._print_While.<locals>.<lambda>,  s    dkk#.r5   )applyr   )r   r   rI  s   f&r3   _print_WhileC89CodePrinter._print_While*  s/    3:: 1T[[. >I >0 1 	1r5   c                	F    R V P                  VP                  4      ,          # )z{
%s
})r  r  rI  s   &&r3   _print_ScopeC89CodePrinter._print_Scope.  s    D11$))<<<r5   zstdio.hc                	H  a  VP                   \        8X  d   R pM$RRS P                  VP                   4      /,          pTP                  VP                  \        8X  d   RMS P                  VP                  4      RP                  V 3R lVP                   4       4      R7      # )zprintf({fmt}, {pargs})z fprintf(%(out)s, {fmt}, {pargs})outz%s
r	  c              3  F   <"   T F  pSP                  V4      x  K  	  R # 5ir.   r  r  s   & r3   r   .C89CodePrinter._print_Print.<locals>.<genexpr>;  s     I#T[[--r  )fmtpargs)filer$   r   r   format_stringr\  
print_args)r   r   templates   f& r3   _print_PrintC89CodePrinter._print_Print1  s    99/H9t{{499-= H ,,4$++dFXFX:Y))IIJ  
 	
r5   c                	    VP                   # r.   )r   )r   strms   &&r3   _print_StreamC89CodePrinter._print_Stream>  s    yyr5   c                	(  a  R P                  V 3R lVP                   4       4      pR\        ;QJ d-    . V 3R lVP                  VP                  3 4       F  NK  	  5M&! V 3R lVP                  VP                  3 4       4      V3,           ,          # )r	  c              3  X   <"   T F  pSP                  \        V4      4      x  K!  	  R # 5ir.   )r   r   r  s   & r3   r   :C89CodePrinter._print_FunctionPrototype.<locals>.<genexpr>B  s"     S?C$++k#&677?s   '*z	%s %s(%s)c              3  F   <"   T F  pSP                  V4      x  K  	  R # 5ir.   r  r  s   & r3   r   r  D  s     M/L4;;s##/Lr  )r\  
parameterstuplereturn_typer   )r   r   parss   f& r3   _print_FunctionPrototype'C89CodePrinter._print_FunctionPrototypeA  sk    yyS4??STEM0@0@$))/LMEEM0@0@$))/LMNRVQXX
 	
r5   c                	N    V P                  V4      : V P                  V4      : 2# r.   )r  r  rI  s   &&r3   _print_FunctionDefinition(C89CodePrinter._print_FunctionDefinitionG  s(    66t<**402 	2r5   c                	N    VP                   w  pR V P                  V4      ,          # )z	return %sr  r   r   r   r!  s   && r3   _print_ReturnC89CodePrinter._print_ReturnK  s!    yyT[[---r5   c                	\   a  R RP                  V 3R lVP                   4       4      ,          # )z(%s)r	  c              3  F   <"   T F  pSP                  V4      x  K  	  R # 5ir.   r  r  s   & r3   r   6C89CodePrinter._print_CommaOperator.<locals>.<genexpr>P  s     "Iy4;;s#3#3yr  )r\  r  rI  s   f&r3   _print_CommaOperator#C89CodePrinter._print_CommaOperatorO  s!    		"Ityy"IJJJr5   c                	   VP                   \        8X  d   R \        VP                  4      ,          # \	        VP                   P
                  4      ^8X  d6   \        VP                  4      : RV P                  VP                   4      : 2# \        VP                  4      : RV P                  VP                   4      : R2# )z%s:z:
z:
{
z
})r  r$   r7  r   r[  r  r  rI  s   &&r3   _print_LabelC89CodePrinter._print_LabelR  sz    993tyy>))tyy~~!# #DII0E0Edii0PQQ"%dii.$2G2G		2RSSr5   c                	<    R VP                   P                  ,          # )zgoto %s)r<  r   rI  s   &&r3   _print_gotoC89CodePrinter._print_gotoY  s    4::??**r5   c                	N    VP                   w  pR V P                  V4      ,          # )z++(%s)r  r  s   && r3   _print_PreIncrement"C89CodePrinter._print_PreIncrement\  !    yy$++c***r5   c                	N    VP                   w  pR V P                  V4      ,          # )z(%s)++r  r  s   && r3   _print_PostIncrement#C89CodePrinter._print_PostIncrement`  r+  r5   c                	N    VP                   w  pR V P                  V4      ,          # )z--(%s)r  r  s   && r3   _print_PreDecrement"C89CodePrinter._print_PreDecrementd  r+  r5   c                	N    VP                   w  pR V P                  V4      ,          # )z(%s)--r  r  s   && r3   _print_PostDecrement#C89CodePrinter._print_PostDecrementh  r+  r5   c                	    R RVP                   P                  RVP                  RRP                  VP                   Uu. uF  q P                  V4      NK  	  upR.,           4      /,          # u upi )z!%(keyword)s %(name)s {
%(lines)s}keywordr   r   z;
r   )r   __name__r   r\  declarationsr   )r   r   r   s   && r3   _print_structC89CodePrinter._print_structl  se    3t~~..		7EJJ/3/@/@A/@tT"/@ARDHMJ7
 
 	
As   A-c                	    R # )r`   r   r   _s   &&r3   _print_BreakToken C89CodePrinter._print_BreakTokenr  s    r5   c                	    R # )rd   r   r<  s   &&r3   _print_ContinueToken#C89CodePrinter._print_ContinueTokenu  rL  r5   )r   r   r   r   r   r   r   r   r   r   r   r   r   r.   )er7  
__module____qualname____firstlineno____doc__printmethodlanguager  r   reserved_wordsr   r%   r   __annotations__r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r   r   r   r   r   r   r   r   r  known_functions_C89r   r   r   r   r   r   r   r   r   r  r  r$  r)  rB  rE  rJ  rN  rb  ri  ro  rr  r|  r  r  r  r  r   r  r(  r   r  _print_Listr  r  r  r&   r  r  r  r  r  r  r  r	  r  r  r  r   r#  r&  r)  r-  r0  r3  r9  r>  rA  _print_union__static_attributes____classcell__)r   s   @r3   r   r      s   FKHH(N(,[-J-J )R"DsuUO )~  	g*L 	hevhyyyx			&M? $ 	}zl
|
|
|
|
L 02K,1 	 	 	  K
C-C-2L'6'B 2 2 : :98
40 1 1QB@@9	1O**6LO>
? KF
6, {m$ % {m$ %
 S1= yk"

 #


2.KT+++++
 !Lr5   r   c            	         ] tR tRt$ Rt]! ]],           4      t]! ]	! ]
P                  P                  4       ]R]R/P                  4       4      4      t]! ]	! ]
P                  P                  4       ]R0]R0/P                  4       4      4      t]tR]R&   RP'                  4       tR	 tR
 tR t]! R0R0R7      ]RR l4       4       tR tR tR tRtR# )C99CodePrinteriz  C99zfloat complexzdouble complexz	complex.hr   r   a  fabs fmod remainder remquo fma fmax fmin fdim nan exp exp2 expm1 log log10 log2 log1p pow sqrt cbrt hypot sin cos tan asin acos atan atan2 sinh cosh tanh asinh acosh atanh erf erfc tgamma lgamma ceil floor trunc round nearbyint rint frexp ldexp modf scalbn ilogb logb nextafter copysignc                	    R # )INFINITYr   rI  s   &&r3   rJ  C99CodePrinter._print_Infinity  rL  r5   c                	    R # )z	-INFINITYr   rI  s   &&r3   rN  &C99CodePrinter._print_NegativeInfinity  rP  r5   c                	    R # )NANr   rI  s   &&r3   
_print_NaNC99CodePrinter._print_NaN  s    r5   zmath.hm)r   r   Nc           
     	  a  Vf(   S P                   VP                  P                  ,          p\        V\        4      '       g1   V F  w  rEV! VP
                  !  '       g   K  Tp M	  \        R4      h V! S .VP
                  O5!  #   \         d=    S P                  T,           S P                  9   d   S P                  \        4      MRp Mi ; iT'       d   S P                  TP
                  ^ ,          4      p\        TP
                  4      ^8  d   RpTP
                  ^R
  FA  p	TR,          pTRP                  S P                  TTS P                  T	4      R7      ,          pKC  	  TRS P                  TP                  TP
                  R
,          4      4      : T: 2,          pM%RP!                  T 3R lTP
                   4       4      pRP                  S P                  TTTR	7      # )NzNo matching printerr   r  z, {ns}{name}{suffix}({next})nsr   r  nextr	  c              3  F   <"   T F  pSP                  V4      x  K  	  R # 5ir.   r  r  s   & r3   r   2C99CodePrinter._print_math_func.<locals>.<genexpr>  s     D)3dkk#..)r  z{ns}{name}{suffix}({args}))r^  r   r  r  r
  )r   r   r7  r6  r7  r  rW  	TypeErrorr  _prec_funcsr  r   r   r[  r   r  r\  )
r   r   nestr  cbr   r  r  
paren_pilecurr_args
   f&&&      r3   r  C99CodePrinter._print_math_func  s    =(()@)@AE%%%!tyy>> E "
 !!677	a*		** 	a48HHu4DHXHX4XT**40^`F	a ;;tyy|,D499~!
 $		!BH#%J9@@88"%#{{84	 A  D !0 KK		$))B- 89 
 99D$))DED+22xx	 3 
 	
s   4B ACCc                	(    V P                  VR R7      # T)rd  r  rI  s   &&r3   r  C99CodePrinter._print_Max      $$T$55r5   c                	(    V P                  VR R7      # rj  rk  rI  s   &&r3   r  C99CodePrinter._print_Min  rm  r5   c                	(   . p. pR pV F  pVP                  VRV P                  VP                  4      RV P                  VP                  4      RV P                  VP                  ^,           4      /,          4       VP                  R4       K  	  W#3# )z8for (int %(var)s=%(start)s; %(var)s<%(end)s; %(var)s++){r   r  endrS  )rZ  r   r<  lowerupper)r   r5  
open_linesclose_lines	loopstartr   s   &&    r3   _get_loop_opening_ending'C99CodePrinter._get_loop_opening_ending  s    
N	Ait{{177+QWW-t{{177Q;/+1 1 2 s#  &&r5   r   )FN)r7  rC  rD  rE  r  r   rI  reserved_words_c99r   r   r   r   r   r   r   r   known_functions_C99r   rJ  r  rc  rJ  rN  rZ  r&   r   r  r  r  rw  rN  r   r5   r3   rQ  rQ  z  s    H*<<=Nu^99??A?$D eg M n99??AK=[MD eg L .C-L NSUW	 
 xjSE2&
  3&
P66'r5   rQ  zAbs Sqrt exp exp2 expm1 log log10 log2 log1p Cbrt hypot fma loggamma sin cos tan asin acos atan atan2 sinh cosh tanh asinh acosh atanh erf erfc loggamma gamma ceiling floorz	_print_%sc                  6    ] tR tRt]! R0R7      R 4       tRtR# )C11CodePrinteri  z
stdalign.hr  c                	N    VP                   w  pR V P                  V4      ,          # )zalignof(%s)r  r  s   && r3   _print_alignofC11CodePrinter._print_alignof  s!    yyt{{3///r5   r   N)r7  rC  rD  rE  r&   r~  rN  r   r5   r3   r|  r|    s    |n%0 &0r5   r|  c89c99c11N)CrF  
__future__r   typingr   	functoolsr   	itertoolsr   
sympy.corer   sympy.core.numbersr   r	   sympy.codegen.astr
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   sympy.printing.codeprinterr%   r&   sympy.printing.precedencer'   r(   sympy.sets.fancysetsr)   r*   r+   rK  r   rz  rI  ry  r   r   r   rQ  r  ksetattrr  r|  c_code_printersr   r5   r3   <module>r     s   #     2        = < & :	'03I52QR	5 
5 
5	
 F F F W 
5 
5 W F F F W  v!" F# ( .  3
F3W3 F3 W	3
 F3 W3 
53 3 F3 
63 
63 W3 W3 W3 
53  X!3  ,
#%,.8:CEI&(/168>@DFK   ! #* ,4 6> @H 	 	
 
 
 !
 #-
 /5
 7A
 CJ 
+ "J&e![ e!N\'^ \'~89>
AA NK!O^-L-LM
A0^ 0 
>	>	>r5   