#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*/ sscanf(char *, char *, char *);
int strcmp(char *, char *);
int strcoll(char *, char *);
int strcollcmp(char *a, char *b) {
  char a1[100], b1[100];
  int order;
  sscanf(a, "%[^\t]", a1);
  sscanf(b, "%[^\t]", b1);
  order = strcoll(a1, b1);
  if (order == 0)
    order = strcmp(a, b);

  return order;
}


x86 assembly (clang, -O0):
<strcollcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x80(%rbp),%rdx
lea    0xeae(%rip),%rsi
call   1040 <sscanf@plt>
mov    -0x10(%rbp),%rdi
lea    -0xf0(%rbp),%rdx
lea    0xe97(%rip),%rsi
call   1040 <sscanf@plt>
lea    -0x80(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
call   1050 <strcoll@plt>
mov    %eax,-0xf4(%rbp)
cmpl   $0x0,-0xf4(%rbp)
jne    11a4 <strcollcmp+0x74>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
mov    %eax,-0xf4(%rbp)
mov    -0xf4(%rbp),%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcollcmp>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe0,%rsp
mov    %rsi,%r14
mov    %rdi,%r13
lea    0xeb3(%rip),%r15
lea    0x70(%rsp),%r12
mov    %r15,%rsi
mov    %r12,%rdx
call   1040 <sscanf@plt>
mov    %rsp,%rbx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1040 <sscanf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <strcoll@plt>
test   %eax,%eax
jne    1188 <strcollcmp+0x58>
mov    %r13,%rdi
mov    %r14,%rsi
call   1030 <strcmp@plt>
add    $0xe0,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%[^\09]\00"
define i32 @strcollcmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [100 x i8]
%6 = alloca [100 x i8]
%7 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %3
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%10 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load i8*, i8** %4
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%13 = call i32 @sscanf(i8* %11, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%16 = call i32 @strcoll(i8* %14, i8* %15)
store i32 %16, i32* %7
%17 = load i32, i32* %7
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %2
%20 = load i8*, i8** %3
%21 = load i8*, i8** %4
%22 = call i32 @strcmp(i8* %20, i8* %21)
store i32 %22, i32* %7
br label %23
23: ; preds = %19, %2
%24 = load i32, i32* %7
ret i32 %24
}

LLVM IR (-O2):
@.str = [6 x i8] c"%[^\09]\00"
define i32 @strcollcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%7 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %5)
%8 = call i32 @sscanf(i8* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %6)
%9 = call i32 @strcoll(i8* %5, i8* %6)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
br label %13
13: ; preds = %11, %2
%14 = phi i32 [ %12, %11 ], [ %9, %2 ]
ret i32 %14
}