#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 *strchr(char *, char);
int strcmp(char *, char *);
int nl_cmp_lnet(char *nid1, char *nid2) {
  char *s1 = strchr(nid1, '@');
  char *s2 = strchr(nid2, '@');
  return strcmp(s1 ? s1 + 1 : "", s2 ? s2 + 1 : "");
}


x86 assembly (clang, -O0):
<nl_cmp_lnet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x40,%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x40,%esi
call   1030 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1170 <nl_cmp_lnet+0x50>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1180 <nl_cmp_lnet+0x60>
lea    0xe89(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    1180 <nl_cmp_lnet+0x60>
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11a4 <nl_cmp_lnet+0x84>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    11b4 <nl_cmp_lnet+0x94>
lea    0xe55(%rip),%rax
mov    %rax,-0x38(%rbp)
jmp    11b4 <nl_cmp_lnet+0x94>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1040 <strcmp@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nl_cmp_lnet>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    $0x40,%esi
call   1030 <strchr@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    $0x40,%esi
call   1030 <strchr@plt>
lea    0x1(%rbx),%rdi
test   %rbx,%rbx
lea    0xeb1(%rip),%rcx
cmove  %rcx,%rdi
lea    0x1(%rax),%rsi
test   %rax,%rax
cmove  %rcx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <strcmp@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i32 @nl_cmp_lnet(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = call i8* @strchr(i8* %7, i8 signext 64)
store i8* %8, i8** %5
%9 = load i8*, i8** %4
%10 = call i8* @strchr(i8* %9, i8 signext 64)
store i8* %10, i8** %6
%11 = load i8*, i8** %5
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = load i8*, i8** %5
%15 = getelementptr inbounds i8, i8* %14, i64 1
br label %17
16: ; preds = %2
br label %17
17: ; preds = %16, %13
%18 = phi i8* [ %15, %13 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %16 ]
%19 = load i8*, i8** %6
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load i8*, i8** %6
%23 = getelementptr inbounds i8, i8* %22, i64 1
br label %25
24: ; preds = %17
br label %25
25: ; preds = %24, %21
%26 = phi i8* [ %23, %21 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %24 ]
%27 = call i32 @strcmp(i8* %18, i8* %26)
ret i32 %27
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i32 @nl_cmp_lnet(i8* %0, i8* %1) {
%3 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 64)
%4 = tail call i8* @strchr(i8* dereferenceable(1) %1, i8 signext 64)
%5 = icmp eq i8* %3, null
%6 = getelementptr inbounds i8, i8* %3, i64 1
%7 = select i1 %5, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %6
%8 = icmp eq i8* %4, null
%9 = getelementptr inbounds i8, i8* %4, i64 1
%10 = select i1 %8, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %9
%11 = tail call i32 @strcmp(i8* dereferenceable(1) %7, i8* dereferenceable(1) %10)
ret i32 %11
}