#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*/ fputc(char, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void test_fputc() {
  char c;
  fputc('#', stdout);
  for (c = 'A'; c <= 'Z'; c++)
    fputc(c, stdout);
  fputc('\n', stdout);
}


x86 assembly (clang, -O0):
<test_fputc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec1(%rip),%rax
mov    (%rax),%esi
mov    $0x23,%edi
call   1030 <fputc@plt>
movb   $0x41,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x5a,%eax
jg     115d <test_fputc+0x4d>
mov    -0x1(%rbp),%al
mov    0x2e9a(%rip),%rcx
mov    (%rcx),%esi
movsbl %al,%edi
call   1030 <fputc@plt>
mov    -0x1(%rbp),%al
add    $0x1,%al
mov    %al,-0x1(%rbp)
jmp    112f <test_fputc+0x1f>
mov    0x2e7c(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1030 <fputc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_fputc>:
push   %rbx
mov    0x2ec8(%rip),%rbx
mov    (%rbx),%esi
mov    $0x23,%edi
call   1030 <fputc@plt>
mov    (%rbx),%esi
mov    $0x41,%edi
call   1030 <fputc@plt>
mov    (%rbx),%esi
mov    $0x42,%edi
call   1030 <fputc@plt>
mov    (%rbx),%esi
mov    $0x43,%edi
call   1030 <fputc@plt>
mov    (%rbx),%esi
mov    $0x44,%edi
call   1030 <fputc@plt>
mov    (%rbx),%esi
mov    $0x45,%edi
call   1030 <fputc@plt>
mov    (%rbx),%esi
mov    $0x46,%edi
call   1030 <fputc@plt>
mov    (%rbx),%esi
mov    $0x47,%edi
call   1030 <fputc@plt>
mov    (%rbx),%esi
mov    $0x48,%edi
call   1030 <fputc@plt>
mov    (%rbx),%esi
mov    $0x49,%edi
call   1030 <fputc@plt>
mov    (%rbx),%esi
mov    $0x4a,%edi
call   1030 <fputc@plt>
mov    (%rbx),%esi
mov    $0x4b,%edi
call   1030 <fputc@plt>
mov    (%rbx),%esi
mov    $0x4c,%edi
call   1030 <fputc@plt>
mov    (%rbx),%esi
mov    $0x4d,%edi
call   1030 <fputc@plt>
mov    (%rbx),%esi
mov    $0x4e,%edi
call   1030 <fputc@plt>
mov    (%rbx),%esi
mov    $0x4f,%edi
call   1030 <fputc@plt>
mov    (%rbx),%esi
mov    $0x50,%edi
call   1030 <fputc@plt>
mov    (%rbx),%esi
mov    $0x51,%edi
call   1030 <fputc@plt>
mov    (%rbx),%esi
mov    $0x52,%edi
call   1030 <fputc@plt>
mov    (%rbx),%esi
mov    $0x53,%edi
call   1030 <fputc@plt>
mov    (%rbx),%esi
mov    $0x54,%edi
call   1030 <fputc@plt>
mov    (%rbx),%esi
mov    $0x55,%edi
call   1030 <fputc@plt>
mov    (%rbx),%esi
mov    $0x56,%edi
call   1030 <fputc@plt>
mov    (%rbx),%esi
mov    $0x57,%edi
call   1030 <fputc@plt>
mov    (%rbx),%esi
mov    $0x58,%edi
call   1030 <fputc@plt>
mov    (%rbx),%esi
mov    $0x59,%edi
call   1030 <fputc@plt>
mov    (%rbx),%esi
mov    $0x5a,%edi
call   1030 <fputc@plt>
mov    (%rbx),%esi
mov    $0xa,%edi
pop    %rbx
jmp    1030 <fputc@plt>

LLVM IR (-O0):
@stdout = global i32 0
define void @test_fputc() {
%1 = alloca i8
%2 = load i32, i32* @stdout
%3 = call i32 @fputc(i8 signext 35, i32 %2)
store i8 65, i8* %1
br label %4
4: ; preds = %12, %0
%5 = load i8, i8* %1
%6 = sext i8 %5 to i32
%7 = icmp sle i32 %6, 90
br i1 %7, label %8, label %15
8: ; preds = %4
%9 = load i8, i8* %1
%10 = load i32, i32* @stdout
%11 = call i32 @fputc(i8 signext %9, i32 %10)
br label %12
12: ; preds = %8
%13 = load i8, i8* %1
%14 = add i8 %13, 1
store i8 %14, i8* %1
br label %4
15: ; preds = %4
%16 = load i32, i32* @stdout
%17 = call i32 @fputc(i8 signext 10, i32 %16)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
define void @test_fputc() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fputc(i8 signext 35, i32 %1)
%3 = load i32, i32* @stdout
%4 = tail call i32 @fputc(i8 signext 65, i32 %3)
%5 = load i32, i32* @stdout
%6 = tail call i32 @fputc(i8 signext 66, i32 %5)
%7 = load i32, i32* @stdout
%8 = tail call i32 @fputc(i8 signext 67, i32 %7)
%9 = load i32, i32* @stdout
%10 = tail call i32 @fputc(i8 signext 68, i32 %9)
%11 = load i32, i32* @stdout
%12 = tail call i32 @fputc(i8 signext 69, i32 %11)
%13 = load i32, i32* @stdout
%14 = tail call i32 @fputc(i8 signext 70, i32 %13)
%15 = load i32, i32* @stdout
%16 = tail call i32 @fputc(i8 signext 71, i32 %15)
%17 = load i32, i32* @stdout
%18 = tail call i32 @fputc(i8 signext 72, i32 %17)
%19 = load i32, i32* @stdout
%20 = tail call i32 @fputc(i8 signext 73, i32 %19)
%21 = load i32, i32* @stdout
%22 = tail call i32 @fputc(i8 signext 74, i32 %21)
%23 = load i32, i32* @stdout
%24 = tail call i32 @fputc(i8 signext 75, i32 %23)
%25 = load i32, i32* @stdout
%26 = tail call i32 @fputc(i8 signext 76, i32 %25)
%27 = load i32, i32* @stdout
%28 = tail call i32 @fputc(i8 signext 77, i32 %27)
%29 = load i32, i32* @stdout
%30 = tail call i32 @fputc(i8 signext 78, i32 %29)
%31 = load i32, i32* @stdout
%32 = tail call i32 @fputc(i8 signext 79, i32 %31)
%33 = load i32, i32* @stdout
%34 = tail call i32 @fputc(i8 signext 80, i32 %33)
%35 = load i32, i32* @stdout
%36 = tail call i32 @fputc(i8 signext 81, i32 %35)
%37 = load i32, i32* @stdout
%38 = tail call i32 @fputc(i8 signext 82, i32 %37)
%39 = load i32, i32* @stdout
%40 = tail call i32 @fputc(i8 signext 83, i32 %39)
%41 = load i32, i32* @stdout
%42 = tail call i32 @fputc(i8 signext 84, i32 %41)
%43 = load i32, i32* @stdout
%44 = tail call i32 @fputc(i8 signext 85, i32 %43)
%45 = load i32, i32* @stdout
%46 = tail call i32 @fputc(i8 signext 86, i32 %45)
%47 = load i32, i32* @stdout
%48 = tail call i32 @fputc(i8 signext 87, i32 %47)
%49 = load i32, i32* @stdout
%50 = tail call i32 @fputc(i8 signext 88, i32 %49)
%51 = load i32, i32* @stdout
%52 = tail call i32 @fputc(i8 signext 89, i32 %51)
%53 = load i32, i32* @stdout
%54 = tail call i32 @fputc(i8 signext 90, i32 %53)
%55 = load i32, i32* @stdout
%56 = tail call i32 @fputc(i8 signext 10, i32 %55)
ret void
}