#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void reverse(char* string, int len) {
  int half = len/2;
  int i;
  for(i=0; i<half; i++) {
    char temp;
    temp = string[i];
    string[i] = string[len-1-i];
    string[len-1-i] = temp;
  }
}

void make_string(char* string, char* half_left, char* half_right, int len_left, int len_right, int flag) {
  if(flag == -1) {
    reverse(half_right, len_right);
    printf("%s%s", half_right, half_left);
  } else {
    reverse(half_left, len_left);
    printf("%s%s", half_left, half_right);
  }
}

int main(void) {
  char s[100001];
  char half_left[200001];
  char half_right[300001];
  char str_q[7];
  int q;
  int i, flag;
  int len_left, len_right;
  char str_query[6];
  char query;
  len_left = len_right = 0;
  
  scanf("%s", half_right);
  len_right += strlen(half_right);
  scanf("%s", str_q);
  q = atoi(str_q);
  flag=1;
  
  for(i=0; i<q; i++) {
    scanf("%s", str_query);
    if(str_query[0] == '1') {
      flag *= -1;
    } else {
      scanf("%s", str_query);
      if((str_query[0] == '1' && flag==1) || (str_query[0] == '2' && flag == -1)) {
        scanf("%s", str_query);
        half_left[len_left] = str_query[0];
        len_left += 1;
      } else {
        scanf("%s", str_query);
        half_right[len_right] = str_query[0];
        len_right += 1;
      }
    }
  }
  
  make_string(s, half_left, half_right, len_left, len_right, flag);
  return 0;
}
   
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/ObjectiveC/Source_170/source.m'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/ObjectiveC/Source_170/source.m"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

@.str = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1

; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @reverse(ptr nocapture noundef %string, i32 noundef %len) local_unnamed_addr #0 {
entry:
  %cmp20 = icmp sgt i32 %len, 1
  br i1 %cmp20, label %for.body.preheader, label %for.end

for.body.preheader:                               ; preds = %entry
  %div2324 = lshr i32 %len, 1
  %wide.trip.count = zext i32 %div2324 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %0 = icmp eq i32 %div2324, 1
  br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new

for.body.preheader.new:                           ; preds = %for.body.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483646
  br label %for.body

for.body:                                         ; preds = %for.body, %for.body.preheader.new
  %indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.body ]
  %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ]
  %arrayidx = getelementptr inbounds i8, ptr %string, i64 %indvars.iv
  %1 = load i8, ptr %arrayidx, align 1, !tbaa !5
  %2 = trunc i64 %indvars.iv to i32
  %3 = xor i32 %2, -1
  %sub1 = add i32 %3, %len
  %idxprom2 = sext i32 %sub1 to i64
  %arrayidx3 = getelementptr inbounds i8, ptr %string, i64 %idxprom2
  %4 = load i8, ptr %arrayidx3, align 1, !tbaa !5
  store i8 %4, ptr %arrayidx, align 1, !tbaa !5
  store i8 %1, ptr %arrayidx3, align 1, !tbaa !5
  %indvars.iv.next = or i64 %indvars.iv, 1
  %arrayidx.1 = getelementptr inbounds i8, ptr %string, i64 %indvars.iv.next
  %5 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
  %6 = trunc i64 %indvars.iv.next to i32
  %7 = xor i32 %6, -1
  %sub1.1 = add i32 %7, %len
  %idxprom2.1 = sext i32 %sub1.1 to i64
  %arrayidx3.1 = getelementptr inbounds i8, ptr %string, i64 %idxprom2.1
  %8 = load i8, ptr %arrayidx3.1, align 1, !tbaa !5
  store i8 %8, ptr %arrayidx.1, align 1, !tbaa !5
  store i8 %5, ptr %arrayidx3.1, align 1, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body

for.end.loopexit.unr-lcssa:                       ; preds = %for.body, %for.body.preheader
  %indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %for.body ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %for.end, label %for.body.epil

