
    \hi                       S r SSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r
  SSKJrJr  SSKJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJ r J!r!J"r"J#r#J$r$J%r%J&r&J'r'J(r(J)r)  SS	K*J+r+J,r,  SS
K-J.r.J/r/  SSK0J1r1  SSK*J2r2J3r3  0 SS S4S S4/_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_S S!_S"S"_r4\5" \440 0 S#S#_S$S$_S%S%_S&S&_S'S(_S)S)_S*S*_S+S,_S-S-_S.S/_S0S1_S2S2_S3S3_S4S4_S5S5_S6S7_D6r6/ S8Qr7S9S:/r8S; r9S< r: " S= S>\+5      r; " S? S@\;5      r<SAR{                  5        H  r>\?" \<SB\>-  \<R                  5        M      " SC SD\<5      rA\;\<\ASE.rBgF)Ga  
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                $    U R                   (       + $ N
is_integerxs    H/var/www/auris/envauris/lib/python3.13/site-packages/sympy/printing/c.py<lambda>r5   (   s    1<<'    fabsc                    U R                   $ r/   r0   r2   s    r4   r5   r5   (   s    Q\\r6   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                 8   SSK Jn Jn  SSKJn  SSKJn  0 [        R                  S_U " [        R                  5      S_SU" S5      -  S_U" S5      S	_U" S
5      S_[        R                  S_[        R                  S-  S_[        R                  S-  S_S[        R                  -  S_S[        R                  -  S_SU" [        R                  5      -  S_SU" [        R                  5      -  S_U" S5      S_U" S5      S_SU" S5      -  S_SU" S5      -  S_$ )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)

r   )rM   Sqrt)rB   )rJ   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.cfunctionsrM   r   &sympy.functions.elementary.exponentialrB   (sympy.functions.elementary.miscellaneousrJ   r   Exp1Pi)rM   r   rB   rJ   s       r4   get_math_macrosr   [   sC    4:=	QVVi 	
#a&) 	A	
 	B 	
f 	
Q 	
Q 	
!$$ 	
!$$ 	
$qtt*l 	
$qtt*l 	Q 	Q 	
$q'	;  	
$q'	;! r6   c                0   ^  [        T 5      U 4S j5       nU$ )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                   > XR                   ;   a(  U R                   U   < U R                  [        5      < 3$ T" X40 UD6$ r/   )math_macros_get_math_macro_suffixr   )selfexprkwargsmeths      r4   _meth_wrapper+_as_macro_if_defined.<locals>._meth_wrapper   sA    ###!--d3T5P5PQU5VWW-f--r6   r   )r   r   s   ` r4   _as_macro_if_definedr      s#     4[. . r6   c                    ^  \ rS rSr% SrSrSrSr\" \	5      r	\
" \R                  40 S0 S\" 5       SS	.D6rS
\S'   \\\\\\0r\S\S\S\S\S\S\S\S\S\S\S\S\S\S0rS\S'   \S1\S1\S1\S1\S1\S1\S1\S1\S10	r 0 r!S\S'   \S\S\"S0r#\S\S\"S0r$\"S0r%Sr&Sr'\(r)S
\S '   SYU 4S! jjr*S" r+S# r,S$ r-S% r.S& r/S' r0\1U 4S( j5       r2\1S) 5       r3S* r4S+ r5S, r6\1U 4S- j5       r7S. r8S/ r9S0 r:S1 r;S2 r<U 4S3 jr=S4 r>S5 r?S6 r@S7 rAS8 rBS9 rCS: rDS; rES< rFS= rG\GrHS> rIS? rJS@ rK\L" S1SA9SB 5       rM\L" S1SA9SC 5       rNSD rOSE rPSF rQSG rR\L" SH1SA9SI 5       rSSJ rTSK rUSL rVSM rWSN rXSO rYSP rZSQ r[SR r\SS r]ST r^SU r_SV r`SW ra\_rbSXrcU =rd$ )ZC89CodePrinter   z<A printer to convert Python expressions to strings of C code_ccodeCC89   TF)	precisionuser_functionscontractdereferenceerror_on_reserveddict[str, Any]_default_settingsrh   rp   rl   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           	       > U=(       d    0 nU R                   c  UR                  S[        5       5      U l         [        [	        U R
                  R                  5       UR                  S0 5      R                  5       5      5      U l        [        [	        U R                  R                  5       UR                  S0 5      R                  5       5      5      U l        [        [	        U R                  R                  5       UR                  S0 5      R                  5       5      5      U l        [        [	        U R                  R                  5       UR                  S0 5      R                  5       5      5      U l	        [        [	        U R                  R                  5       UR                  S0 5      R                  5       5      5      U l
        [        [	        U R                  R                  5       UR                  S0 5      R                  5       5      5      U l        [        [	        U R                  R                  5       UR                  S0 5      R                  5       5      5      U l        [        TU ]9  U5        [        U R                  40 UR!                  S	0 5      D6U l        [%        UR!                  S
/ 5      5      U l        [%        5       U l        [%        5       U l        [%        5       U l        g )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     r4   r   C89CodePrinter.__init__   sF   >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r6   c                    US-  $ )N    )r   ps     r4   _rate_index_position#C89CodePrinter._rate_index_position   s    s
r6   c                <    UR                  S5      (       a  U$ US-   $ )z?Get code string as a statement - i.e. ending with a semicolon. ;)endswith)r   
codestrings     r4   _get_statementC89CodePrinter._get_statement   s"    '0055zK:;KKr6   c                $    SR                  U5      $ )Nz/* {} */)format)r   texts     r4   _get_commentC89CodePrinter._get_comment   s      &&r6   c                    U R                   [           n[        XUR                  UR                  5      [
        1S9n[        U5      nU R                  U R                  U5      5      $ )N)typevalueattrs)	r   r   r   evalfdecimal_digr   r   r   _print)r   namer   type_vardecls         r4   _declare_number_const$C89CodePrinter._declare_number_const  sW    !!$'tu{{5;L;L/MVaUbc3""4;;t#455r6   c                $    U R                  U5      $ r/   )indent_code)r   liness     r4   _format_codeC89CodePrinter._format_code  s    &&r6   c                L   ^ UR                   u  nmU4S j[        U5       5       $ )Nc              3  P   >#    U  H  n[        T5        H  o!U4v   M
     M     g 7fr/   )range).0ijcolss      r4   	<genexpr>:C89CodePrinter._traverse_matrix_indices.<locals>.<genexpr>  s     A1U4[A[s   #&)shaper   )r   matrowsr   s      @r4   _traverse_matrix_indices'C89CodePrinter._traverse_matrix_indices
  s    YY
dAdAAr6   c                &   > [         TU ]  " U40 UD6$ r/   )r   
_print_Mul)r   r   r   r   s      r4   r  C89CodePrinter._print_Mul  s    w!$1&11r6   c           	     (   SU R                   ;   a  U R                  U5      $ [        U5      nU R                  [        5      n[        UR                  S5      (       a;  U R                  [        S5      5      < SU R                  UR                  U5      < 3$ [        UR                  S5      (       a1  U R                  < SU< SU R                  UR                  5      < S3$ UR                  [        R                  S	-  :X  aA  U R                  S
:w  a1  U R                  < SU< SU R                  UR                  5      < S3$ U R                  < SU< SU R                  UR                  5      < SU R                  UR                  5      < S3$ )NPowg      ?/g      ?rJ   ()   r   rP   pow, )r   _print_Functionr(   _get_func_suffixr   r	   rA   _print_Floatr
   parenthesizebase_nsr   r   Onestandard)r   r   PRECsuffixs       r4   
_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: :r6   c                   UR                   u  p#UR                  (       a  UR                  (       a  [        U5      nUR                    Vs/ s H  oPR                  XT5      PM     snu  pgUR                  (       a  UR                  (       d"  UR
                  (       a  UR
                  (       a  U SU 3$ SU SU SU SU 3$ U R                  USS9$ s  snf )Nz % ((z) + z) % fmod)known)argsr1   r(   r  is_nonnegativeis_nonpositive_print_math_func)r   r   numdenr  argsnumsdens           r4   
_print_ModC89CodePrinter._print_Mod"  s    99>>cnnd#DBF))L)3++C6)LJD ""s'9'9""s'9'9s4&))vSd4&TF;;$$T$88 Ms   
Cc                    [        UR                  5      [        UR                  5      p2U R                  [        5      nSX$X44-  $ )Nz%d.0%s/%d.0%s)rp   r   q_get_literal_suffixr   )r   r   r   r/  r  s        r4   _print_RationalC89CodePrinter._print_Rational1  s9    466{CK1))$/!Q!777r6   c                v   [        UR                  S[        R                  5      n[        UR                  SS 5      nUR                  nUb  [        U[        5      (       a  UR                  n[        R                  nSnUS:X  d  Uc'  [        [        UR                  5      5      nUS S S2   nOUS:X  a  [        UR                  5      nW H  n	Xv4-  nXeU	   -  nM     Un[        S [        XC5       5       5      U-   n
U R                  UR                  R                  5      < SU R                  U
5      < S	3$ )
Noffsetstridesr   r   r  r   c              3  6   #    U  H  oS    US   -  v   M     g7f)r   r   Nr   )r   r3   s     r4   r   0C89CodePrinter._print_Indexed.<locals>.<genexpr>J  s     B,Aq1ad,As   [])getattrr  r   Zeroindices
isinstancestrr  r  reversedr   ranksumzipr   label)r   r   r4  r5  r<  dimsshifttemp	traversalr   
flat_indexs              r4   _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 	4r6   c                "   > [         TU ]  U5      $ r/   )r   _print_NumberSymbol)r   r   r   s     r4   rL  "C89CodePrinter._print_NumberSymbolN  s    w*400r6   c                    g)NHUGE_VALr   r   r   s     r4   _print_InfinityC89CodePrinter._print_InfinityR      r6   c                    g)Nz	-HUGE_VALr   rP  s     r4   _print_NegativeInfinity&C89CodePrinter._print_NegativeInfinityU      r6   c           
        UR                   S   R                  S:w  a  [        S5      e/ nUR                  [        5      (       a  [        UR                   5       H  u  nu  pEUS:X  a$  UR                  SU R                  U5      -  5        OWU[        UR                   5      S-
  :X  a  US:X  a  UR                  S5        O#UR                  SU R                  U5      -  5        U R                  U5      nUR                  U5        UR                  S	5        M     S
R                  U5      $ UR                   S S  VVs/ s H.  u  pESU R                  U5      < SU R                  U5      < S3PM0     nnnSU R                  UR                   S   R                  5      -  nSR                  U5      U-   SR                  S[        U5      -  /5      -   $ s  snnf )Nr  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.r   z	if (%s) {r   zelse {zelse if (%s) {}
r   z) ? (
z
)
z: (
%s
)z:  r  )r#  cond
ValueErrorhasr   	enumerateappendr   lenjoinr   )	r   r   r   r   eccode0ecpairs	last_lines	            r4   _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   =5Gc                L    SSK Jn  U R                  UR                  USS95      $ )Nr   )	PiecewiseF)deep)sympy.functionsrk  r   rewrite)r   r   rk  s      r4   
_print_ITEC89CodePrinter._print_ITEy  s!    -{{4<<	<>??r6   c                    SR                  U R                  UR                  [        S   SS9UR                  UR
                  UR                  R                  S   -  -   5      $ )Nz{}[{}]AtomT)strictr   )r   r  parentr)   r   r   r  rP  s     r4   _print_MatrixElement#C89CodePrinter._print_MatrixElement}  s[    t00j>P  1  &&466$++*;*;A*>#>>@ 	@r6   c                l   > [         TU ]  U5      nXR                  S   ;   a  SR                  U5      $ U$ )Nr   z(*{}))r   _print_Symbol	_settingsr   )r   r   r   r   s      r4   rx  C89CodePrinter._print_Symbol  s5    w$T*>>-00>>$''Kr6   c                    U R                  UR                  5      nU R                  UR                  5      nUR                  nSR	                  X$U5      $ )Nz{} {} {})r   lhsrhsrel_opr   )r   r   lhs_coderhs_codeops        r4   _print_Relational C89CodePrinter._print_Relational  sB    ;;txx(;;txx([[  x88r6   c                   U R                  UR                  5      n[        UR                  [        5      (       a  UR                  R
                  u  p4nO[        S5      eU R                  UR                  5      nSR                  X#XEUS9$ )Nz*Only iterable currently supported is RangezLfor ({target} = {start}; {target} < {stop}; {target} += {step}) {{
{body}
}})targetstartstopstepbody)	r   r  r=  iterabler*   r#  NotImplementedErrorr  r   )r   r   r  r  r  r  r  s          r4   
_print_ForC89CodePrinter._print_For  sw    T[[)dmmU++ $ 2 2E%&RSS{{499%)*0&4 +1 +1	1r6   c                \    SR                  U R                  UR                  S   5      5      $ )Nz((({0}) > 0) - (({0}) < 0))r   )r   r   r#  )r   funcs     r4   _print_signC89CodePrinter._print_sign  s$    ,33DKK		!4MNNr6   c                z   ^ ^ ST R                   ;   a  T R                  U5      $ UU 4S jmT" UR                  5      $ )NrV   c                   > [        U 5      S:X  a  TR                  U S   5      $ [        U 5      S-  nST" U S U 5      T" XS  5      S.-  $ )Nr   r   r   z!((%(a)s > %(b)s) ? %(a)s : %(b)s)abra  r   )r#  halfinner_print_maxr   s     r4   r  2C89CodePrinter._print_Max.<locals>.inner_print_max  Z    4yA~{{47++t9>D6$T%4[1$T%[1:  r6   r   r  r#  )r   r   r  s   ` @r4   
_print_MaxC89CodePrinter._print_Max  8    D(((''--	 tyy))r6   c                z   ^ ^ ST R                   ;   a  T R                  U5      $ UU 4S jmT" UR                  5      $ )NrX   c                   > [        U 5      S:X  a  TR                  U S   5      $ [        U 5      S-  nST" U S U 5      T" XS  5      S.-  $ )Nr   r   r   z!((%(a)s < %(b)s) ? %(a)s : %(b)s)r  r  )r#  r  inner_print_minr   s     r4   r  2C89CodePrinter._print_Min.<locals>.inner_print_min  r  r6   r  )r   r   r  s   ` @r4   
_print_MinC89CodePrinter._print_Min  r  r6   c                   [        U[        5      (       a1  U R                  UR                  S5      5      nSR	                  U5      $ SnSnSnU Vs/ s H  ofR                  S5      PM     nnU Vs/ s H+  n[        [        [        UR                  U5      5      5      PM-     nnU Vs/ s H+  n[        [        [        UR                  U5      5      5      PM-     nn/ n	Sn
[        U5       HE  u  pUS;   a  U	R                  U5        M  XU   -  n
U	R                  X:-  < U< 35        XU   -  n
MG     U	$ s  snf s  snf s  snf )	z0Accepts a string of code or a list of code linesTr   z   ){r  z{
z(
)rY  r  z 	r   )r   rZ  )r=  r>  r   
splitlinesrb  lstriprp   anymapr   
startswithr_  r`  )r   code
code_linestab	inc_token	dec_tokenlineincreasedecreaseprettylevelns               r4   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   D712D<)2Ec                R    U R                   U R                  R                  X5         $ r/   )r   r   r   r   r   s     r4   r  C89CodePrinter._get_func_suffix  s$    &&t'8'8'<'<U'JKKr6   c                R    U R                   U R                  R                  X5         $ r/   )r   r   r   r  s     r4   r0  "C89CodePrinter._get_literal_suffix  s$    ))$*;*;*?*?*MNNr6   c                    U R                   R                  X5      nU R                  R                  US5      nU R                  R                  X5      $ )Nr   )r   r   r   )r   r   aliasdflts       r4   r   %C89CodePrinter._get_math_macro_suffix  sG    !!%%e3,,00;,,00==r6   c                F   ^  SSR                  U 4S jU 5       5      -   S-   $ )Nr  r  c              3  F   >#    U  H  nTR                  U5      v   M     g 7fr/   r   )r   rc  r   s     r4   r   .C89CodePrinter._print_Tuple.<locals>.<genexpr>  s     :TT[[^^T   !rY  )rb  rP  s   ` r4   _print_TupleC89CodePrinter._print_Tuple  s"    499:T:::3>>r6   c                ^   U R                   R                  U R                  R                  U[	        5       5      5        U R
                  R                  U R                  R                  U[	        5       5      5        U R                  U R                  R                  XR                  5      5      $ r/   )
r   updater   r   r   r   r   r   r   r   r  s     r4   _print_TypeC89CodePrinter._print_Type  st    D--11%?@4++//su=>{{4--11%DEEr6   c           	        SSK Jn  UR                  nUR                  nUR                  [
        :X  a  [        S5      e[        U[        5      (       a  SR                  [        UR                  ;   a  SOSU R                  UR                  5      [        UR                  ;   a  SOSX#R                  ;   a  SOSU R                  UR                  5      S	9nO[        U[        5      (       aZ  S
R                  [        UR                  ;   a  SOSU R                  UR                  5      U R                  UR                  5      S9nO[!        S[	        U5      -  5      eUS :w  a  USU R                  U5      -  -  nU$ )Nr   )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: %sz = %s)sympy.codegen.cnodesr   variabler   r   r$   r]  r=  r   r   r   r   r   r   symbolr   r  )r   r   r   r   valresults         r4   _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r6   c                   U R                   R                  [        [        5      nU R                  R	                  U R
                  R                  U[        5       5      5        U R                  U5      n[        UR                  UR                  5      5      nSU;  a  SU;  a  US-  nUR                  S5      nUS   R                  S5      US'   US   R                  S5      (       a  US==   S-  ss'   SR                  U5      U-   $ )Nrc  .z.0r   0)r   r   r   r   r  r   r   r0  r>  r   r   splitrstripr   rb  )r   fltr   r  r'  	num_partss         r4   r  C89CodePrinter._print_Float  s    !!%%dD14++//su=>))%0#))E--./c>cn4KCIIcN	 |**3/	!Q<  %%aLCLxx	"V++r6   r   c                    g)Ntruer   rP  s     r4   _print_BooleanTrue!C89CodePrinter._print_BooleanTrue  s    r6   c                    g)Nfalser   rP  s     r4   _print_BooleanFalse"C89CodePrinter._print_BooleanFalse  s    r6   c                  ^  UR                   S :X  aA  UR                  S :w  a  [        S5      eSR                  U 4S jUR                   5       5      nO_[        S [        UR                  UR                   5       5       5      nUR                  S :w  a  X1R                  -  nT R                  U5      nSR                  T R                  UR                  5      US9$ )Nz%Expected strides when offset is givenz][c              3  F   >#    U  H  nTR                  U5      v   M     g 7fr/   r  r   r)  r   s     r4   r   0C89CodePrinter._print_Element.<locals>.<genexpr>  s     G,3dkk#..,r  c              3  .   #    U  H  u  pX-  v   M     g 7fr/   r   )r   r   r  s      r4   r   r    s     M-LTQQS-Ls   z{symb}[{idxs}])symbidxs)
r5  r4  r]  rb  r<  rA  rB  r   r   r  )r   elemr  
global_idxs   `   r4   _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[[) ' 
 	
r6   c           
         SR                  UR                   Vs/ s H"  o R                  U R                  U5      5      PM$     sn5      $ s  snf )z/Elements of code blocks printed as statements. rZ  )rb  r#  r   r   )r   r   r   s      r4   _print_CodeBlockC89CodePrinter._print_CodeBlock&  s8    yytyyQy!--dkk!n=yQRRQs   )A
c                J   ^  SR                   " S0 UR                  U 4S jS9D6$ )Nz while ({condition}) {{
{body}
}}c                &   > TR                  U 5      $ r/   r  )r)  r   s    r4   r5   -C89CodePrinter._print_While.<locals>.<lambda>,  s    dkk#.r6   )applyr   )r   r   rP  s   ` r4   _print_WhileC89CodePrinter._print_While*  s/    3:: 1T[[. >I >0 1 	1r6   c                >    SU R                  UR                  5      -  $ )Nz{
%s
})r  r  rP  s     r4   _print_ScopeC89CodePrinter._print_Scope.  s    D11$))<<<r6   zstdio.hc                6  ^  UR                   [        :X  a  SnO SST R                  UR                   5      0-  nUR                  UR                  [        :X  a  SOT R                  UR                  5      SR                  U 4S jUR                   5       5      S9$ )Nzprintf({fmt}, {pargs})z fprintf(%(out)s, {fmt}, {pargs})outz%s
r  c              3  F   >#    U  H  nTR                  U5      v   M     g 7fr/   r  r  s     r4   r   .C89CodePrinter._print_Print.<locals>.<genexpr>;  s     I#T[[--r  )fmtpargs)filer%   r   r   format_stringrb  
print_args)r   r   templates   `  r4   _print_PrintC89CodePrinter._print_Print1  s    99/H9t{{499-= H ,,4$++dFXFX:Y))IIJ  
 	
r6   c                    UR                   $ r/   )r   )r   strms     r4   _print_StreamC89CodePrinter._print_Stream>  s    yyr6   c                   ^  SR                  U 4S jUR                   5       5      nS[        U 4S jUR                  UR                  4 5       5      U4-   -  $ )Nr  c              3  X   >#    U  H  nTR                  [        U5      5      v   M!     g 7fr/   )r   r   r  s     r4   r   :C89CodePrinter._print_FunctionPrototype.<locals>.<genexpr>B  s"     S?C$++k#&677?s   '*z	%s %s(%s)c              3  F   >#    U  H  nTR                  U5      v   M     g 7fr/   r  r  s     r4   r   r  D  s     M/L4;;s##/Lr  )rb  
parameterstuplereturn_typer   )r   r   parss   `  r4   _print_FunctionPrototype'C89CodePrinter._print_FunctionPrototypeA  sN    yyS4??STM0@0@$))/LMNRVQXX
 	
r6   c                N    U R                  U5      < U R                  U5      < 3$ r/   )r  r   rP  s     r4   _print_FunctionDefinition(C89CodePrinter._print_FunctionDefinitionG  s(    66t<**402 	2r6   c                F    UR                   u  nSU R                  U5      -  $ )Nz	return %sr#  r   r   r   r)  s      r4   _print_ReturnC89CodePrinter._print_ReturnK  s!    yyT[[---r6   c                T   ^  SSR                  U 4S jUR                   5       5      -  $ )Nz(%s)r  c              3  F   >#    U  H  nTR                  U5      v   M     g 7fr/   r  r  s     r4   r   6C89CodePrinter._print_CommaOperator.<locals>.<genexpr>P  s     "Iy4;;s#3#3yr  )rb  r#  rP  s   ` r4   _print_CommaOperator#C89CodePrinter._print_CommaOperatorO  s!    		"Ityy"IJJJr6   c                v   UR                   [        :X  a  S[        UR                  5      -  $ [	        UR                   R
                  5      S:X  a5  [        UR                  5      < SU R                  UR                   5      < 3$ [        UR                  5      < SU R                  UR                   5      < S3$ )Nz%s:r   z:
z:
{
z
})r  r%   r>  r   ra  r#  r  rP  s     r4   _print_LabelC89CodePrinter._print_LabelR  sz    993tyy>))tyy~~!# #DII0E0Edii0PQQ"%dii.$2G2G		2RSSr6   c                4    SUR                   R                  -  $ )Nzgoto %s)rC  r   rP  s     r4   _print_gotoC89CodePrinter._print_gotoY  s    4::??**r6   c                F    UR                   u  nSU R                  U5      -  $ )Nz++(%s)r   r!  s      r4   _print_PreIncrement"C89CodePrinter._print_PreIncrement\  !    yy$++c***r6   c                F    UR                   u  nSU R                  U5      -  $ )Nz(%s)++r   r!  s      r4   _print_PostIncrement#C89CodePrinter._print_PostIncrement`  r2  r6   c                F    UR                   u  nSU R                  U5      -  $ )Nz--(%s)r   r!  s      r4   _print_PreDecrement"C89CodePrinter._print_PreDecrementd  r2  r6   c                F    UR                   u  nSU R                  U5      -  $ )Nz(%s)--r   r!  s      r4   _print_PostDecrement#C89CodePrinter._print_PostDecrementh  r2  r6   c                    SUR                   R                  UR                  SR                  UR                   Vs/ s H  o R                  U5      PM     snS/-   5      S.-  $ s  snf )Nz!%(keyword)s %(name)s {
%(lines)s}z;
r   )keywordr   r   )r   __name__r   rb  declarationsr   )r   r   r   s      r4   _print_structC89CodePrinter._print_structl  s_    3~~..		EJJ/3/@/@A/@tT"/@ARDHMJ7
 
 	
As   A$c                    g)Nra   r   r   _s     r4   _print_BreakToken C89CodePrinter._print_BreakTokenr  s    r6   c                    g)Nre   r   rC  s     r4   _print_ContinueToken#C89CodePrinter._print_ContinueTokenu  rS  r6   )r   r   r   r   r   r   r   r   r   r   r   r   r   r/   )er>  
__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,  r1  rI  rL  rQ  rU  rh  ro  ru  rx  r  r  r  r  r  r   r  r0  r   r  _print_Listr  r  r  r'   r  r  r  r  r  r   r  r  r  r  r"  r'  r*  r-  r0  r4  r7  r:  r@  rE  rH  _print_union__static_attributes____classcell__)r   s   @r4   r   r      s   FKHH(N(,[-J-J )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+++++
 !Lr6   r   c            	         \ rS rSr% Sr\" \\-   5      r\" \	" \
R                  R                  5       \S\S0R                  5       5      5      r\" \	" \
R                  R                  5       \S1\S10R                  5       5      5      r\rS\S'   SR'                  5       rS	 rS
 rS r\" S1S1S9\SS j5       5       rS rS rS rSrg)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                    g)NINFINITYr   rP  s     r4   rQ  C99CodePrinter._print_Infinity  rS  r6   c                    g)Nz	-INFINITYr   rP  s     r4   rU  &C99CodePrinter._print_NegativeInfinity  rW  r6   c                    g)NNANr   rP  s     r4   
_print_NaNC99CodePrinter._print_NaN  s    r6   zmath.hm)r   r   Nc           
       ^  Uc#  T R                   UR                  R                     n[        U[        5      (       d.  U H  u  pEU" UR
                  6 (       d  M  Un  O   [        S5      e U" T /UR
                  Q76 $ ! [         a7    T R                  U-   T R                  ;   a  T R                  [        5      OSn Of = fU(       a  T R                  UR
                  S   5      n[        UR
                  5      S:  a  SnUR
                  SS  H6  n	US-  nUSR                  T R                  UUT R                  U	5      S9-  nM8     US	T R                  UR                  UR
                  S   5      5      < U< 3-  nO%S	R!                  U 4S
 jUR
                   5       5      nSR                  T R                  UUUS9$ )NzNo matching printerr   r   r   r  r  z, {ns}{name}{suffix}({next})nsr   r  nextr  c              3  F   >#    U  H  nTR                  U5      v   M     g 7fr/   r  r  s     r4   r   2C99CodePrinter._print_math_func.<locals>.<genexpr>  s     D)3dkk#..)r  z{ns}{name}{suffix}({args}))re  r   r  r#  )r   r   r>  r=  r>  r#  r]  	TypeErrorr  _prec_funcsr  r   r   ra  r   r  rb  )
r   r   nestr"  cbr   r  r#  
paren_pilecurr_args
   `         r4   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   ,A? ?>C ?C c                "    U R                  USS9$ NT)rk  r&  rP  s     r4   r  C99CodePrinter._print_Max      $$T$55r6   c                "    U R                  USS9$ rq  rr  rP  s     r4   r  C99CodePrinter._print_Min  rt  r6   c           
        / n/ nSnU Hz  nUR                  UU R                  UR                  5      U R                  UR                  5      U R                  UR                  S-   5      S.-  5        UR                  S5        M|     X#4$ )Nz8for (int %(var)s=%(start)s; %(var)s<%(end)s; %(var)s++){r   )r   r  endrY  )r`  r   rC  lowerupper)r   r<  
open_linesclose_lines	loopstartr   s         r4   _get_loop_opening_ending'C99CodePrinter._get_loop_opening_ending  s    
N	Ai{{177+QWW-{{177Q;/+1 1 2 s#  &&r6   r   )FN)r>  rJ  rK  rL  r  r   rP  reserved_words_c99r   r   r   r   r   r   r   r   known_functions_C99r   rQ  r  rj  rQ  rU  ra  r'   r   r&  r  r  r~  rU  r   r6   r4   rX  rX  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'r6   rX  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                  .    \ rS rSr\" S1S9S 5       rSrg)C11CodePrinteri  z
stdalign.hr  c                F    UR                   u  nSU R                  U5      -  $ )Nzalignof(%s)r   r!  s      r4   _print_alignofC11CodePrinter._print_alignof  s!    yyt{{3///r6   r   N)r>  rJ  rK  rL  r'   r  rU  r   r6   r4   r  r    s    |n%0 &0r6   r  )c89c99c11N)CrM  
__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,   rR  r   r  rP  r  r   r   r   rX  r  ksetattrr&  r  c_code_printersr   r6   r4   <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  , 
+ "J&e![ e!N\'^ \'~89>
AA NK!O^-L-LM
A0^ 0 r6   