#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__ equality(char *, char *, int);
int strlen(char *);
char *biggest_suffix(char *s1, char *s2) {
  int i;
  int shortest_string;
  int reminder = 0;
  if (strlen(s1) > strlen(s2))
    shortest_string = strlen(s1);
  else
    shortest_string = strlen(s2);
  for (i = 0; i <= shortest_string; i++) {
    if (equality(s1, s2, i))
      reminder = i;
    else
      break;
  }
  if (reminder == 0)
    return "No suffix";
  else
    return s1 + strlen(s1) - reminder;
}


x86 assembly (clang, -O0):
<biggest_suffix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
cmp    %ecx,%eax
jle    116a <biggest_suffix+0x4a>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x20(%rbp)
jmp    1176 <biggest_suffix+0x56>
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     11c6 <biggest_suffix+0xa6>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <equality@plt>
cmp    $0x0,%rax
je     11ae <biggest_suffix+0x8e>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    11b3 <biggest_suffix+0x93>
jmp    11c6 <biggest_suffix+0xa6>
jmp    11b8 <biggest_suffix+0x98>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    117d <biggest_suffix+0x5d>
cmpl   $0x0,-0x24(%rbp)
jne    11e0 <biggest_suffix+0xc0>
lea    0xe29(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    120d <biggest_suffix+0xed>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
movslq -0x24(%rbp),%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<biggest_suffix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
mov    %rdi,%r15
call   1030 <strlen@plt>
mov    %eax,%ebx
mov    %r12,%rdi
call   1030 <strlen@plt>
cmp    %eax,%ebx
mov    %r12,%rdi
cmovg  %r15,%rdi
call   1030 <strlen@plt>
lea    0xeab(%rip),%r14
test   %eax,%eax
js     11b7 <biggest_suffix+0x97>
mov    %eax,%r13d
xor    %ebx,%ebx
mov    %r15,%rdi
mov    %r12,%rsi
xor    %edx,%edx
call   1040 <equality@plt>
test   %rax,%rax
je     11a0 <biggest_suffix+0x80>
mov    %r13d,%ebp
neg    %ebp
mov    $0x1,%ebx
nopw   0x0(%rax,%rax,1)
lea    (%rbx,%rbp,1),%eax
cmp    $0x1,%eax
je     11c9 <biggest_suffix+0xa9>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
call   1040 <equality@plt>
add    $0x1,%ebx
test   %rax,%rax
jne    1180 <biggest_suffix+0x60>
add    $0xfffffffe,%ebx
test   %ebx,%ebx
je     11b7 <biggest_suffix+0x97>
mov    %r15,%rdi
call   1030 <strlen@plt>
movslq %eax,%r14
add    %r15,%r14
mov    %ebx,%eax
sub    %rax,%r14
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r13d,%ebx
test   %ebx,%ebx
jne    11a4 <biggest_suffix+0x84>
jmp    11b7 <biggest_suffix+0x97>

LLVM IR (-O0):
@.str = [10 x i8] c"No suffix\00"
define i8* @biggest_suffix(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 0, i32* %8
%9 = load i8*, i8** %4
%10 = call i32 @strlen(i8* %9)
%11 = load i8*, i8** %5
%12 = call i32 @strlen(i8* %11)
%13 = icmp sgt i32 %10, %12
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = load i8*, i8** %4
%16 = call i32 @strlen(i8* %15)
store i32 %16, i32* %7
br label %20
17: ; preds = %2
%18 = load i8*, i8** %5
%19 = call i32 @strlen(i8* %18)
store i32 %19, i32* %7
br label %20
20: ; preds = %17, %14
store i32 0, i32* %6
br label %21
21: ; preds = %35, %20
%22 = load i32, i32* %6
%23 = load i32, i32* %7
%24 = icmp sle i32 %22, %23
br i1 %24, label %25, label %38
25: ; preds = %21
%26 = load i8*, i8** %4
%27 = load i8*, i8** %5
%28 = load i32, i32* %6
%29 = call i64 @equality(i8* %26, i8* %27, i32 %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %25
%32 = load i32, i32* %6
store i32 %32, i32* %8
br label %34
33: ; preds = %25
br label %38
34: ; preds = %31
br label %35
35: ; preds = %34
%36 = load i32, i32* %6
%37 = add nsw i32 %36, 1
store i32 %37, i32* %6
br label %21
38: ; preds = %33, %21
%39 = load i32, i32* %8
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %42
41: ; preds = %38
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %3
br label %52
42: ; preds = %38
%43 = load i8*, i8** %4
%44 = load i8*, i8** %4
%45 = call i32 @strlen(i8* %44)
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %43, i64 %46
%48 = load i32, i32* %8
%49 = sext i32 %48 to i64
%50 = sub i64 0, %49
%51 = getelementptr inbounds i8, i8* %47, i64 %50
store i8* %51, i8** %3
br label %52
52: ; preds = %42, %41
%53 = load i8*, i8** %3
ret i8* %53
}

LLVM IR (-O2):
@.str = [10 x i8] c"No suffix\00"
define i8* @biggest_suffix(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @strlen(i8* %1)
%5 = icmp sgt i32 %3, %4
%6 = select i1 %5, i8* %0, i8* %1
%7 = tail call i32 @strlen(i8* %6)
%8 = icmp slt i32 %7, 0
br i1 %8, label %29, label %9
9: ; preds = %2
%10 = tail call i64 @equality(i8* %0, i8* %1, i32 0)
%11 = icmp eq i64 %10, 0
br i1 %11, label %19, label %12
12: ; preds = %9, %16
%13 = phi i32 [ %14, %16 ], [ 0, %9 ]
%14 = add nuw i32 %13, 1
%15 = icmp eq i32 %13, %7
br i1 %15, label %19, label %16
16: ; preds = %12
%17 = tail call i64 @equality(i8* %0, i8* %1, i32 %14)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %12
19: ; preds = %16, %12, %9
%20 = phi i32 [ 0, %9 ], [ %13, %16 ], [ %7, %12 ]
%21 = icmp eq i32 %20, 0
br i1 %21, label %29, label %22
22: ; preds = %19
%23 = tail call i32 @strlen(i8* %0)
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %0, i64 %24
%26 = zext i32 %20 to i64
%27 = sub nsw i64 0, %26
%28 = getelementptr inbounds i8, i8* %25, i64 %27
br label %29
29: ; preds = %2, %19, %22
%30 = phi i8* [ %28, %22 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), %19 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), %2 ]
ret i8* %30
}