for.body.epil:                                    ; preds = %for.end.loopexit.unr-lcssa
  %arrayidx.epil = getelementptr inbounds i8, ptr %string, i64 %indvars.iv.unr
  %9 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
  %10 = trunc i64 %indvars.iv.unr to i32
  %11 = xor i32 %10, -1
  %sub1.epil = add i32 %11, %len
  %idxprom2.epil = sext i32 %sub1.epil to i64
  %arrayidx3.epil = getelementptr inbounds i8, ptr %string, i64 %idxprom2.epil
  %12 = load i8, ptr %arrayidx3.epil, align 1, !tbaa !5
  store i8 %12, ptr %arrayidx.epil, align 1, !tbaa !5
  store i8 %9, ptr %arrayidx3.epil, align 1, !tbaa !5
  br label %for.end

for.end:                                          ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
  ret void
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nofree nounwind uwtable
define dso_local void @make_string(ptr nocapture noundef readnone %string, ptr noundef %half_left, ptr noundef %half_right, i32 noundef %len_left, i32 noundef %len_right, i32 noundef %flag) local_unnamed_addr #2 {
entry:
  %cmp = icmp eq i32 %flag, -1
  br i1 %cmp, label %if.then, label %if.else

if.then:                                          ; preds = %entry
  %cmp20.i = icmp sgt i32 %len_right, 1
  br i1 %cmp20.i, label %for.body.preheader.i, label %reverse.exit

for.body.preheader.i:                             ; preds = %if.then
  %div2324.i = lshr i32 %len_right, 1
  %wide.trip.count.i = zext i32 %div2324.i to i64
  %xtraiter19 = and i64 %wide.trip.count.i, 1
  %0 = icmp eq i32 %div2324.i, 1
  br i1 %0, label %reverse.exit.loopexit.unr-lcssa, label %for.body.preheader.i.new

for.body.preheader.i.new:                         ; preds = %for.body.preheader.i
  %unroll_iter21 = and i64 %wide.trip.count.i, 2147483646
  br label %for.body.i

for.body.i:                                       ; preds = %for.body.i, %for.body.preheader.i.new
  %indvars.iv.i = phi i64 [ 0, %for.body.preheader.i.new ], [ %indvars.iv.next.i.1, %for.body.i ]
  %niter22 = phi i64 [ 0, %for.body.preheader.i.new ], [ %niter22.next.1, %for.body.i ]
  %arrayidx.i = getelementptr inbounds i8, ptr %half_right, i64 %indvars.iv.i
  %1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
  %2 = trunc i64 %indvars.iv.i to i32
  %3 = xor i32 %2, -1
  %sub1.i = add i32 %3, %len_right
  %idxprom2.i = sext i32 %sub1.i to i64
  %arrayidx3.i = getelementptr inbounds i8, ptr %half_right, i64 %idxprom2.i
  %4 = load i8, ptr %arrayidx3.i, align 1, !tbaa !5
  store i8 %4, ptr %arrayidx.i, align 1, !tbaa !5
  store i8 %1, ptr %arrayidx3.i, align 1, !tbaa !5
  %indvars.iv.next.i = or i64 %indvars.iv.i, 1
  %arrayidx.i.1 = getelementptr inbounds i8, ptr %half_right, i64 %indvars.iv.next.i
  %5 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
  %6 = trunc i64 %indvars.iv.next.i to i32
  %7 = xor i32 %6, -1
  %sub1.i.1 = add i32 %7, %len_right
  %idxprom2.i.1 = sext i32 %sub1.i.1 to i64
  %arrayidx3.i.1 = getelementptr inbounds i8, ptr %half_right, i64 %idxprom2.i.1
  %8 = load i8, ptr %arrayidx3.i.1, align 1, !tbaa !5
  store i8 %8, ptr %arrayidx.i.1, align 1, !tbaa !5
  store i8 %5, ptr %arrayidx3.i.1, align 1, !tbaa !5
  %indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
  %niter22.next.1 = add i64 %niter22, 2
  %niter22.ncmp.1 = icmp eq i64 %niter22.next.1, %unroll_iter21
  br i1 %niter22.ncmp.1, label %reverse.exit.loopexit.unr-lcssa, label %for.body.i

reverse.exit.loopexit.unr-lcssa:                  ; preds = %for.body.i, %for.body.preheader.i
  %indvars.iv.i.unr = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i.1, %for.body.i ]
  %lcmp.mod20.not = icmp eq i64 %xtraiter19, 0
  br i1 %lcmp.mod20.not, label %reverse.exit, label %for.body.i.epil

