#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 */
char *char_to_string(char);
char *ft_strjoin(char *, char *);
char *make_man_path(char *path, char *man, char *cmd) {
  return (ft_strjoin(
      path,
      ft_strjoin(
          "/",
          ft_strjoin(
              man, ft_strjoin(cmd, ft_strjoin(".", char_to_string(man[3])))))));
}


x86 assembly (clang, -O0):
<make_man_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsbl 0x3(%rax),%edi
call   1030 <char_to_string@plt>
mov    %rax,%rsi
lea    0xe9f(%rip),%rdi
call   1040 <ft_strjoin@plt>
mov    -0x30(%rbp),%rdi
mov    %rax,%rsi
call   1040 <ft_strjoin@plt>
mov    -0x28(%rbp),%rdi
mov    %rax,%rsi
call   1040 <ft_strjoin@plt>
mov    %rax,%rsi
lea    0xe76(%rip),%rdi
call   1040 <ft_strjoin@plt>
mov    -0x20(%rbp),%rdi
mov    %rax,%rsi
call   1040 <ft_strjoin@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_man_path>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r14
movsbl 0x3(%rsi),%edi
call   1030 <char_to_string@plt>
lea    0xec4(%rip),%rdi
mov    %rax,%rsi
call   1040 <ft_strjoin@plt>
mov    %r15,%rdi
mov    %rax,%rsi
call   1040 <ft_strjoin@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <ft_strjoin@plt>
lea    0xe9d(%rip),%rdi
mov    %rax,%rsi
call   1040 <ft_strjoin@plt>
mov    %r14,%rdi
mov    %rax,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <ft_strjoin@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"/\00"
@.str.1 = [2 x i8] c".\00"
define i8* @make_man_path(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i8*, i8** %6
%10 = load i8*, i8** %5
%11 = getelementptr inbounds i8, i8* %10, i64 3
%12 = load i8, i8* %11
%13 = call i8* @char_to_string(i8 signext %12)
%14 = call i8* @ft_strjoin(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = call i8* @ft_strjoin(i8* %9, i8* %14)
%16 = call i8* @ft_strjoin(i8* %8, i8* %15)
%17 = call i8* @ft_strjoin(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = call i8* @ft_strjoin(i8* %7, i8* %17)
ret i8* %18
}

LLVM IR (-O2):
@.str = [2 x i8] c"/\00"
@.str.1 = [2 x i8] c".\00"
define i8* @make_man_path(i8* %0, i8* %1, i8* %2) {
%4 = getelementptr inbounds i8, i8* %1, i64 3
%5 = load i8, i8* %4
%6 = tail call i8* @char_to_string(i8 signext %5)
%7 = tail call i8* @ft_strjoin(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = tail call i8* @ft_strjoin(i8* %2, i8* %7)
%9 = tail call i8* @ft_strjoin(i8* %1, i8* %8)
%10 = tail call i8* @ft_strjoin(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = tail call i8* @ft_strjoin(i8* %0, i8* %10)
ret i8* %11
}