#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 */
struct raster {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ drawcharseg(struct raster *, int, int, char *, int, int, int,
                               int);
char *getcharseg(char);
void drawchar(struct raster *ra, int x, int y, int c, int size, int r, int g,
              int b) {
  char *seg;
  seg = getcharseg(c);
  if (!seg)
    seg = getcharseg('?');
  drawcharseg(ra, x, y, seg, size, r, g, b);
}


x86 assembly (clang, -O0):
<drawchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
movsbl %al,%edi
call   1030 <getcharseg@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    116b <drawchar+0x4b>
mov    $0x3f,%edi
call   1030 <getcharseg@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
mov    0x10(%rbp),%r10d
mov    0x18(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1040 <drawcharseg@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawchar>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r9d,%r14d
mov    %r8d,%r15d
mov    %edx,%r12d
mov    %esi,%ebp
mov    %rdi,%rbx
movsbl %cl,%edi
call   1030 <getcharseg@plt>
test   %rax,%rax
jne    114d <drawchar+0x2d>
mov    $0x3f,%edi
call   1030 <getcharseg@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r12d,%edx
mov    %rax,%rcx
mov    %r15d,%r8d
mov    %r14d,%r9d
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <drawcharseg@plt>

LLVM IR (-O0):
%struct.raster = type { i32 }
define void @drawchar(%struct.raster* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7) {
%9 = alloca %struct.raster*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8*
store %struct.raster* %0, %struct.raster** %9
store i32 %1, i32* %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store i32 %6, i32* %15
store i32 %7, i32* %16
%18 = load i32, i32* %12
%19 = trunc i32 %18 to i8
%20 = call i8* @getcharseg(i8 signext %19)
store i8* %20, i8** %17
%21 = load i8*, i8** %17
%22 = icmp ne i8* %21, null
br i1 %22, label %25, label %23
23: ; preds = %8
%24 = call i8* @getcharseg(i8 signext 63)
store i8* %24, i8** %17
br label %25
25: ; preds = %23, %8
%26 = load %struct.raster*, %struct.raster** %9
%27 = load i32, i32* %10
%28 = load i32, i32* %11
%29 = load i8*, i8** %17
%30 = load i32, i32* %13
%31 = load i32, i32* %14
%32 = load i32, i32* %15
%33 = load i32, i32* %16
%34 = call i32 @drawcharseg(%struct.raster* %26, i32 %27, i32 %28, i8* %29, i32 %30, i32 %31, i32 %32, i32 %33)
ret void
}

LLVM IR (-O2):
%struct.raster = type { i32 }
define void @drawchar(%struct.raster* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7) {
%9 = trunc i32 %3 to i8
%10 = tail call i8* @getcharseg(i8 signext %9)
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = tail call i8* @getcharseg(i8 signext 63)
br label %14
14: ; preds = %12, %8
%15 = phi i8* [ %10, %8 ], [ %13, %12 ]
%16 = tail call i32 @drawcharseg(%struct.raster* %0, i32 %1, i32 %2, i8* %15, i32 %4, i32 %5, i32 %6, i32 %7)
ret void
}