for.body.i.epil:                                  ; preds = %reverse.exit.loopexit.unr-lcssa
  %arrayidx.i.epil = getelementptr inbounds i8, ptr %half_right, i64 %indvars.iv.i.unr
  %9 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
  %10 = trunc i64 %indvars.iv.i.unr to i32
  %11 = xor i32 %10, -1
  %sub1.i.epil = add i32 %11, %len_right
  %idxprom2.i.epil = sext i32 %sub1.i.epil to i64
  %arrayidx3.i.epil = getelementptr inbounds i8, ptr %half_right, i64 %idxprom2.i.epil
  %12 = load i8, ptr %arrayidx3.i.epil, align 1, !tbaa !5
  store i8 %12, ptr %arrayidx.i.epil, align 1, !tbaa !5
  store i8 %9, ptr %arrayidx3.i.epil, align 1, !tbaa !5
  br label %reverse.exit

reverse.exit:                                     ; preds = %for.body.i.epil, %reverse.exit.loopexit.unr-lcssa, %if.then
  %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef %half_right, ptr noundef %half_left)
  br label %if.end

if.else:                                          ; preds = %entry
  %cmp20.i6 = icmp sgt i32 %len_left, 1
  br i1 %cmp20.i6, label %for.body.preheader.i7, label %reverse.exit18

for.body.preheader.i7:                            ; preds = %if.else
  %div2324.i8 = lshr i32 %len_left, 1
  %wide.trip.count.i9 = zext i32 %div2324.i8 to i64
  %xtraiter = and i64 %wide.trip.count.i9, 1
  %13 = icmp eq i32 %div2324.i8, 1
  br i1 %13, label %reverse.exit18.loopexit.unr-lcssa, label %for.body.preheader.i7.new

for.body.preheader.i7.new:                        ; preds = %for.body.preheader.i7
  %unroll_iter = and i64 %wide.trip.count.i9, 2147483646
  br label %for.body.i10

for.body.i10:                                     ; preds = %for.body.i10, %for.body.preheader.i7.new
  %indvars.iv.i11 = phi i64 [ 0, %for.body.preheader.i7.new ], [ %indvars.iv.next.i16.1, %for.body.i10 ]
  %niter = phi i64 [ 0, %for.body.preheader.i7.new ], [ %niter.next.1, %for.body.i10 ]
  %arrayidx.i12 = getelementptr inbounds i8, ptr %half_left, i64 %indvars.iv.i11
  %14 = load i8, ptr %arrayidx.i12, align 1, !tbaa !5
  %15 = trunc i64 %indvars.iv.i11 to i32
  %16 = xor i32 %15, -1
  %sub1.i13 = add i32 %16, %len_left
  %idxprom2.i14 = sext i32 %sub1.i13 to i64
  %arrayidx3.i15 = getelementptr inbounds i8, ptr %half_left, i64 %idxprom2.i14
  %17 = load i8, ptr %arrayidx3.i15, align 1, !tbaa !5
  store i8 %17, ptr %arrayidx.i12, align 1, !tbaa !5
  store i8 %14, ptr %arrayidx3.i15, align 1, !tbaa !5
  %indvars.iv.next.i16 = or i64 %indvars.iv.i11, 1
  %arrayidx.i12.1 = getelementptr inbounds i8, ptr %half_left, i64 %indvars.iv.next.i16
  %18 = load i8, ptr %arrayidx.i12.1, align 1, !tbaa !5
  %19 = trunc i64 %indvars.iv.next.i16 to i32
  %20 = xor i32 %19, -1
  %sub1.i13.1 = add i32 %20, %len_left
  %idxprom2.i14.1 = sext i32 %sub1.i13.1 to i64
  %arrayidx3.i15.1 = getelementptr inbounds i8, ptr %half_left, i64 %idxprom2.i14.1
  %21 = load i8, ptr %arrayidx3.i15.1, align 1, !tbaa !5
  store i8 %21, ptr %arrayidx.i12.1, align 1, !tbaa !5
  store i8 %18, ptr %arrayidx3.i15.1, align 1, !tbaa !5
  %indvars.iv.next.i16.1 = add nuw nsw i64 %indvars.iv.i11, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %reverse.exit18.loopexit.unr-lcssa, label %for.body.i10

