#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 */
scalar_t__ strcmp(char *, char *);
int strlen(char *);
int findLUSlength(char *a, char *b) {
  if (strlen(a) != strlen(b)) {
    return strlen(a) > strlen(b) ? strlen(a) : strlen(b);
  }
  if (strcmp(a, b)) {
    return strlen(a);
  } else {
    return -1;
  }
}


x86 assembly (clang, -O0):
<findLUSlength>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
je     119c <findLUSlength+0x7c>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
jle    1185 <findLUSlength+0x65>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x24(%rbp)
jmp    1191 <findLUSlength+0x71>
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11cb <findLUSlength+0xab>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11c4 <findLUSlength+0xa4>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x4(%rbp)
jmp    11cb <findLUSlength+0xab>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findLUSlength>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
cmp    %eax,%ebp
jne    1157 <findLUSlength+0x37>
mov    %r14,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    116c <findLUSlength+0x4c>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1030 <strlen@plt>
cmp    %eax,%ebp
cmovle %r14,%rbx
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <strlen@plt>

LLVM IR (-O0):
define i32 @findLUSlength(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = call i32 @strlen(i8* %6)
%8 = load i8*, i8** %5
%9 = call i32 @strlen(i8* %8)
%10 = icmp ne i32 %7, %9
br i1 %10, label %11, label %25
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = call i32 @strlen(i8* %12)
%14 = load i8*, i8** %5
%15 = call i32 @strlen(i8* %14)
%16 = icmp sgt i32 %13, %15
br i1 %16, label %17, label %20
17: ; preds = %11
%18 = load i8*, i8** %4
%19 = call i32 @strlen(i8* %18)
br label %23
20: ; preds = %11
%21 = load i8*, i8** %5
%22 = call i32 @strlen(i8* %21)
br label %23
23: ; preds = %20, %17
%24 = phi i32 [ %19, %17 ], [ %22, %20 ]
store i32 %24, i32* %3
br label %34
25: ; preds = %2
%26 = load i8*, i8** %4
%27 = load i8*, i8** %5
%28 = call i64 @strcmp(i8* %26, i8* %27)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %25
%31 = load i8*, i8** %4
%32 = call i32 @strlen(i8* %31)
store i32 %32, i32* %3
br label %34
33: ; preds = %25
store i32 -1, i32* %3
br label %34
34: ; preds = %33, %30, %23
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
define i32 @findLUSlength(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @strlen(i8* %1)
%5 = icmp eq i32 %3, %4
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = tail call i32 @strlen(i8* %0)
%8 = tail call i32 @strlen(i8* %1)
%9 = icmp sgt i32 %7, %8
%10 = select i1 %9, i8* %0, i8* %1
br label %14
11: ; preds = %2
%12 = tail call i64 @strcmp(i8* %0, i8* %1)
%13 = icmp eq i64 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %11, %6
%15 = phi i8* [ %10, %6 ], [ %0, %11 ]
%16 = tail call i32 @strlen(i8* %15)
br label %17
17: ; preds = %14, %11
%18 = phi i32 [ -1, %11 ], [ %16, %14 ]
ret i32 %18
}