#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*/ write_byte(char);
void out_char(char ch, int is_sprintf, char **output_buf_p, size_t max_char,
              unsigned int *num_parsed_p) {
  ++(*num_parsed_p);
  if (is_sprintf) {
    if (*num_parsed_p + 1 <= max_char) {
      **output_buf_p = ch;
      ++(*output_buf_p);
    }
  } else {
    write_byte(ch);
  }
}


x86 assembly (clang, -O0):
<out_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
cmpl   $0x0,-0x8(%rbp)
je     1176 <out_char+0x66>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
add    $0x1,%eax
mov    %eax,%eax
cmp    -0x18(%rbp),%rax
ja     1171 <out_char+0x61>
mov    -0x1(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    117f <out_char+0x6f>
movsbl -0x1(%rbp),%edi
call   1030 <write_byte@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<out_char>:
mov    (%r8),%r9d
lea    0x1(%r9),%eax
mov    %eax,(%r8)
test   %esi,%esi
je     1132 <out_char+0x22>
add    $0x2,%r9d
cmp    %rcx,%r9
ja     1131 <out_char+0x21>
mov    (%rdx),%rax
mov    %dil,(%rax)
addq   $0x1,(%rdx)
ret
movsbl %dil,%edi
jmp    1030 <write_byte@plt>

LLVM IR (-O0):
define void @out_char(i8 signext %0, i32 %1, i8** %2, i64 %3, i32* %4) {
%6 = alloca i8
%7 = alloca i32
%8 = alloca i8**
%9 = alloca i64
%10 = alloca i32*
store i8 %0, i8* %6
store i32 %1, i32* %7
store i8** %2, i8*** %8
store i64 %3, i64* %9
store i32* %4, i32** %10
%11 = load i32*, i32** %10
%12 = load i32, i32* %11
%13 = add i32 %12, 1
store i32 %13, i32* %11
%14 = load i32, i32* %7
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %31
16: ; preds = %5
%17 = load i32*, i32** %10
%18 = load i32, i32* %17
%19 = add i32 %18, 1
%20 = zext i32 %19 to i64
%21 = load i64, i64* %9
%22 = icmp ule i64 %20, %21
br i1 %22, label %23, label %30
23: ; preds = %16
%24 = load i8, i8* %6
%25 = load i8**, i8*** %8
%26 = load i8*, i8** %25
store i8 %24, i8* %26
%27 = load i8**, i8*** %8
%28 = load i8*, i8** %27
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %27
br label %30
30: ; preds = %23, %16
br label %34
31: ; preds = %5
%32 = load i8, i8* %6
%33 = call i32 @write_byte(i8 signext %32)
br label %34
34: ; preds = %31, %30
ret void
}

LLVM IR (-O2):
define void @out_char(i8 signext %0, i32 %1, i8** nocapture %2, i64 %3, i32* nocapture %4) {
%6 = load i32, i32* %4
%7 = add i32 %6, 1
store i32 %7, i32* %4
%8 = icmp eq i32 %1, 0
br i1 %8, label %17, label %9
9: ; preds = %5
%10 = add i32 %6, 2
%11 = zext i32 %10 to i64
%12 = icmp ugt i64 %11, %3
br i1 %12, label %19, label %13
13: ; preds = %9
%14 = load i8*, i8** %2
store i8 %0, i8* %14
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8* %16, i8** %2
br label %19
17: ; preds = %5
%18 = tail call i32 @write_byte(i8 signext %0)
br label %19
19: ; preds = %9, %13, %17
ret void
}