#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*/ puts(char *);
scalar_t__ strcmp(char *, char *);
void transfer(char *strt, char *end) {
  int ind = 0;
  while (strcmp(strt, end) != 0) {
    if (strt[ind] != end[ind]) {
      strt[ind] = end[ind];
      puts(strt);
    }
    ind++;
  }
}


x86 assembly (clang, -O0):
<transfer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     119b <transfer+0x7b>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x10(%rbp),%rcx
movslq -0x14(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     118d <transfer+0x6d>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
call   1030 <puts@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1137 <transfer+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<transfer>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1040 <strcmp@plt>
test   %rax,%rax
je     116d <transfer+0x4d>
xor    %ebx,%ebx
jmp    1154 <transfer+0x34>
nopl   0x0(%rax)
add    $0x1,%rbx
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     116d <transfer+0x4d>
movzbl (%r14,%rbx,1),%eax
cmp    %al,(%r15,%rbx,1)
je     1140 <transfer+0x20>
mov    %al,(%r15,%rbx,1)
mov    %r15,%rdi
call   1030 <puts@plt>
jmp    1140 <transfer+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @transfer(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %5
br label %6
6: ; preds = %37, %2
%7 = load i8*, i8** %3
%8 = load i8*, i8** %4
%9 = call i64 @strcmp(i8* %7, i8* %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %40
11: ; preds = %6
%12 = load i8*, i8** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = load i8*, i8** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp ne i32 %17, %23
br i1 %24, label %25, label %37
25: ; preds = %11
%26 = load i8*, i8** %4
%27 = load i32, i32* %5
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %26, i64 %28
%30 = load i8, i8* %29
%31 = load i8*, i8** %3
%32 = load i32, i32* %5
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %31, i64 %33
store i8 %30, i8* %34
%35 = load i8*, i8** %3
%36 = call i32 @puts(i8* %35)
br label %37
37: ; preds = %25, %11
%38 = load i32, i32* %5
%39 = add nsw i32 %38, 1
store i32 %39, i32* %5
br label %6
40: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @transfer(i8* %0, i8* %1) {
%3 = tail call i64 @strcmp(i8* %0, i8* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %18, label %5
5: ; preds = %2, %14
%6 = phi i64 [ %15, %14 ], [ 0, %2 ]
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = getelementptr inbounds i8, i8* %1, i64 %6
%10 = load i8, i8* %9
%11 = icmp eq i8 %8, %10
br i1 %11, label %14, label %12
12: ; preds = %5
store i8 %10, i8* %7
%13 = tail call i32 @puts(i8* dereferenceable(1) %0)
br label %14
14: ; preds = %12, %5
%15 = add nuw i64 %6, 1
%16 = tail call i64 @strcmp(i8* %0, i8* %1)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %5
18: ; preds = %14, %2
ret void
}