#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*/ exit(int);
int lookup_insert(char, char);
int /*<<< orphan*/ printf(char *, ...);
int strlen(char *);
void main() {
  char *str1 = "acb";
  char *str2 = "xxz";
  int str_len1 = 0, i = 0, str_len2 = 0, res = 0;
  str_len1 = strlen(str1);
  str_len2 = strlen(str2);
  if (str_len1 != str_len2) {
    printf("\n strings are not equal hence can not comapre for isomorphic");
    exit(-1);
  }
  for (i = 0; i < str_len1; i++) {
    if (lookup_insert(str1[i], str2[i]) == -1) {
      printf("\nstring1 %c is not equivalen to string2 %c ", str1[i], str2[i]);
      res = -1;
      break;
    }
  }
  if (!res)
    printf("\n Strings %s and %s are isomorphich", str1, str2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xeb1(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xeaa(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
je     11b6 <main+0x76>
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1236 <main+0xf6>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl %dl,%edi
movsbl (%rax,%rcx,1),%esi
call   1030 <lookup_insert@plt>
cmp    $0xffffffff,%eax
jne    1223 <main+0xe3>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x20(%rbp)
jmp    1236 <main+0xf6>
jmp    1228 <main+0xe8>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11bd <main+0x7d>
cmpl   $0x0,-0x20(%rbp)
jne    1256 <main+0x116>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeae(%rip),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebx
lea    0xea1(%rip),%r15
mov    %r15,%rdi
call   1040 <strlen@plt>
cmp    %eax,%ebx
jne    11ed <main+0xad>
test   %ebx,%ebx
jle    11a2 <main+0x62>
mov    %ebx,%r12d
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movsbl (%rbx,%r14,1),%ebp
movsbl (%rbx,%r15,1),%r13d
mov    %ebp,%edi
mov    %r13d,%esi
call   1030 <lookup_insert@plt>
cmp    $0xffffffff,%eax
je     11cc <main+0x8c>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1180 <main+0x40>
lea    0xec8(%rip),%rdi
lea    0xe50(%rip),%rsi
lea    0xe4d(%rip),%rdx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <printf@plt>
lea    0xe72(%rip),%rdi
mov    %ebp,%esi
mov    %r13d,%edx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <printf@plt>
lea    0xe14(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"acb\00"
@.str.1 = [4 x i8] c"xxz\00"
@.str.2 = [61 x i8] c"\0A strings are not equal hence can not comapre for isomorphic\00"
@.str.3 = [44 x i8] c"\0Astring1 %c is not equivalen to string2 %c \00"
@.str.4 = [36 x i8] c"\0A Strings %s and %s are isomorphich\00"
define void @main() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
%7 = load i8*, i8** %1
%8 = call i32 @strlen(i8* %7)
store i32 %8, i32* %3
%9 = load i8*, i8** %2
%10 = call i32 @strlen(i8* %9)
store i32 %10, i32* %5
%11 = load i32, i32* %3
%12 = load i32, i32* %5
%13 = icmp ne i32 %11, %12
br i1 %13, label %14, label %17
14: ; preds = %0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 @exit(i32 -1)
unreachable
17: ; preds = %0
store i32 0, i32* %4
br label %18
18: ; preds = %50, %17
%19 = load i32, i32* %4
%20 = load i32, i32* %3
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %53
22: ; preds = %18
%23 = load i8*, i8** %1
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
%27 = load i8, i8* %26
%28 = load i8*, i8** %2
%29 = load i32, i32* %4
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
%32 = load i8, i8* %31
%33 = call i32 @lookup_insert(i8 signext %27, i8 signext %32)
%34 = icmp eq i32 %33, -1
br i1 %34, label %35, label %49
35: ; preds = %22
%36 = load i8*, i8** %1
%37 = load i32, i32* %4
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8, i8* %36, i64 %38
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = load i8*, i8** %2
%43 = load i32, i32* %4
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %42, i64 %44
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i32 %41, i32 %47)
store i32 -1, i32* %6
br label %53
49: ; preds = %22
br label %50
50: ; preds = %49
%51 = load i32, i32* %4
%52 = add nsw i32 %51, 1
store i32 %52, i32* %4
br label %18
53: ; preds = %35, %18
%54 = load i32, i32* %6
%55 = icmp ne i32 %54, 0
br i1 %55, label %60, label %56
56: ; preds = %53
%57 = load i8*, i8** %1
%58 = load i8*, i8** %2
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i8* %57, i8* %58)
br label %60
60: ; preds = %56, %53
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"acb\00"
@.str.1 = [4 x i8] c"xxz\00"
@.str.2 = [61 x i8] c"\0A strings are not equal hence can not comapre for isomorphic\00"
@.str.3 = [44 x i8] c"\0Astring1 %c is not equivalen to string2 %c \00"
@.str.4 = [36 x i8] c"\0A Strings %s and %s are isomorphich\00"
define void @main() {
%1 = tail call i32 @strlen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @strlen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp eq i32 %1, %2
br i1 %3, label %4, label %8
4: ; preds = %0
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %26
6: ; preds = %4
%7 = zext i32 %1 to i64
br label %13
8: ; preds = %0
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.2, i64 0, i64 0))
%10 = tail call i32 @exit(i32 -1)
unreachable
11: ; preds = %13
%12 = icmp eq i64 %21, %7
br i1 %12, label %26, label %13
13: ; preds = %6, %11
%14 = phi i64 [ 0, %6 ], [ %21, %11 ]
%15 = getelementptr inbounds [4 x i8], [4 x i8]* @.str, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = getelementptr inbounds [4 x i8], [4 x i8]* @.str.1, i64 0, i64 %14
%18 = load i8, i8* %17
%19 = tail call i32 @lookup_insert(i8 signext %16, i8 signext %18)
%20 = icmp eq i32 %19, -1
%21 = add nuw nsw i64 %14, 1
br i1 %20, label %22, label %11
22: ; preds = %13
%23 = sext i8 %16 to i32
%24 = sext i8 %18 to i32
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i32 %23, i32 %24)
br label %28
26: ; preds = %11, %4
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %28
28: ; preds = %22, %26
ret void
}