#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(char, int /*<<< orphan*/ *);
int fprintfc(FILE *f, const char *format, char c) {
  while (*format)
    putc(*(format++), f);
  format++;
  putc(c, f);
  while (*format)
    putc(*(format++), f);
  return 0;
}


x86 assembly (clang, -O0):
<fprintfc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1154 <fprintfc+0x44>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1030 <putc@plt>
jmp    1125 <fprintfc+0x15>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x11(%rbp),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1030 <putc@plt>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     119e <fprintfc+0x8e>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1030 <putc@plt>
jmp    116f <fprintfc+0x5f>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fprintfc>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%r15
mov    (%rsi),%al
test   %al,%al
je     114c <fprintfc+0x3c>
cs nopw 0x0(%rax,%rax,1)
lea    0x1(%rbx),%rbp
movsbl %al,%edi
mov    %r15,%rsi
call   1030 <putc@plt>
movzbl 0x1(%rbx),%eax
mov    %rbp,%rbx
test   %al,%al
jne    1130 <fprintfc+0x20>
jmp    114f <fprintfc+0x3f>
mov    %rbx,%rbp
movsbl %r14b,%edi
mov    %r15,%rsi
call   1030 <putc@plt>
mov    0x1(%rbp),%al
test   %al,%al
je     1187 <fprintfc+0x77>
add    $0x2,%rbp
cs nopw 0x0(%rax,%rax,1)
movsbl %al,%edi
mov    %r15,%rsi
call   1030 <putc@plt>
movzbl 0x0(%rbp),%eax
add    $0x1,%rbp
test   %al,%al
jne    1170 <fprintfc+0x60>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @fprintfc(i32* %0, i8* %1, i8 signext %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 %17
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 = load i32*, i32** %4
%16 = call i32 @putc(i8 signext %14, i32* %15)
br label %7
17: ; preds = %7
%18 = load i8*, i8** %5
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %5
%20 = load i8, i8* %6
%21 = load i32*, i32** %4
%22 = call i32 @putc(i8 signext %20, i32* %21)
br label %23
23: ; preds = %27, %17
%24 = load i8*, i8** %5
%25 = load i8, i8* %24
%26 = icmp ne i8 %25, 0
br i1 %26, label %27, label %33
27: ; preds = %23
%28 = load i8*, i8** %5
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %5
%30 = load i8, i8* %28
%31 = load i32*, i32** %4
%32 = call i32 @putc(i8 signext %30, i32* %31)
br label %23
33: ; preds = %23
ret i32 0
}

LLVM IR (-O2):
define i32 @fprintfc(i32* nocapture %0, i8* nocapture %1, i8 signext %2) {
%4 = load i8, i8* %1
%5 = icmp eq i8 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %3, %6
%7 = phi i8 [ %11, %6 ], [ %4, %3 ]
%8 = phi i8* [ %9, %6 ], [ %1, %3 ]
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = tail call i32 @putc(i8 signext %7, i32* %0)
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %6
13: ; preds = %6, %3
%14 = phi i8* [ %1, %3 ], [ %9, %6 ]
%15 = tail call i32 @putc(i8 signext %2, i32* %0)
%16 = getelementptr inbounds i8, i8* %14, i64 1
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
br i1 %18, label %26, label %19
19: ; preds = %13, %19
%20 = phi i8 [ %24, %19 ], [ %17, %13 ]
%21 = phi i8* [ %23, %19 ], [ %16, %13 ]
%22 = tail call i32 @putc(i8 signext %20, i32* %0)
%23 = getelementptr inbounds i8, i8* %21, i64 1
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 0
br i1 %25, label %26, label %19
26: ; preds = %19, %13
ret i32 0
}