#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ get_filepath(char *, size_t, int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ striplower(char *);
void create_filepath(char *filepath, size_t len, char *channel, char *suffix) {
  if (!get_filepath(filepath, len, striplower(channel), suffix)) {
    fprintf(stderr, "%s", "ii: path to irc directory too long\n");
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<create_filepath>:
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),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <striplower@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
mov    -0x20(%rbp),%rcx
call   1050 <get_filepath@plt>
cmp    $0x0,%eax
jne    11b7 <create_filepath+0x77>
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
lea    0xe63(%rip),%rsi
lea    0xe5f(%rip),%rdx
call   1040 <fprintf@plt>
mov    0x2e28(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_filepath>:
push   %r15
push   %r14
push   %rbx
mov    %rcx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
mov    %rdx,%rdi
call   1030 <striplower@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %eax,%edx
mov    %r14,%rcx
call   1050 <get_filepath@plt>
test   %eax,%eax
je     1170 <create_filepath+0x30>
pop    %rbx
pop    %r14
pop    %r15
ret
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
lea    0xe80(%rip),%rsi
lea    0xe7c(%rip),%rdx
call   1040 <fprintf@plt>
mov    0x2e45(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [3 x i8] c"%s\00"
@.str.1 = [36 x i8] c"ii: path to irc directory too long\0A\00"
@EXIT_FAILURE = global i32 0
define void @create_filepath(i8* %0, i64 %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = load i8*, i8** %7
%12 = call i32 @striplower(i8* %11)
%13 = load i8*, i8** %8
%14 = call i32 @get_filepath(i8* %9, i64 %10, i32 %12, i8* %13)
%15 = icmp ne i32 %14, 0
br i1 %15, label %21, label %16
16: ; preds = %4
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%19 = load i32, i32* @EXIT_FAILURE
%20 = call i32 @exit(i32 %19)
unreachable
21: ; preds = %4
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [3 x i8] c"%s\00"
@.str.1 = [36 x i8] c"ii: path to irc directory too long\0A\00"
@EXIT_FAILURE = global i32 0
define void @create_filepath(i8* %0, i64 %1, i8* %2, i8* %3) {
%5 = tail call i32 @striplower(i8* %2)
%6 = tail call i32 @get_filepath(i8* %0, i64 %1, i32 %5, i8* %3)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %4
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32, i32* @EXIT_FAILURE
%12 = tail call i32 @exit(i32 %11)
unreachable
13: ; preds = %4
ret void
}