#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*/ ft_putchar(char const);
int /*<<< orphan*/ ft_putnbr(int);
int /*<<< orphan*/ ft_putstr(char *);
void ft_putfstr(const char *s1, const void *arg) {
  while (*s1) {
    if (*s1 == '%') {
      s1++;
      if (*s1 == '%')
        ft_putchar('%');
      else if (*s1 == 'c')
        ft_putchar(*((char *)arg));
      else if (*s1 == 's')
        ft_putstr((char *)arg);
      else if (*s1 == 'd')
        ft_putnbr(*((int *)arg));
    } else
      ft_putchar(*s1);
    s1++;
  }
}


x86 assembly (clang, -O0):
<ft_putfstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1213 <ft_putfstr+0xe3>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x25,%eax
jne    11f6 <ft_putfstr+0xc6>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x25,%eax
jne    1188 <ft_putfstr+0x58>
mov    $0x25,%edi
call   1030 <ft_putchar@plt>
jmp    11f1 <ft_putfstr+0xc1>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x63,%eax
jne    11a9 <ft_putfstr+0x79>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <ft_putchar@plt>
jmp    11ec <ft_putfstr+0xbc>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x73,%eax
jne    11c7 <ft_putfstr+0x97>
mov    -0x10(%rbp),%rdi
call   1050 <ft_putstr@plt>
jmp    11e7 <ft_putfstr+0xb7>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x64,%eax
jne    11e2 <ft_putfstr+0xb2>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1040 <ft_putnbr@plt>
jmp    11e7 <ft_putfstr+0xb7>
jmp    11ec <ft_putfstr+0xbc>
jmp    11f1 <ft_putfstr+0xc1>
jmp    1202 <ft_putfstr+0xd2>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <ft_putchar@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1140 <ft_putfstr+0x10>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putfstr>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
jmp    1150 <ft_putfstr+0x20>
mov    (%r14),%edi
call   1040 <ft_putnbr@plt>
add    $0x1,%rbx
nopl   0x0(%rax,%rax,1)
movzbl (%rbx),%eax
cmp    $0x25,%al
je     1170 <ft_putfstr+0x40>
test   %al,%al
je     11c6 <ft_putfstr+0x96>
movsbl %al,%edi
call   1030 <ft_putchar@plt>
add    $0x1,%rbx
jmp    1150 <ft_putfstr+0x20>
nopl   0x0(%rax)
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
cmp    $0x63,%al
jg     11a0 <ft_putfstr+0x70>
cmp    $0x25,%al
je     11b6 <ft_putfstr+0x86>
cmp    $0x63,%al
jne    1144 <ft_putfstr+0x14>
movsbl (%r14),%edi
call   1030 <ft_putchar@plt>
add    $0x1,%rbx
jmp    1150 <ft_putfstr+0x20>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    $0x64,%al
je     113c <ft_putfstr+0xc>
cmp    $0x73,%al
jne    1144 <ft_putfstr+0x14>
mov    %r14,%rdi
call   1050 <ft_putstr@plt>
add    $0x1,%rbx
jmp    1150 <ft_putfstr+0x20>
mov    $0x25,%edi
call   1030 <ft_putchar@plt>
add    $0x1,%rbx
jmp    1150 <ft_putfstr+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @ft_putfstr(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %58, %2
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %61
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 37
br i1 %13, label %14, label %54
14: ; preds = %9
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %3
%17 = load i8*, i8** %3
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 37
br i1 %20, label %21, label %23
21: ; preds = %14
%22 = call i32 @ft_putchar(i8 signext 37)
br label %53
23: ; preds = %14
%24 = load i8*, i8** %3
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 99
br i1 %27, label %28, label %32
28: ; preds = %23
%29 = load i8*, i8** %4
%30 = load i8, i8* %29
%31 = call i32 @ft_putchar(i8 signext %30)
br label %52
32: ; preds = %23
%33 = load i8*, i8** %3
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 115
br i1 %36, label %37, label %40
37: ; preds = %32
%38 = load i8*, i8** %4
%39 = call i32 @ft_putstr(i8* %38)
br label %51
40: ; preds = %32
%41 = load i8*, i8** %3
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 100
br i1 %44, label %45, label %50
45: ; preds = %40
%46 = load i8*, i8** %4
%47 = bitcast i8* %46 to i32*
%48 = load i32, i32* %47
%49 = call i32 @ft_putnbr(i32 %48)
br label %50
50: ; preds = %45, %40
br label %51
51: ; preds = %50, %37
br label %52
52: ; preds = %51, %28
br label %53
53: ; preds = %52, %21
br label %58
54: ; preds = %9
%55 = load i8*, i8** %3
%56 = load i8, i8* %55
%57 = call i32 @ft_putchar(i8 signext %56)
br label %58
58: ; preds = %54, %53
%59 = load i8*, i8** %3
%60 = getelementptr inbounds i8, i8* %59, i32 1
store i8* %60, i8** %3
br label %5
61: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @ft_putfstr(i8* nocapture %0, i8* %1) {
%3 = bitcast i8* %1 to i32*
br label %4
4: ; preds = %22, %2
%5 = phi i8* [ %0, %2 ], [ %24, %22 ]
%6 = load i8, i8* %5
switch i8 %6, label %20 [
i8 0, label %25
i8 37, label %7
]
7: ; preds = %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
%9 = load i8, i8* %8
switch i8 %9, label %22 [
i8 37, label %10
i8 99, label %12
i8 115, label %15
i8 100, label %17
]
10: ; preds = %7
%11 = tail call i32 @ft_putchar(i8 signext 37)
br label %22
12: ; preds = %7
%13 = load i8, i8* %1
%14 = tail call i32 @ft_putchar(i8 signext %13)
br label %22
15: ; preds = %7
%16 = tail call i32 @ft_putstr(i8* %1)
br label %22
17: ; preds = %7
%18 = load i32, i32* %3
%19 = tail call i32 @ft_putnbr(i32 %18)
br label %22
20: ; preds = %4
%21 = tail call i32 @ft_putchar(i8 signext %6)
br label %22
22: ; preds = %7, %10, %15, %17, %12, %20
%23 = phi i8* [ %8, %10 ], [ %8, %12 ], [ %8, %15 ], [ %8, %17 ], [ %5, %20 ], [ %8, %7 ]
%24 = getelementptr inbounds i8, i8* %23, i64 1
br label %4
25: ; preds = %4
ret void
}