#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 */
char *gettype(char *);
int /*<<< orphan*/ printf(char *, char *, char *);
int strcmp(char *, char *);
void charchange(char *str) {
  char *next = NULL;
  next = str + 1;
  char *typestr = NULL;
  char *typestr1 = NULL;
  int comp;
  while (*next != '\0') {
    typestr = gettype(str);
    typestr1 = gettype(next);
    comp = strcmp(typestr, typestr1);
    if (comp != 0) {
      printf("Type now is %s, changing to %s \n", typestr, typestr1);
    }
    str++;
    next++;
  }
}


x86 assembly (clang, -O0):
<charchange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11d5 <charchange+0xa5>
mov    -0x8(%rbp),%rdi
call   1050 <gettype@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <gettype@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <strcmp@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     11b8 <charchange+0x88>
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xe4d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1160 <charchange+0x30>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<charchange>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmpb   $0x0,0x1(%rdi)
je     1190 <charchange+0x60>
mov    %rdi,%rbx
add    $0x1,%rbx
lea    0xeb4(%rip),%r14
jmp    115a <charchange+0x2a>
xchg   %ax,%ax
cmpb   $0x0,0x1(%rbx)
lea    0x1(%rbx),%rbx
je     1190 <charchange+0x60>
lea    -0x1(%rbx),%rdi
call   1050 <gettype@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1050 <gettype@plt>
mov    %rax,%r12
mov    %r15,%rdi
mov    %rax,%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1150 <charchange+0x20>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <printf@plt>
jmp    1150 <charchange+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Type now is %s, changing to %s \0A\00"
define void @charchange(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %2
store i8* null, i8** %3
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 1
store i8* %8, i8** %3
store i8* null, i8** %4
store i8* null, i8** %5
br label %9
9: ; preds = %28, %1
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %33
14: ; preds = %9
%15 = load i8*, i8** %2
%16 = call i8* @gettype(i8* %15)
store i8* %16, i8** %4
%17 = load i8*, i8** %3
%18 = call i8* @gettype(i8* %17)
store i8* %18, i8** %5
%19 = load i8*, i8** %4
%20 = load i8*, i8** %5
%21 = call i32 @strcmp(i8* %19, i8* %20)
store i32 %21, i32* %6
%22 = load i32, i32* %6
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %14
%25 = load i8*, i8** %4
%26 = load i8*, i8** %5
%27 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %25, i8* %26)
br label %28
28: ; preds = %24, %14
%29 = load i8*, i8** %2
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** %2
%31 = load i8*, i8** %3
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %3
br label %9
33: ; preds = %9
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"Type now is %s, changing to %s \0A\00"
define void @charchange(i8* %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = load i8, i8* %2
%4 = icmp eq i8 %3, 0
br i1 %4, label %19, label %5
5: ; preds = %1, %14
%6 = phi i8* [ %16, %14 ], [ %2, %1 ]
%7 = phi i8* [ %15, %14 ], [ %0, %1 ]
%8 = tail call i8* @gettype(i8* %7)
%9 = tail call i8* @gettype(i8* %6)
%10 = tail call i32 @strcmp(i8* dereferenceable(1) %8, i8* dereferenceable(1) %9)
%11 = icmp eq i32 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %5
%13 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %9)
br label %14
14: ; preds = %12, %5
%15 = getelementptr inbounds i8, i8* %7, i64 1
%16 = getelementptr inbounds i8, i8* %6, i64 1
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %5
19: ; preds = %14, %1
ret void
}