#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*/ die(char *, char *, int, char *);
int /*<<< orphan*/ include_cat_res(char *, char *, char *, int);
scalar_t__ push_resource(char *, char *);
scalar_t__ split_resource_name(char *, char **, char **);
void include_resource(char *restag, char *fromfile, int fromline) {
  char *category;
  char *resource;
  if (split_resource_name(restag, &category, &resource))
    die("%s:%i: bad resource name %s\n", fromfile, fromline, restag);
  if (push_resource(category, resource))
    return;
  include_cat_res(category, resource, fromfile, fromline);
}


x86 assembly (clang, -O0):
<include_resource>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1030 <split_resource_name@plt>
cmp    $0x0,%rax
je     1185 <include_resource+0x45>
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rcx
lea    0xe80(%rip),%rdi
call   1060 <die@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <push_resource@plt>
cmp    $0x0,%rax
je     11a1 <include_resource+0x61>
jmp    11b5 <include_resource+0x75>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
call   1050 <include_cat_res@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<include_resource>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
lea    0x8(%rsp),%rsi
mov    %rsp,%rdx
call   1030 <split_resource_name@plt>
test   %rax,%rax
je     1178 <include_resource+0x38>
lea    0xe96(%rip),%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
mov    %rbp,%rcx
call   1060 <die@plt>
mov    0x8(%rsp),%rdi
mov    (%rsp),%rsi
call   1040 <push_resource@plt>
test   %rax,%rax
jne    119f <include_resource+0x5f>
mov    0x8(%rsp),%rdi
mov    (%rsp),%rsi
mov    %rbx,%rdx
mov    %r14d,%ecx
call   1050 <include_cat_res@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [29 x i8] c"%s:%i: bad resource name %s\0A\00"
define void @include_resource(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%9 = load i8*, i8** %4
%10 = call i64 @split_resource_name(i8* %9, i8** %7, i8** %8)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %3
%13 = load i8*, i8** %5
%14 = load i32, i32* %6
%15 = load i8*, i8** %4
%16 = call i32 @die(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %13, i32 %14, i8* %15)
br label %17
17: ; preds = %12, %3
%18 = load i8*, i8** %7
%19 = load i8*, i8** %8
%20 = call i64 @push_resource(i8* %18, i8* %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %17
br label %29
23: ; preds = %17
%24 = load i8*, i8** %7
%25 = load i8*, i8** %8
%26 = load i8*, i8** %5
%27 = load i32, i32* %6
%28 = call i32 @include_cat_res(i8* %24, i8* %25, i8* %26, i32 %27)
br label %29
29: ; preds = %23, %22
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"%s:%i: bad resource name %s\0A\00"
define void @include_resource(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = bitcast i8** %4 to i8*
%7 = bitcast i8** %5 to i8*
%8 = call i64 @split_resource_name(i8* %0, i8** %4, i8** %5)
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %3
%11 = call i32 @die(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %2, i8* %0)
br label %12
12: ; preds = %10, %3
%13 = load i8*, i8** %4
%14 = load i8*, i8** %5
%15 = call i64 @push_resource(i8* %13, i8* %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %12
%18 = load i8*, i8** %4
%19 = load i8*, i8** %5
%20 = call i32 @include_cat_res(i8* %18, i8* %19, i8* %1, i32 %2)
br label %21
21: ; preds = %12, %17
ret void
}