reverse.exit18.loopexit.unr-lcssa:                ; preds = %for.body.i10, %for.body.preheader.i7
  %indvars.iv.i11.unr = phi i64 [ 0, %for.body.preheader.i7 ], [ %indvars.iv.next.i16.1, %for.body.i10 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %reverse.exit18, label %for.body.i10.epil

for.body.i10.epil:                                ; preds = %reverse.exit18.loopexit.unr-lcssa
  %arrayidx.i12.epil = getelementptr inbounds i8, ptr %half_left, i64 %indvars.iv.i11.unr
  %22 = load i8, ptr %arrayidx.i12.epil, align 1, !tbaa !5
  %23 = trunc i64 %indvars.iv.i11.unr to i32
  %24 = xor i32 %23, -1
  %sub1.i13.epil = add i32 %24, %len_left
  %idxprom2.i14.epil = sext i32 %sub1.i13.epil to i64
  %arrayidx3.i15.epil = getelementptr inbounds i8, ptr %half_left, i64 %idxprom2.i14.epil
  %25 = load i8, ptr %arrayidx3.i15.epil, align 1, !tbaa !5
  store i8 %25, ptr %arrayidx.i12.epil, align 1, !tbaa !5
  store i8 %22, ptr %arrayidx3.i15.epil, align 1, !tbaa !5
  br label %reverse.exit18

reverse.exit18:                                   ; preds = %for.body.i10.epil, %reverse.exit18.loopexit.unr-lcssa, %if.else
  %call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef %half_left, ptr noundef %half_right)
  br label %if.end

if.end:                                           ; preds = %reverse.exit18, %reverse.exit
  ret void
}

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
  %half_left = alloca [200001 x i8], align 16
  %half_right = alloca [300001 x i8], align 16
  %str_q = alloca [7 x i8], align 1
  %str_query = alloca [6 x i8], align 1
  call void @llvm.lifetime.start.p0(i64 200001, ptr nonnull %half_left) #6
  call void @llvm.lifetime.start.p0(i64 300001, ptr nonnull %half_right) #6
  call void @llvm.lifetime.start.p0(i64 7, ptr nonnull %str_q) #6
  call void @llvm.lifetime.start.p0(i64 6, ptr nonnull %str_query) #6
  %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %half_right)
  %call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %half_right) #7
  %call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %str_q)
  %call.i = call i64 @strtol(ptr nocapture noundef nonnull %str_q, ptr noundef null, i32 noundef 10) #6
  %conv.i = trunc i64 %call.i to i32
  %cmp57 = icmp sgt i32 %conv.i, 0
  br i1 %cmp57, label %for.body.preheader, label %reverse.exit18.i

for.body.preheader:                               ; preds = %entry
  %conv3 = trunc i64 %call2 to i32
  br label %for.body

for.body:                                         ; preds = %for.body.preheader, %for.inc
  %i.061 = phi i32 [ %inc, %for.inc ], [ 0, %for.body.preheader ]
  %len_right.060 = phi i32 [ %len_right.1, %for.inc ], [ %conv3, %for.body.preheader ]
  %len_left.059 = phi i32 [ %len_left.1, %for.inc ], [ 0, %for.body.preheader ]
  %flag.058 = phi i32 [ %flag.1, %for.inc ], [ 1, %for.body.preheader ]
  %call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %str_query)
  %0 = load i8, ptr %str_query, align 1, !tbaa !5
  %cmp12 = icmp eq i8 %0, 49
  br i1 %cmp12, label %if.then, label %if.else

if.then:                                          ; preds = %for.body
  %mul = sub nsw i32 0, %flag.058
  br label %for.inc

if.else:                                          ; preds = %for.body
  %call15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %str_query)
  %1 = load i8, ptr %str_query, align 1, !tbaa !5
  %cmp18 = icmp eq i8 %1, 49
  %cmp20 = icmp eq i32 %flag.058, 1
  %or.cond = select i1 %cmp18, i1 %cmp20, i1 false
  br i1 %or.cond, label %if.then29, label %lor.lhs.false

lor.lhs.false:                                    ; preds = %if.else
  %cmp24 = icmp eq i8 %1, 50
  %cmp27 = icmp eq i32 %flag.058, -1
  %or.cond46 = select i1 %cmp24, i1 %cmp27, i1 false
  br i1 %or.cond46, label %if.then29, label %if.else35

