#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ putc(int /*<<< orphan*/, int /*<<< orphan*/ *);
int fprintfs(FILE *f, const char *format, const char *str) {
  while (*format)
    putc(*(format++), f);
  format++;
  while (*str)
    putc(*(str++), f);
  while (*format)
    putc(*(format++), f);
  return 0;
}


x86 assembly (clang, -O0):
<fprintfs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1151 <fprintfs+0x41>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1030 <putc@plt>
jmp    1124 <fprintfs+0x14>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     118a <fprintfs+0x7a>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1030 <putc@plt>
jmp    115d <fprintfs+0x4d>
jmp    118f <fprintfs+0x7f>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11bc <fprintfs+0xac>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1030 <putc@plt>
jmp    118f <fprintfs+0x7f>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fprintfs>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%r14
mov    (%rsi),%al
test   %al,%al
je     114f <fprintfs+0x3f>
nopw   0x0(%rax,%rax,1)
lea    0x1(%r12),%rbx
movsbl %al,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
movzbl 0x1(%r12),%eax
mov    %rbx,%r12
test   %al,%al
jne    1130 <fprintfs+0x20>
jmp    1152 <fprintfs+0x42>
mov    %r12,%rbx
mov    (%r15),%al
test   %al,%al
je     1177 <fprintfs+0x67>
add    $0x1,%r15
nopl   (%rax)
movsbl %al,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
movzbl (%r15),%eax
add    $0x1,%r15
test   %al,%al
jne    1160 <fprintfs+0x50>
mov    0x1(%rbx),%al
test   %al,%al
je     11a6 <fprintfs+0x96>
add    $0x2,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl %al,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1190 <fprintfs+0x80>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @fprintfs(i32* %0, i8* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8*
store i32* %0, i32** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
br label %7
7: ; preds = %11, %3
%8 = load i8*, i8** %5
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %18
11: ; preds = %7
%12 = load i8*, i8** %5
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %5
%14 = load i8, i8* %12
%15 = sext i8 %14 to i32
%16 = load i32*, i32** %4
%17 = call i32 @putc(i32 %15, i32* %16)
br label %7
18: ; preds = %7
%19 = load i8*, i8** %5
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %5
br label %21
21: ; preds = %25, %18
%22 = load i8*, i8** %6
%23 = load i8, i8* %22
%24 = icmp ne i8 %23, 0
br i1 %24, label %25, label %32
25: ; preds = %21
%26 = load i8*, i8** %6
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %6
%28 = load i8, i8* %26
%29 = sext i8 %28 to i32
%30 = load i32*, i32** %4
%31 = call i32 @putc(i32 %29, i32* %30)
br label %21
32: ; preds = %21
br label %33
33: ; preds = %37, %32
%34 = load i8*, i8** %5
%35 = load i8, i8* %34
%36 = icmp ne i8 %35, 0
br i1 %36, label %37, label %44
37: ; preds = %33
%38 = load i8*, i8** %5
%39 = getelementptr inbounds i8, i8* %38, i32 1
store i8* %39, i8** %5
%40 = load i8, i8* %38
%41 = sext i8 %40 to i32
%42 = load i32*, i32** %4
%43 = call i32 @putc(i32 %41, i32* %42)
br label %33
44: ; preds = %33
ret i32 0
}

LLVM IR (-O2):
define i32 @fprintfs(i32* nocapture %0, i8* nocapture %1, i8* nocapture %2) {
%4 = load i8, i8* %1
%5 = icmp eq i8 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %10, %3
%7 = phi i8* [ %1, %3 ], [ %13, %10 ]
%8 = load i8, i8* %2
%9 = icmp eq i8 %8, 0
br i1 %9, label %18, label %22
10: ; preds = %3, %10
%11 = phi i8 [ %16, %10 ], [ %4, %3 ]
%12 = phi i8* [ %13, %10 ], [ %1, %3 ]
%13 = getelementptr inbounds i8, i8* %12, i64 1
%14 = sext i8 %11 to i32
%15 = tail call i32 @putc(i32 %14, i32* %0)
%16 = load i8, i8* %13
%17 = icmp eq i8 %16, 0
br i1 %17, label %6, label %10
18: ; preds = %22, %6
%19 = getelementptr inbounds i8, i8* %7, i64 1
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 0
br i1 %21, label %38, label %30
22: ; preds = %6, %22
%23 = phi i8 [ %28, %22 ], [ %8, %6 ]
%24 = phi i8* [ %25, %22 ], [ %2, %6 ]
%25 = getelementptr inbounds i8, i8* %24, i64 1
%26 = sext i8 %23 to i32
%27 = tail call i32 @putc(i32 %26, i32* %0)
%28 = load i8, i8* %25
%29 = icmp eq i8 %28, 0
br i1 %29, label %18, label %22
30: ; preds = %18, %30
%31 = phi i8 [ %36, %30 ], [ %20, %18 ]
%32 = phi i8* [ %35, %30 ], [ %19, %18 ]
%33 = sext i8 %31 to i32
%34 = tail call i32 @putc(i32 %33, i32* %0)
%35 = getelementptr inbounds i8, i8* %32, i64 1
%36 = load i8, i8* %35
%37 = icmp eq i8 %36, 0
br i1 %37, label %38, label %30
38: ; preds = %30, %18
ret i32 0
}