(command.CommandList
  children: [
    (C {(Id.KW_Set set)} {(-e)})
    (command.CommandList
      children: [
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:common_objpfx)
                  op: assign_op.Equal
                  rhs: {(DQ ($ Id.VSub_Number '$1'))}
                  spids: [54]
                )
              ]
            )
          terminator: (Token id:Id.Op_Semi val:';' span_id:58)
        )
        (C {(shift)})
      ]
    )
    (command.CommandList
      children: [
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:localedef_before_env)
                  op: assign_op.Equal
                  rhs: {(DQ ($ Id.VSub_Number '$1'))}
                  spids: [62]
                )
              ]
            )
          terminator: (Token id:Id.Op_Semi val:';' span_id:66)
        )
        (C {(shift)})
      ]
    )
    (command.CommandList
      children: [
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:run_program_env)
                  op: assign_op.Equal
                  rhs: {(DQ ($ Id.VSub_Number '$1'))}
                  spids: [70]
                )
              ]
            )
          terminator: (Token id:Id.Op_Semi val:';' span_id:74)
        )
        (C {(shift)})
      ]
    )
    (command.CommandList
      children: [
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:localedef_after_env)
                  op: assign_op.Equal
                  rhs: {(DQ ($ Id.VSub_Number '$1'))}
                  spids: [78]
                )
              ]
            )
          terminator: (Token id:Id.Op_Semi val:';' span_id:82)
        )
        (C {(shift)})
      ]
    )
    (command.CommandList
      children: [
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:locfile)
                  op: assign_op.Equal
                  rhs: {(DQ ($ Id.VSub_Number '$1'))}
                  spids: [86]
                )
              ]
            )
          terminator: (Token id:Id.Op_Semi val:';' span_id:90)
        )
        (C {(shift)})
      ]
    )
    (command.ShFunction
      name: generate_locale
      body: 
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:charmap)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$1')}
                  spids: [103]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:input)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$2')}
                  spids: [107]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:out)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$3')}
                  spids: [111]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (C {(${ Id.VSub_Name localedef_before_env)} {(${ Id.VSub_Name run_program_env)} 
                      {(Id.Lit_VarLike 'I18NPATH=') (../localedata)} {(${ Id.VSub_Name localedef_after_env)} {(--quiet)} {(-c)} {(-f)} {($ Id.VSub_DollarName '$charmap')} 
                      {(-i)} {($ Id.VSub_DollarName '$input')} 
                      {(${ Id.VSub_Name common_objpfx) (localedata/) ($ Id.VSub_DollarName '$out')}
                    )
                  ]
                  action: [
                    (C {(touch)} 
                      {(${ Id.VSub_Name common_objpfx) (localedata/) ($ Id.VSub_DollarName '$out') 
                        (/LC_CTYPE)
                      }
                    )
                  ]
                  spids: [115 155]
                )
              ]
              else_action: [
                (C {(echo)} 
                  {
                    (DQ ('Charmap: ') 
                      (word_part.EscapedLiteral
                        token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:187)
                      ) (${ Id.VSub_Name charmap) 
                      (word_part.EscapedLiteral
                        token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:191)
                      ) (' Inputfile: ') (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\"' span_id:193)) 
                      (${ Id.VSub_Name input) (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\"' span_id:197))
                    )
                  } 
                  {
                    (DQ ('Outputdir: ') 
                      (word_part.EscapedLiteral
                        token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:204)
                      ) (${ Id.VSub_Name out) 
                      (word_part.EscapedLiteral
                        token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:208)
                      ) (' failed')
                    )
                  }
                )
                (command.ControlFlow
                  token: (Token id:Id.ControlFlow_Exit val:exit span_id:213)
                  arg_word: {(1)}
                )
              ]
            )
          ]
        )
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:locfile)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: (Token id:Id.Left_Backtick val:'`' span_id:224)
                command_list: 
                  (command.CommandList
                    children: [
                      (command.Pipeline
                        children: [
                          (C {(echo)} {($ Id.VSub_DollarName '$locfile')})
                          (C {(sed)} 
                            {
                              (SQ 
                                (Token
                                  id: Id.Lit_Chars
                                  val: 's|.*/\\([^/]*/LC_CTYPE\\)|\\1|'
                                  span_id: 240
                                )
                              )
                            }
                          )
                        ]
                        negated: F
                      )
                    ]
                  )
              )
            }
          spids: [223]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:locale)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: (Token id:Id.Left_Backtick val:'`' span_id:245)
                command_list: 
                  (command.CommandList
                    children: [
                      (command.Pipeline
                        children: [
                          (C {(echo)} {($ Id.VSub_DollarName '$locfile')})
                          (C {(sed)} 
                            {
                              (SQ 
                                (Token
                                  id: Id.Lit_Chars
                                  val: 's|\\([^.]*\\)[.].*/LC_CTYPE|\\1|'
                                  span_id: 261
                                )
                              )
                            }
                          )
                        ]
                        negated: F
                      )
                    ]
                  )
              )
            }
          spids: [244]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:charmap)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: (Token id:Id.Left_Backtick val:'`' span_id:266)
                command_list: 
                  (command.CommandList
                    children: [
                      (command.Pipeline
                        children: [
                          (C {(echo)} {($ Id.VSub_DollarName '$locfile')})
                          (C {(sed)} 
                            {
                              (SQ 
                                (Token
                                  id: Id.Lit_Chars
                                  val: 's|[^.]*[.]\\(.*\\)/LC_CTYPE|\\1|'
                                  span_id: 282
                                )
                              )
                            }
                          )
                        ]
                        negated: F
                      )
                    ]
                  )
              )
            }
          spids: [265]
        )
      ]
    )
    (C {(echo)} 
      {
        (DQ ('Generating locale ') ($ Id.VSub_DollarName '$locale') (.) 
          ($ Id.VSub_DollarName '$charmap') (': this might take a while...')
        )
      }
    )
    (C {(generate_locale)} 
      {
        (command_sub
          left_token: (Token id:Id.Left_Backtick val:'`' span_id:299)
          command_list: 
            (command.CommandList
              children: [
                (command.Pipeline
                  children: [
                    (C {(echo)} {($ Id.VSub_DollarName '$charmap')})
                    (C {(sed)} {(-e)} {(s/SJIS/SHIFT_JIS/)})
                  ]
                  negated: F
                )
              ]
            )
        )
      } {($ Id.VSub_DollarName '$locale')} 
      {($ Id.VSub_DollarName '$locale') (.) ($ Id.VSub_DollarName '$charmap')}
    )
  ]
)