if.then29:                                        ; preds = %lor.lhs.false, %if.else
  %call31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %str_query)
  %2 = load i8, ptr %str_query, align 1, !tbaa !5
  %idxprom = sext i32 %len_left.059 to i64
  %arrayidx33 = getelementptr inbounds [200001 x i8], ptr %half_left, i64 0, i64 %idxprom
  store i8 %2, ptr %arrayidx33, align 1, !tbaa !5
  %add34 = add nsw i32 %len_left.059, 1
  br label %for.inc

if.else35:                                        ; preds = %lor.lhs.false
  %call37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %str_query)
  %3 = load i8, ptr %str_query, align 1, !tbaa !5
  %idxprom39 = sext i32 %len_right.060 to i64
  %arrayidx40 = getelementptr inbounds [300001 x i8], ptr %half_right, i64 0, i64 %idxprom39
  store i8 %3, ptr %arrayidx40, align 1, !tbaa !5
  %add41 = add nsw i32 %len_right.060, 1
  br label %for.inc

for.inc:                                          ; preds = %if.then, %if.else35, %if.then29
  %flag.1 = phi i32 [ %mul, %if.then ], [ %flag.058, %if.then29 ], [ %flag.058, %if.else35 ]
  %len_left.1 = phi i32 [ %len_left.059, %if.then ], [ %add34, %if.then29 ], [ %len_left.059, %if.else35 ]
  %len_right.1 = phi i32 [ %len_right.060, %if.then ], [ %len_right.060, %if.then29 ], [ %add41, %if.else35 ]
  %inc = add nuw nsw i32 %i.061, 1
  %exitcond.not = icmp eq i32 %inc, %conv.i
  br i1 %exitcond.not, label %for.end, label %for.body

for.end:                                          ; preds = %for.inc
  %4 = icmp eq i32 %flag.1, -1
  br i1 %4, label %if.then.i, label %if.else.i

if.then.i:                                        ; preds = %for.end
  %cmp20.i.i = icmp sgt i32 %len_right.1, 1
  br i1 %cmp20.i.i, label %for.body.preheader.i.i, label %reverse.exit.i

for.body.preheader.i.i:                           ; preds = %if.then.i
  %div2324.i.i = lshr i32 %len_right.1, 1
  %wide.trip.count.i.i = zext i32 %div2324.i.i to i64
  %xtraiter70 = and i64 %wide.trip.count.i.i, 1
  %5 = icmp eq i32 %div2324.i.i, 1
  br i1 %5, label %reverse.exit.i.loopexit.unr-lcssa, label %for.body.preheader.i.i.new

for.body.preheader.i.i.new:                       ; preds = %for.body.preheader.i.i
  %unroll_iter72 = and i64 %wide.trip.count.i.i, 2147483646
  br label %for.body.i.i

for.body.i.i:                                     ; preds = %for.body.i.i, %for.body.preheader.i.i.new
  %indvars.iv.i.i = phi i64 [ 0, %for.body.preheader.i.i.new ], [ %indvars.iv.next.i.i.1, %for.body.i.i ]
  %niter73 = phi i64 [ 0, %for.body.preheader.i.i.new ], [ %niter73.next.1, %for.body.i.i ]
  %arrayidx.i.i = getelementptr inbounds i8, ptr %half_right, i64 %indvars.iv.i.i
  %6 = load i8, ptr %arrayidx.i.i, align 2, !tbaa !5
  %7 = trunc i64 %indvars.iv.i.i to i32
  %8 = xor i32 %7, -1
  %sub1.i.i = add i32 %len_right.1, %8
  %idxprom2.i.i = sext i32 %sub1.i.i to i64
  %arrayidx3.i.i = getelementptr inbounds i8, ptr %half_right, i64 %idxprom2.i.i
  %9 = load i8, ptr %arrayidx3.i.i, align 1, !tbaa !5
  store i8 %9, ptr %arrayidx.i.i, align 2, !tbaa !5
  store i8 %6, ptr %arrayidx3.i.i, align 1, !tbaa !5
  %indvars.iv.next.i.i = or i64 %indvars.iv.i.i, 1
  %arrayidx.i.i.1 = getelementptr inbounds i8, ptr %half_right, i64 %indvars.iv.next.i.i
  %10 = load i8, ptr %arrayidx.i.i.1, align 1, !tbaa !5
  %11 = trunc i64 %indvars.iv.next.i.i to i32
  %12 = xor i32 %11, -1
  %sub1.i.i.1 = add i32 %len_right.1, %12
  %idxprom2.i.i.1 = sext i32 %sub1.i.i.1 to i64
  %arrayidx3.i.i.1 = getelementptr inbounds i8, ptr %half_right, i64 %idxprom2.i.i.1
  %13 = load i8, ptr %arrayidx3.i.i.1, align 1, !tbaa !5
  store i8 %13, ptr %arrayidx.i.i.1, align 1, !tbaa !5
  store i8 %10, ptr %arrayidx3.i.i.1, align 1, !tbaa !5
  %indvars.iv.next.i.i.1 = add nuw nsw i64 %indvars.iv.i.i, 2
  %niter73.next.1 = add i64 %niter73, 2
  %niter73.ncmp.1 = icmp eq i64 %niter73.next.1, %unroll_iter72
  br i1 %niter73.ncmp.1, label %reverse.exit.i.loopexit.unr-lcssa, label %for.body.i.i

