#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*/ assert(int);
int /*<<< orphan*/ split_layout_str(char const **, int *, int *, char const *);
void most_specific_layout(const char **str, int *size, const char *label) {
  const char *layout_names[8];
  int layout_name_sizes[8];
  int layout_count;
  split_layout_str(layout_names, layout_name_sizes, &layout_count, label);
  assert(layout_count > 0);
  const int most_specific = layout_count - 1;
  *str = layout_names[most_specific];
  *size = layout_name_sizes[most_specific];
}


x86 assembly (clang, -O0):
<most_specific_layout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x60(%rbp),%rdi
lea    -0x80(%rbp),%rsi
mov    -0x18(%rbp),%rcx
lea    -0x84(%rbp),%rdx
call   1040 <split_layout_str@plt>
cmpl   $0x0,-0x84(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x84(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x88(%rbp)
movslq -0x88(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
movslq -0x88(%rbp),%rax
mov    -0x80(%rbp,%rax,4),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<most_specific_layout>:
push   %r14
push   %rbx
sub    $0x78,%rsp
mov    %rdx,%rcx
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x30(%rsp),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1040 <split_layout_str@plt>
xor    %edi,%edi
cmpl   $0x0,0xc(%rsp)
setg   %dil
call   1030 <assert@plt>
movslq 0xc(%rsp),%rax
mov    0x28(%rsp,%rax,8),%rcx
mov    %rcx,(%rbx)
mov    0xc(%rsp,%rax,4),%eax
mov    %eax,(%r14)
add    $0x78,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @most_specific_layout(i8** %0, i32* %1, i8* %2) {
%4 = alloca i8**
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca [8 x i8*]
%8 = alloca [8 x i32]
%9 = alloca i32
%10 = alloca i32
store i8** %0, i8*** %4
store i32* %1, i32** %5
store i8* %2, i8** %6
%11 = getelementptr inbounds [8 x i8*], [8 x i8*]* %7, i64 0, i64 0
%12 = getelementptr inbounds [8 x i32], [8 x i32]* %8, i64 0, i64 0
%13 = load i8*, i8** %6
%14 = call i32 @split_layout_str(i8** %11, i32* %12, i32* %9, i8* %13)
%15 = load i32, i32* %9
%16 = icmp sgt i32 %15, 0
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = load i32, i32* %9
%20 = sub nsw i32 %19, 1
store i32 %20, i32* %10
%21 = load i32, i32* %10
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [8 x i8*], [8 x i8*]* %7, i64 0, i64 %22
%24 = load i8*, i8** %23
%25 = load i8**, i8*** %4
store i8* %24, i8** %25
%26 = load i32, i32* %10
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [8 x i32], [8 x i32]* %8, i64 0, i64 %27
%29 = load i32, i32* %28
%30 = load i32*, i32** %5
store i32 %29, i32* %30
ret void
}

LLVM IR (-O2):
define void @most_specific_layout(i8** nocapture writeonly %0, i32* nocapture writeonly %1, i8* %2) {
%4 = alloca [8 x i8*]
%5 = alloca [8 x i32]
%6 = alloca i32
%7 = bitcast [8 x i8*]* %4 to i8*
%8 = bitcast [8 x i32]* %5 to i8*
%9 = bitcast i32* %6 to i8*
%10 = getelementptr inbounds [8 x i8*], [8 x i8*]* %4, i64 0, i64 0
%11 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 0
%12 = call i32 @split_layout_str(i8** %10, i32* %11, i32* %6, i8* %2)
%13 = load i32, i32* %6
%14 = icmp sgt i32 %13, 0
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = load i32, i32* %6
%18 = add nsw i32 %17, -1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [8 x i8*], [8 x i8*]* %4, i64 0, i64 %19
%21 = load i8*, i8** %20
store i8* %21, i8** %0
%22 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 %19
%23 = load i32, i32* %22
store i32 %23, i32* %1
ret void
}