#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(void) {
  char acNames[20][30], cTemp[30], cKeyName[30];
  int iNum, i, j, k, iPos, iLow, iHigh, iMid, iFound;
  printf("\nEnter no of names\n");
  scanf("%d", &iNum);
  printf("\nEnter %d names\n", iNum);
  for (i = 0; i < iNum; i++)
    gets(acNames[i]);
  for (i = 0; i < iNum; i++) {
    for (j = i + 1; j < iNum; j++) {
      if (strcmp(acNames[i], acNames[j]) > 0) {
        strcpy(cTemp, acNames[i]);
        strcpy(acNames[i], acNames[j]);
        strcpy(acNames[j], cTemp);
      }
    }
  }
  printf("\nThe names in sorted form \n");
  for (i = 0; i < iNum; i++)
    printf("%s\n", acNames[i]);
  printf("\n");
  printf("\nEnter the name you want to search\n");
  scanf("%d", &cKeyName);
  iFound = 0;
  iLow = 0;
  iHigh = iNum - 1;
  while (iLow <= iHigh) {
    iMid = (iLow + iHigh) / 2;
    if (strcmp(cKeyName, acNames[iMid]) == 0) {
      iPos = iMid;
      iFound = 1;
      break;
    } else if (strcmp(cKeyName, acNames[iMid]) < 0)
      iHigh = iMid - 1;
    else
      iLow = iMid + 1;
  }
  if (iFound)
    printf("\nKey name %s found at position %d\n", cKeyName, iPos + 1);
  else
    printf("\nKey element not found\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2d0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe9d(%rip),%rdi
lea    -0x2a4(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
mov    -0x2a4(%rbp),%esi
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x2a8(%rbp)
mov    -0x2a8(%rbp),%eax
cmp    -0x2a4(%rbp),%eax
jge    11e3 <main+0x93>
movslq -0x2a8(%rbp),%rax
lea    -0x260(%rbp),%rdi
imul   $0x1e,%rax,%rax
add    %rax,%rdi
call   1060 <gets@plt>
mov    -0x2a8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2a8(%rbp)
jmp    11a3 <main+0x53>
movl   $0x0,-0x2a8(%rbp)
mov    -0x2a8(%rbp),%eax
cmp    -0x2a4(%rbp),%eax
jge    12fc <main+0x1ac>
mov    -0x2a8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2ac(%rbp)
mov    -0x2ac(%rbp),%eax
cmp    -0x2a4(%rbp),%eax
jge    12e3 <main+0x193>
movslq -0x2a8(%rbp),%rax
lea    -0x260(%rbp),%rdi
imul   $0x1e,%rax,%rax
add    %rax,%rdi
movslq -0x2ac(%rbp),%rax
lea    -0x260(%rbp),%rsi
imul   $0x1e,%rax,%rax
add    %rax,%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jle    12ca <main+0x17a>
lea    -0x280(%rbp),%rdi
movslq -0x2a8(%rbp),%rax
lea    -0x260(%rbp),%rsi
imul   $0x1e,%rax,%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
movslq -0x2a8(%rbp),%rax
lea    -0x260(%rbp),%rdi
imul   $0x1e,%rax,%rax
add    %rax,%rdi
movslq -0x2ac(%rbp),%rax
lea    -0x260(%rbp),%rsi
imul   $0x1e,%rax,%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
movslq -0x2ac(%rbp),%rax
lea    -0x260(%rbp),%rdi
imul   $0x1e,%rax,%rax
add    %rax,%rdi
lea    -0x280(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    12cf <main+0x17f>
mov    -0x2ac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2ac(%rbp)
jmp    120e <main+0xbe>
jmp    12e8 <main+0x198>
mov    -0x2a8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2a8(%rbp)
jmp    11ed <main+0x9d>
lea    0xd25(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x2a8(%rbp)
mov    -0x2a8(%rbp),%eax
cmp    -0x2a4(%rbp),%eax
jge    135d <main+0x20d>
movslq -0x2a8(%rbp),%rax
lea    -0x260(%rbp),%rsi
imul   $0x1e,%rax,%rax
add    %rax,%rsi
lea    0xd02(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x2a8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2a8(%rbp)
jmp    1314 <main+0x1c4>
lea    0xcde(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xcd6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xc94(%rip),%rdi
lea    -0x2a0(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
movl   $0x0,-0x2c4(%rbp)
movl   $0x0,-0x2b8(%rbp)
mov    -0x2a4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x2bc(%rbp)
mov    -0x2b8(%rbp),%eax
cmp    -0x2bc(%rbp),%eax
jg     147b <main+0x32b>
mov    -0x2b8(%rbp),%eax
add    -0x2bc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x2c0(%rbp)
lea    -0x2a0(%rbp),%rdi
movslq -0x2c0(%rbp),%rax
lea    -0x260(%rbp),%rsi
imul   $0x1e,%rax,%rax
add    %rax,%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1423 <main+0x2d3>
mov    -0x2c0(%rbp),%eax
mov    %eax,-0x2b4(%rbp)
movl   $0x1,-0x2c4(%rbp)
jmp    147b <main+0x32b>
lea    -0x2a0(%rbp),%rdi
movslq -0x2c0(%rbp),%rax
lea    -0x260(%rbp),%rsi
imul   $0x1e,%rax,%rax
add    %rax,%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jge    1462 <main+0x312>
mov    -0x2c0(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x2bc(%rbp)
jmp    1471 <main+0x321>
mov    -0x2c0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2b8(%rbp)
jmp    1476 <main+0x326>
jmp    13b1 <main+0x261>
cmpl   $0x0,-0x2c4(%rbp)
je     14ab <main+0x35b>
lea    -0x2a0(%rbp),%rsi
mov    -0x2b4(%rbp),%edx
add    $0x1,%edx
lea    0xbcd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    14b9 <main+0x369>
lea    0xbdd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x2d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2a8,%rsp
lea    0xeaf(%rip),%rdi
call   1050 <puts@plt>
lea    0xe6c(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
mov    0x4(%rsp),%esi
lea    0xe58(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
cmpl   $0x0,0x4(%rsp)
jle    12a4 <main+0x134>
lea    0x50(%rsp),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
call   1080 <gets@plt>
add    $0x1,%rbp
movslq 0x4(%rsp),%rax
add    $0x1e,%rbx
cmp    %rax,%rbp
jl     11d0 <main+0x60>
test   %eax,%eax
jle    12a4 <main+0x134>
lea    0x6e(%rsp),%r15
mov    $0x1,%r13d
xor    %esi,%esi
lea    0x30(%rsp),%r14
jmp    1225 <main+0xb5>
cs nopw 0x0(%rax,%rax,1)
movslq %eax,%rdx
mov    0x8(%rsp),%rsi
add    $0x1e,%r15
add    $0x1,%r13d
cmp    %rdx,%rsi
jge    12a4 <main+0x134>
mov    %rsi,%rcx
add    $0x1,%rsi
movslq %eax,%rdx
cmp    %rdx,%rsi
jge    1218 <main+0xa8>
mov    %rsi,0x8(%rsp)
mov    %rcx,%rax
shl    $0x5,%rax
sub    %rcx,%rax
sub    %rcx,%rax
lea    (%rsp,%rax,1),%rbp
add    $0x50,%rbp
mov    %r13d,%r12d
mov    %r15,%rbx
jmp    1271 <main+0x101>
cs nopw 0x0(%rax,%rax,1)
mov    0x4(%rsp),%eax
add    $0x1e,%rbx
add    $0x1,%r12d
cmp    %r12d,%eax
jle    1210 <main+0xa0>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jle    1260 <main+0xf0>
mov    %r14,%rdi
mov    %rbp,%rsi
call   1040 <strcpy@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
jmp    1260 <main+0xf0>
lea    0xd9f(%rip),%rdi
call   1050 <puts@plt>
cmpl   $0x0,0x4(%rsp)
jle    12da <main+0x16a>
lea    0x50(%rsp),%rbx
xor    %ebp,%ebp
xchg   %ax,%ax
mov    %rbx,%rdi
call   1050 <puts@plt>
add    $0x1,%rbp
movslq 0x4(%rsp),%rax
add    $0x1e,%rbx
cmp    %rax,%rbp
jl     12c0 <main+0x150>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd7a(%rip),%rdi
call   1050 <puts@plt>
lea    0xd09(%rip),%rdi
xor    %r15d,%r15d
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
mov    0x4(%rsp),%r12d
test   %r12d,%r12d
jle    137b <main+0x20b>
add    $0xffffffff,%r12d
lea    0x10(%rsp),%r14
jmp    132b <main+0x1bb>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
mov    %ebp,%r15d
cmp    %r12d,%r15d
jg     137b <main+0x20b>
lea    (%r12,%r15,1),%eax
mov    %eax,%ebp
shr    $0x1f,%ebp
add    %eax,%ebp
sar    %ebp
movslq %ebp,%rax
mov    %rax,%rcx
shl    $0x5,%rcx
sub    %rax,%rcx
sub    %rax,%rcx
lea    (%rsp,%rcx,1),%rbx
add    $0x50,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1389 <main+0x219>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jns    1320 <main+0x1b0>
add    $0xffffffff,%ebp
mov    %ebp,%r12d
cmp    %r12d,%r15d
jle    132b <main+0x1bb>
lea    0xd06(%rip),%rdi
call   1050 <puts@plt>
jmp    13a1 <main+0x231>
add    $0x1,%ebp
lea    0xc81(%rip),%rdi
lea    0x10(%rsp),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x2a8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"\0AEnter no of names\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [17 x i8] c"\0AEnter %d names\0A\00"
@.str.3 = [28 x i8] c"\0AThe names in sorted form \0A\00"
@.str.4 = [4 x i8] c"%s\0A\00"
@.str.5 = [2 x i8] c"\0A\00"
@.str.6 = [36 x i8] c"\0AEnter the name you want to search\0A\00"
@.str.7 = [35 x i8] c"\0AKey name %s found at position %d\0A\00"
@.str.8 = [24 x i8] c"\0AKey element not found\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x [30 x i8]]
%3 = alloca [30 x i8]
%4 = alloca [30 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %1
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%16 = load i32, i32* %5
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %16)
store i32 0, i32* %6
br label %18
18: ; preds = %28, %0
%19 = load i32, i32* %6
%20 = load i32, i32* %5
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %31
22: ; preds = %18
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [20 x [30 x i8]], [20 x [30 x i8]]* %2, i64 0, i64 %24
%26 = getelementptr inbounds [30 x i8], [30 x i8]* %25, i64 0, i64 0
%27 = call i32 @gets(i8* %26)
br label %28
28: ; preds = %22
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 1
store i32 %30, i32* %6
br label %18
31: ; preds = %18
store i32 0, i32* %6
br label %32
32: ; preds = %81, %31
%33 = load i32, i32* %6
%34 = load i32, i32* %5
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %84
36: ; preds = %32
%37 = load i32, i32* %6
%38 = add nsw i32 %37, 1
store i32 %38, i32* %7
br label %39
39: ; preds = %77, %36
%40 = load i32, i32* %7
%41 = load i32, i32* %5
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %80
43: ; preds = %39
%44 = load i32, i32* %6
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [20 x [30 x i8]], [20 x [30 x i8]]* %2, i64 0, i64 %45
%47 = getelementptr inbounds [30 x i8], [30 x i8]* %46, i64 0, i64 0
%48 = load i32, i32* %7
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [20 x [30 x i8]], [20 x [30 x i8]]* %2, i64 0, i64 %49
%51 = getelementptr inbounds [30 x i8], [30 x i8]* %50, i64 0, i64 0
%52 = call i64 @strcmp(i8* %47, i8* %51)
%53 = icmp sgt i64 %52, 0
br i1 %53, label %54, label %76
54: ; preds = %43
%55 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%56 = load i32, i32* %6
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [20 x [30 x i8]], [20 x [30 x i8]]* %2, i64 0, i64 %57
%59 = getelementptr inbounds [30 x i8], [30 x i8]* %58, i64 0, i64 0
%60 = call i32 @strcpy(i8* %55, i8* %59)
%61 = load i32, i32* %6
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [20 x [30 x i8]], [20 x [30 x i8]]* %2, i64 0, i64 %62
%64 = getelementptr inbounds [30 x i8], [30 x i8]* %63, i64 0, i64 0
%65 = load i32, i32* %7
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [20 x [30 x i8]], [20 x [30 x i8]]* %2, i64 0, i64 %66
%68 = getelementptr inbounds [30 x i8], [30 x i8]* %67, i64 0, i64 0
%69 = call i32 @strcpy(i8* %64, i8* %68)
%70 = load i32, i32* %7
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [20 x [30 x i8]], [20 x [30 x i8]]* %2, i64 0, i64 %71
%73 = getelementptr inbounds [30 x i8], [30 x i8]* %72, i64 0, i64 0
%74 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%75 = call i32 @strcpy(i8* %73, i8* %74)
br label %76
76: ; preds = %54, %43
br label %77
77: ; preds = %76
%78 = load i32, i32* %7
%79 = add nsw i32 %78, 1
store i32 %79, i32* %7
br label %39
80: ; preds = %39
br label %81
81: ; preds = %80
%82 = load i32, i32* %6
%83 = add nsw i32 %82, 1
store i32 %83, i32* %6
br label %32
84: ; preds = %32
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %6
br label %86
86: ; preds = %96, %84
%87 = load i32, i32* %6
%88 = load i32, i32* %5
%89 = icmp slt i32 %87, %88
br i1 %89, label %90, label %99
90: ; preds = %86
%91 = load i32, i32* %6
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds [20 x [30 x i8]], [20 x [30 x i8]]* %2, i64 0, i64 %92
%94 = getelementptr inbounds [30 x i8], [30 x i8]* %93, i64 0, i64 0
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %94)
br label %96
96: ; preds = %90
%97 = load i32, i32* %6
%98 = add nsw i32 %97, 1
store i32 %98, i32* %6
br label %86
99: ; preds = %86
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0))
%102 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), [30 x i8]* %4)
store i32 0, i32* %13
store i32 0, i32* %10
%103 = load i32, i32* %5
%104 = sub nsw i32 %103, 1
store i32 %104, i32* %11
br label %105
105: ; preds = %138, %99
%106 = load i32, i32* %10
%107 = load i32, i32* %11
%108 = icmp sle i32 %106, %107
br i1 %108, label %109, label %139
109: ; preds = %105
%110 = load i32, i32* %10
%111 = load i32, i32* %11
%112 = add nsw i32 %110, %111
%113 = sdiv i32 %112, 2
store i32 %113, i32* %12
%114 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%115 = load i32, i32* %12
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds [20 x [30 x i8]], [20 x [30 x i8]]* %2, i64 0, i64 %116
%118 = getelementptr inbounds [30 x i8], [30 x i8]* %117, i64 0, i64 0
%119 = call i64 @strcmp(i8* %114, i8* %118)
%120 = icmp eq i64 %119, 0
br i1 %120, label %121, label %123
121: ; preds = %109
%122 = load i32, i32* %12
store i32 %122, i32* %9
store i32 1, i32* %13
br label %139
123: ; preds = %109
%124 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%125 = load i32, i32* %12
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds [20 x [30 x i8]], [20 x [30 x i8]]* %2, i64 0, i64 %126
%128 = getelementptr inbounds [30 x i8], [30 x i8]* %127, i64 0, i64 0
%129 = call i64 @strcmp(i8* %124, i8* %128)
%130 = icmp slt i64 %129, 0
br i1 %130, label %131, label %134
131: ; preds = %123
%132 = load i32, i32* %12
%133 = sub nsw i32 %132, 1
store i32 %133, i32* %11
br label %137
134: ; preds = %123
%135 = load i32, i32* %12
%136 = add nsw i32 %135, 1
store i32 %136, i32* %10
br label %137
137: ; preds = %134, %131
br label %138
138: ; preds = %137
br label %105
139: ; preds = %121, %105
%140 = load i32, i32* %13
%141 = icmp ne i32 %140, 0
br i1 %141, label %142, label %147
142: ; preds = %139
%143 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%144 = load i32, i32* %9
%145 = add nsw i32 %144, 1
%146 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i8* %143, i32 %145)
br label %149
147: ; preds = %139
%148 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0))
br label %149
149: ; preds = %147, %142
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [17 x i8] c"\0AEnter %d names\0A\00"
@.str.7 = [35 x i8] c"\0AKey name %s found at position %d\0A\00"
@str = [19 x i8] c"\0AEnter no of names\00"
@str.9 = [27 x i8] c"\0AThe names in sorted form \00"
@str.10 = [35 x i8] c"\0AEnter the name you want to search\00"
@str.11 = [23 x i8] c"\0AKey element not found\00"
define i32 @main() {
%1 = alloca [20 x [30 x i8]]
%2 = alloca [30 x i8]
%3 = alloca [30 x i8]
%4 = alloca i32
%5 = getelementptr inbounds [20 x [30 x i8]], [20 x [30 x i8]]* %1, i64 0, i64 0, i64 0
%6 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%8 = bitcast i32* %4 to i8*
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%11 = load i32, i32* %4
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %4
%14 = icmp sgt i32 %13, 0
br i1 %14, label %17, label %55
15: ; preds = %17
%16 = icmp sgt i32 %22, 0
br i1 %16, label %32, label %55
17: ; preds = %0, %17
%18 = phi i64 [ %21, %17 ], [ 0, %0 ]
%19 = getelementptr inbounds [20 x [30 x i8]], [20 x [30 x i8]]* %1, i64 0, i64 %18, i64 0
%20 = call i32 @gets(i8* %19)
%21 = add nuw nsw i64 %18, 1
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = icmp slt i64 %21, %23
br i1 %24, label %17, label %15
25: ; preds = %50
%26 = sext i32 %52 to i64
br label %27
27: ; preds = %25, %32
%28 = phi i64 [ %26, %25 ], [ %37, %32 ]
%29 = phi i32 [ %52, %25 ], [ %33, %32 ]
%30 = icmp slt i64 %36, %28
%31 = add nuw nsw i64 %35, 1
br i1 %30, label %32, label %55
32: ; preds = %15, %27
%33 = phi i32 [ %29, %27 ], [ %22, %15 ]
%34 = phi i64 [ %36, %27 ], [ 0, %15 ]
%35 = phi i64 [ %31, %27 ], [ 1, %15 ]
%36 = add nuw nsw i64 %34, 1
%37 = sext i32 %33 to i64
%38 = icmp slt i64 %36, %37
br i1 %38, label %39, label %27
39: ; preds = %32
%40 = getelementptr inbounds [20 x [30 x i8]], [20 x [30 x i8]]* %1, i64 0, i64 %34, i64 0
br label %41
41: ; preds = %39, %50
%42 = phi i64 [ %35, %39 ], [ %51, %50 ]
%43 = getelementptr inbounds [20 x [30 x i8]], [20 x [30 x i8]]* %1, i64 0, i64 %42, i64 0
%44 = call i64 @strcmp(i8* %40, i8* %43)
%45 = icmp sgt i64 %44, 0
br i1 %45, label %46, label %50
46: ; preds = %41
%47 = call i32 @strcpy(i8* %6, i8* %40)
%48 = call i32 @strcpy(i8* %40, i8* %43)
%49 = call i32 @strcpy(i8* %43, i8* %6)
br label %50
50: ; preds = %41, %46
%51 = add nuw nsw i64 %42, 1
%52 = load i32, i32* %4
%53 = trunc i64 %51 to i32
%54 = icmp sgt i32 %52, %53
br i1 %54, label %41, label %25
55: ; preds = %27, %0, %15
%56 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.9, i64 0, i64 0))
%57 = load i32, i32* %4
%58 = icmp sgt i32 %57, 0
br i1 %58, label %59, label %67
59: ; preds = %55, %59
%60 = phi i64 [ %63, %59 ], [ 0, %55 ]
%61 = getelementptr inbounds [20 x [30 x i8]], [20 x [30 x i8]]* %1, i64 0, i64 %60, i64 0
%62 = call i32 @puts(i8* %61)
%63 = add nuw nsw i64 %60, 1
%64 = load i32, i32* %4
%65 = sext i32 %64 to i64
%66 = icmp slt i64 %63, %65
br i1 %66, label %59, label %67
67: ; preds = %59, %55
%68 = call i32 @putchar(i32 10)
%69 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.10, i64 0, i64 0))
%70 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), [30 x i8]* %3)
%71 = load i32, i32* %4
%72 = icmp slt i32 %71, 1
br i1 %72, label %95, label %73
73: ; preds = %67
%74 = add nsw i32 %71, -1
br label %75
75: ; preds = %73, %84
%76 = phi i32 [ %90, %84 ], [ %74, %73 ]
%77 = phi i32 [ %89, %84 ], [ 0, %73 ]
%78 = add nsw i32 %76, %77
%79 = sdiv i32 %78, 2
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds [20 x [30 x i8]], [20 x [30 x i8]]* %1, i64 0, i64 %80, i64 0
%82 = call i64 @strcmp(i8* %7, i8* %81)
%83 = icmp eq i64 %82, 0
br i1 %83, label %92, label %84
84: ; preds = %75
%85 = call i64 @strcmp(i8* %7, i8* %81)
%86 = icmp slt i64 %85, 0
%87 = add nsw i32 %79, -1
%88 = add nsw i32 %79, 1
%89 = select i1 %86, i32 %77, i32 %88
%90 = select i1 %86, i32 %87, i32 %76
%91 = icmp sgt i32 %89, %90
br i1 %91, label %95, label %75
92: ; preds = %75
%93 = add nsw i32 %79, 1
%94 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i8* %7, i32 %93)
br label %97
95: ; preds = %84, %67
%96 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.11, i64 0, i64 0))
br label %97
97: ; preds = %95, %92
ret i32 0
}