reverse.exit.i.loopexit.unr-lcssa:                ; preds = %for.body.i.i, %for.body.preheader.i.i
  %indvars.iv.i.i.unr = phi i64 [ 0, %for.body.preheader.i.i ], [ %indvars.iv.next.i.i.1, %for.body.i.i ]
  %lcmp.mod71.not = icmp eq i64 %xtraiter70, 0
  br i1 %lcmp.mod71.not, label %reverse.exit.i, label %for.body.i.i.epil

for.body.i.i.epil:                                ; preds = %reverse.exit.i.loopexit.unr-lcssa
  %arrayidx.i.i.epil = getelementptr inbounds i8, ptr %half_right, i64 %indvars.iv.i.i.unr
  %14 = load i8, ptr %arrayidx.i.i.epil, align 1, !tbaa !5
  %15 = trunc i64 %indvars.iv.i.i.unr to i32
  %16 = xor i32 %15, -1
  %sub1.i.i.epil = add i32 %len_right.1, %16
  %idxprom2.i.i.epil = sext i32 %sub1.i.i.epil to i64
  %arrayidx3.i.i.epil = getelementptr inbounds i8, ptr %half_right, i64 %idxprom2.i.i.epil
  %17 = load i8, ptr %arrayidx3.i.i.epil, align 1, !tbaa !5
  store i8 %17, ptr %arrayidx.i.i.epil, align 1, !tbaa !5
  store i8 %14, ptr %arrayidx3.i.i.epil, align 1, !tbaa !5
  br label %reverse.exit.i

reverse.exit.i:                                   ; preds = %for.body.i.i.epil, %reverse.exit.i.loopexit.unr-lcssa, %if.then.i
  %call.i56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %half_right, ptr noundef nonnull %half_left)
  br label %make_string.exit

if.else.i:                                        ; preds = %for.end
  %cmp20.i6.i = icmp sgt i32 %len_left.1, 1
  br i1 %cmp20.i6.i, label %for.body.preheader.i7.i, label %reverse.exit18.i

for.body.preheader.i7.i:                          ; preds = %if.else.i
  %div2324.i8.i = lshr i32 %len_left.1, 1
  %wide.trip.count.i9.i = zext i32 %div2324.i8.i to i64
  %xtraiter = and i64 %wide.trip.count.i9.i, 1
  %18 = icmp eq i32 %div2324.i8.i, 1
  br i1 %18, label %reverse.exit18.i.loopexit.unr-lcssa, label %for.body.preheader.i7.i.new

for.body.preheader.i7.i.new:                      ; preds = %for.body.preheader.i7.i
  %unroll_iter = and i64 %wide.trip.count.i9.i, 2147483646
  br label %for.body.i10.i

