#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int c_fprintf(char *lfmt, char *msg, char *rfmt, char *sfmt) {
  if (strcmp(lfmt, "r") == 0)
    fprintf(stderr, "\r");
  if (strcmp(lfmt, "n") == 0)
    fprintf(stderr, "\n");
  if (strcmp(lfmt, "nn") == 0)
    fprintf(stderr, "\n\n");
  fprintf(stderr, sfmt, msg);
  if (strcmp(rfmt, "n") == 0)
    fprintf(stderr, "\n");
  if (strcmp(rfmt, "nn") == 0)
    fprintf(stderr, "\n\n");
  fflush(stderr);
  return 0;
}


x86 assembly (clang, -O0):
<c_fprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xead(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1179 <c_fprintf+0x49>
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
lea    0xe90(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe81(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11aa <c_fprintf+0x7a>
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
lea    0xe65(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe4f(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11db <c_fprintf+0xab>
mov    0x2e15(%rip),%rax
mov    (%rax),%edi
lea    0xe33(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2dfe(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe07(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1224 <c_fprintf+0xf4>
mov    0x2dcc(%rip),%rax
mov    (%rax),%edi
lea    0xdeb(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xdd5(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1255 <c_fprintf+0x125>
mov    0x2d9b(%rip),%rax
mov    (%rax),%edi
lea    0xdb9(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2d84(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_fprintf>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xeb5(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    116c <c_fprintf+0x3c>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
lea    0xe9d(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xe92(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    1197 <c_fprintf+0x67>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
lea    0xe78(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xe66(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    11c2 <c_fprintf+0x92>
mov    0x2e2e(%rip),%rax
mov    (%rax),%edi
lea    0xe4c(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x2e17(%rip),%rbx
mov    (%rbx),%edi
mov    %r14,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xe26(%rip),%rsi
mov    %r12,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    11fc <c_fprintf+0xcc>
mov    (%rbx),%edi
lea    0xe13(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xe01(%rip),%rsi
mov    %r12,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    1220 <c_fprintf+0xf0>
mov    (%rbx),%edi
lea    0xdee(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%rbx),%edi
call   1050 <fflush@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [2 x i8] c"\0D\00"
@.str.2 = [2 x i8] c"n\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [3 x i8] c"nn\00"
@.str.5 = [3 x i8] c"\0A\0A\00"
define i32 @c_fprintf(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %5
%10 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %4
%13 = load i32, i32* @stderr
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %12, %4
%16 = load i8*, i8** %5
%17 = call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = load i32, i32* @stderr
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %22
22: ; preds = %19, %15
%23 = load i8*, i8** %5
%24 = call i64 @strcmp(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %22
%27 = load i32, i32* @stderr
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %29
29: ; preds = %26, %22
%30 = load i32, i32* @stderr
%31 = load i8*, i8** %8
%32 = load i8*, i8** %6
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* %31, i8* %32)
%34 = load i8*, i8** %7
%35 = call i64 @strcmp(i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %40
37: ; preds = %29
%38 = load i32, i32* @stderr
%39 = call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %40
40: ; preds = %37, %29
%41 = load i8*, i8** %7
%42 = call i64 @strcmp(i8* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %47
44: ; preds = %40
%45 = load i32, i32* @stderr
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %47
47: ; preds = %44, %40
%48 = load i32, i32* @stderr
%49 = call i32 @fflush(i32 %48)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [2 x i8] c"\0D\00"
@.str.2 = [2 x i8] c"n\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [3 x i8] c"nn\00"
@.str.5 = [3 x i8] c"\0A\0A\00"
define i32 @c_fprintf(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = load i32, i32* @stderr
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %7, %4
%11 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i32, i32* @stderr
%15 = tail call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %16
16: ; preds = %13, %10
%17 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i32, i32* @stderr
%21 = tail call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %22
22: ; preds = %19, %16
%23 = load i32, i32* @stderr
%24 = tail call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* %3, i8* %1)
%25 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %22
%28 = load i32, i32* @stderr
%29 = tail call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %30
30: ; preds = %27, %22
%31 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = load i32, i32* @stderr
%35 = tail call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %36
36: ; preds = %33, %30
%37 = load i32, i32* @stderr
%38 = tail call i32 @fflush(i32 %37)
ret i32 0
}