#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 *csc_strbody(char *, int *);
int strncmp(char *, char *, int);
int csc_cfg_strcmp(char *sour, char *dest) {
  int slen, dlen;
  sour = csc_strbody(sour, &slen);
  dest = csc_strbody(dest, &dlen);
  if (slen == dlen) {
    return strncmp(sour, dest, slen);
  }
  return slen - dlen;
}


x86 assembly (clang, -O0):
<csc_cfg_strcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <csc_strbody@plt>
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <csc_strbody@plt>
mov    %rax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jne    1176 <csc_cfg_strcmp+0x56>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <strncmp@plt>
mov    %eax,-0x4(%rbp)
jmp    117f <csc_cfg_strcmp+0x5f>
mov    -0x1c(%rbp),%eax
sub    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<csc_cfg_strcmp>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
lea    0x4(%rsp),%rsi
call   1040 <csc_strbody@plt>
mov    %rax,%r14
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <csc_strbody@plt>
mov    %rax,%rsi
mov    0x4(%rsp),%edx
mov    %edx,%eax
sub    (%rsp),%eax
jne    1155 <csc_cfg_strcmp+0x35>
mov    %r14,%rdi
call   1030 <strncmp@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @csc_cfg_strcmp(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = call i8* @csc_strbody(i8* %8, i32* %6)
store i8* %9, i8** %4
%10 = load i8*, i8** %5
%11 = call i8* @csc_strbody(i8* %10, i32* %7)
store i8* %11, i8** %5
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = icmp eq i32 %12, %13
br i1 %14, label %15, label %20
15: ; preds = %2
%16 = load i8*, i8** %4
%17 = load i8*, i8** %5
%18 = load i32, i32* %6
%19 = call i32 @strncmp(i8* %16, i8* %17, i32 %18)
store i32 %19, i32* %3
br label %24
20: ; preds = %2
%21 = load i32, i32* %6
%22 = load i32, i32* %7
%23 = sub nsw i32 %21, %22
store i32 %23, i32* %3
br label %24
24: ; preds = %20, %15
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @csc_cfg_strcmp(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = call i8* @csc_strbody(i8* %0, i32* %3)
%8 = call i8* @csc_strbody(i8* %1, i32* %4)
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = icmp eq i32 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @strncmp(i8* %7, i8* %8, i32 %9)
br label %16
14: ; preds = %2
%15 = sub nsw i32 %9, %10
br label %16
16: ; preds = %14, %12
%17 = phi i32 [ %13, %12 ], [ %15, %14 ]
ret i32 %17
}