for.body.i10.i:                                   ; preds = %for.body.i10.i, %for.body.preheader.i7.i.new
  %indvars.iv.i11.i = phi i64 [ 0, %for.body.preheader.i7.i.new ], [ %indvars.iv.next.i16.i.1, %for.body.i10.i ]
  %niter = phi i64 [ 0, %for.body.preheader.i7.i.new ], [ %niter.next.1, %for.body.i10.i ]
  %arrayidx.i12.i = getelementptr inbounds i8, ptr %half_left, i64 %indvars.iv.i11.i
  %19 = load i8, ptr %arrayidx.i12.i, align 2, !tbaa !5
  %20 = trunc i64 %indvars.iv.i11.i to i32
  %21 = xor i32 %20, -1
  %sub1.i13.i = add i32 %len_left.1, %21
  %idxprom2.i14.i = sext i32 %sub1.i13.i to i64
  %arrayidx3.i15.i = getelementptr inbounds i8, ptr %half_left, i64 %idxprom2.i14.i
  %22 = load i8, ptr %arrayidx3.i15.i, align 1, !tbaa !5
  store i8 %22, ptr %arrayidx.i12.i, align 2, !tbaa !5
  store i8 %19, ptr %arrayidx3.i15.i, align 1, !tbaa !5
  %indvars.iv.next.i16.i = or i64 %indvars.iv.i11.i, 1
  %arrayidx.i12.i.1 = getelementptr inbounds i8, ptr %half_left, i64 %indvars.iv.next.i16.i
  %23 = load i8, ptr %arrayidx.i12.i.1, align 1, !tbaa !5
  %24 = trunc i64 %indvars.iv.next.i16.i to i32
  %25 = xor i32 %24, -1
  %sub1.i13.i.1 = add i32 %len_left.1, %25
  %idxprom2.i14.i.1 = sext i32 %sub1.i13.i.1 to i64
  %arrayidx3.i15.i.1 = getelementptr inbounds i8, ptr %half_left, i64 %idxprom2.i14.i.1
  %26 = load i8, ptr %arrayidx3.i15.i.1, align 1, !tbaa !5
  store i8 %26, ptr %arrayidx.i12.i.1, align 1, !tbaa !5
  store i8 %23, ptr %arrayidx3.i15.i.1, align 1, !tbaa !5
  %indvars.iv.next.i16.i.1 = add nuw nsw i64 %indvars.iv.i11.i, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %reverse.exit18.i.loopexit.unr-lcssa, label %for.body.i10.i

reverse.exit18.i.loopexit.unr-lcssa:              ; preds = %for.body.i10.i, %for.body.preheader.i7.i
  %indvars.iv.i11.i.unr = phi i64 [ 0, %for.body.preheader.i7.i ], [ %indvars.iv.next.i16.i.1, %for.body.i10.i ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %reverse.exit18.i, label %for.body.i10.i.epil

for.body.i10.i.epil:                              ; preds = %reverse.exit18.i.loopexit.unr-lcssa
  %arrayidx.i12.i.epil = getelementptr inbounds i8, ptr %half_left, i64 %indvars.iv.i11.i.unr
  %27 = load i8, ptr %arrayidx.i12.i.epil, align 1, !tbaa !5
  %28 = trunc i64 %indvars.iv.i11.i.unr to i32
  %29 = xor i32 %28, -1
  %sub1.i13.i.epil = add i32 %len_left.1, %29
  %idxprom2.i14.i.epil = sext i32 %sub1.i13.i.epil to i64
  %arrayidx3.i15.i.epil = getelementptr inbounds i8, ptr %half_left, i64 %idxprom2.i14.i.epil
  %30 = load i8, ptr %arrayidx3.i15.i.epil, align 1, !tbaa !5
  store i8 %30, ptr %arrayidx.i12.i.epil, align 1, !tbaa !5
  store i8 %27, ptr %arrayidx3.i15.i.epil, align 1, !tbaa !5
  br label %reverse.exit18.i

reverse.exit18.i:                                 ; preds = %for.body.i10.i.epil, %reverse.exit18.i.loopexit.unr-lcssa, %entry, %if.else.i
  %call1.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %half_left, ptr noundef nonnull %half_right)
  br label %make_string.exit

make_string.exit:                                 ; preds = %reverse.exit.i, %reverse.exit18.i
  call void @llvm.lifetime.end.p0(i64 6, ptr nonnull %str_query) #6
  call void @llvm.lifetime.end.p0(i64 7, ptr nonnull %str_q) #6
  call void @llvm.lifetime.end.p0(i64 300001, ptr nonnull %half_right) #6
  call void @llvm.lifetime.end.p0(i64 200001, ptr nonnull %half_left) #6
  ret i32 0
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #5

attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }

!llvm.linker.options = !{}
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
