(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: <Id.Op_Semi _>
        )
        (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: <Id.Op_Semi _>
        )
        (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: <Id.Op_Semi _>
        )
        (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: <Id.Op_Semi _>
        )
        (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: <Id.Op_Semi _>
        )
        (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:<Id.Lit_EscapedChar '\\"'>) 
                      (${ Id.VSub_Name charmap) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) <' Inputfile: '> 
                      (word_part.EscapedLiteral
                        token: <Id.Lit_EscapedChar '\\"'>
                      ) (${ Id.VSub_Name input) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>)
                    )
                  } 
                  {
                    (DQ <'Outputdir: '> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) 
                      (${ Id.VSub_Name out) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) <' failed'>
                    )
                  }
                )
                (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
              ]
            )
          ]
        )
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:locfile)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: <Id.Left_Backtick '`'>
                command_list: 
                  (command.CommandList
                    children: [
                      (command.Pipeline
                        children: [
                          (C {<echo>} {($ Id.VSub_DollarName '$locfile')})
                          (C {<sed>} {(SQ <'s|.*/\\([^/]*/LC_CTYPE\\)|\\1|'>)})
                        ]
                        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: <Id.Left_Backtick '`'>
                command_list: 
                  (command.CommandList
                    children: [
                      (command.Pipeline
                        children: [
                          (C {<echo>} {($ Id.VSub_DollarName '$locfile')})
                          (C {<sed>} {(SQ <'s|\\([^.]*\\)[.].*/LC_CTYPE|\\1|'>)})
                        ]
                        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: <Id.Left_Backtick '`'>
                command_list: 
                  (command.CommandList
                    children: [
                      (command.Pipeline
                        children: [
                          (C {<echo>} {($ Id.VSub_DollarName '$locfile')})
                          (C {<sed>} {(SQ <'s|[^.]*[.]\\(.*\\)/LC_CTYPE|\\1|'>)})
                        ]
                        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: <Id.Left_Backtick '`'>
          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')}
    )
  ]
)