#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*/ printf(char *, char, char, char);
char locdif(char A, char B) {
  char loc = 'A';
  while (loc == A || loc == B)
    loc++;
  printf("diff(%c %c)=%c\n", A, B, loc);
  return loc;
}


x86 assembly (clang, -O0):
<locdif>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movb   $0x41,-0x3(%rbp)
movsbl -0x3(%rbp),%ecx
movsbl -0x1(%rbp),%edx
mov    $0x1,%al
cmp    %edx,%ecx
mov    %al,-0x4(%rbp)
je     114d <locdif+0x3d>
movsbl -0x3(%rbp),%eax
movsbl -0x2(%rbp),%ecx
cmp    %ecx,%eax
sete   %al
mov    %al,-0x4(%rbp)
mov    -0x4(%rbp),%al
test   $0x1,%al
jne    115d <locdif+0x4d>
jmp    116a <locdif+0x5a>
mov    -0x3(%rbp),%al
add    $0x1,%al
mov    %al,-0x3(%rbp)
jmp    1128 <locdif+0x18>
mov    -0x1(%rbp),%cl
mov    -0x2(%rbp),%al
lea    0xe89(%rip),%rdi
movsbl %cl,%esi
movsbl %al,%edx
movsbl -0x3(%rbp),%ecx
call   1030 <printf@plt>
movsbl -0x3(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<locdif>:
push   %rbx
mov    %esi,%r8d
neg    %r8b
mov    %edi,%edx
neg    %dl
mov    $0x40,%cl
nopl   (%rax)
lea    (%r8,%rcx,1),%ebx
lea    (%rdx,%rcx,1),%eax
add    $0x1,%cl
cmp    $0xff,%al
je     1120 <locdif+0x10>
cmp    $0xff,%bl
je     1120 <locdif+0x10>
movsbl %dil,%eax
movsbl %sil,%edx
movsbl %cl,%ebx
lea    0xebb(%rip),%rdi
mov    %eax,%esi
mov    %ebx,%ecx
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"diff(%c %c)=%c\0A\00"
define signext i8 @locdif(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
store i8 65, i8* %5
br label %6
6: ; preds = %20, %2
%7 = load i8, i8* %5
%8 = sext i8 %7 to i32
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %8, %10
br i1 %11, label %18, label %12
12: ; preds = %6
%13 = load i8, i8* %5
%14 = sext i8 %13 to i32
%15 = load i8, i8* %4
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %14, %16
br label %18
18: ; preds = %12, %6
%19 = phi i1 [ true, %6 ], [ %17, %12 ]
br i1 %19, label %20, label %23
20: ; preds = %18
%21 = load i8, i8* %5
%22 = add i8 %21, 1
store i8 %22, i8* %5
br label %6
23: ; preds = %18
%24 = load i8, i8* %3
%25 = load i8, i8* %4
%26 = load i8, i8* %5
%27 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8 signext %24, i8 signext %25, i8 signext %26)
%28 = load i8, i8* %5
ret i8 %28
}

LLVM IR (-O2):
@.str = [16 x i8] c"diff(%c %c)=%c\0A\00"
define signext i8 @locdif(i8 signext %0, i8 signext %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8 [ 65, %2 ], [ %8, %3 ]
%5 = icmp eq i8 %4, %0
%6 = icmp eq i8 %4, %1
%7 = or i1 %5, %6
%8 = add i8 %4, 1
br i1 %7, label %3, label %9
9: ; preds = %3
%10 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8 signext %0, i8 signext %1, i8 signext %4)
ret i8 %4
}