#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 index_first_num(char const *);
int index_letter_pos(char const *, int);
int /*<<< orphan*/ strcpy(char *, char const *);
int /*<<< orphan*/ strncpy(char *, char const *, int);
void separate_code(const char *code, char *warehouse, char *id,
                   char *qualifiers) {
  int first_num = index_first_num(code);
  int letter = index_letter_pos(code, first_num);
  strncpy(warehouse, code, first_num);
  strncpy(id, code + first_num, letter - first_num);
  strcpy(qualifiers, code + letter);
}


x86 assembly (clang, -O0):
<separate_code>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <index_first_num@plt>
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1050 <index_letter_pos@plt>
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0x24(%rbp),%rax
add    %rax,%rsi
mov    -0x28(%rbp),%edx
sub    -0x24(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0x28(%rbp),%rax
add    %rax,%rsi
call   1040 <strcpy@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<separate_code>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
call   1060 <index_first_num@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <index_letter_pos@plt>
mov    %eax,%r13d
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1030 <strncpy@plt>
movslq %ebp,%rax
lea    (%rbx,%rax,1),%rsi
mov    %r13d,%edx
sub    %eax,%edx
mov    %r15,%rdi
call   1030 <strncpy@plt>
movslq %r13d,%rsi
add    %rbx,%rsi
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <strcpy@plt>

LLVM IR (-O0):
define void @separate_code(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%11 = load i8*, i8** %5
%12 = call i32 @index_first_num(i8* %11)
store i32 %12, i32* %9
%13 = load i8*, i8** %5
%14 = load i32, i32* %9
%15 = call i32 @index_letter_pos(i8* %13, i32 %14)
store i32 %15, i32* %10
%16 = load i8*, i8** %6
%17 = load i8*, i8** %5
%18 = load i32, i32* %9
%19 = call i32 @strncpy(i8* %16, i8* %17, i32 %18)
%20 = load i8*, i8** %7
%21 = load i8*, i8** %5
%22 = load i32, i32* %9
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i32, i32* %10
%26 = load i32, i32* %9
%27 = sub nsw i32 %25, %26
%28 = call i32 @strncpy(i8* %20, i8* %24, i32 %27)
%29 = load i8*, i8** %8
%30 = load i8*, i8** %5
%31 = load i32, i32* %10
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
%34 = call i32 @strcpy(i8* %29, i8* %33)
ret void
}

LLVM IR (-O2):
define void @separate_code(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call i32 @index_first_num(i8* %0)
%6 = tail call i32 @index_letter_pos(i8* %0, i32 %5)
%7 = tail call i32 @strncpy(i8* %1, i8* %0, i32 %5)
%8 = sext i32 %5 to i64
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = sub nsw i32 %6, %5
%11 = tail call i32 @strncpy(i8* %2, i8* %9, i32 %10)
%12 = sext i32 %6 to i64
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = tail call i32 @strcpy(i8* %3, i8* %13)
ret void
}