#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 */
scalar_t__ islower(char);
int /*<<< orphan*/ putc(char, int /*<<< orphan*/ *);
char strlen(char *);
char toupper(char);
void putpsstring(FILE *res, char *fontname) {
  putc(strlen(fontname), res);
  if (*fontname) {
    if (islower(*fontname))
      putc(toupper(*fontname), res);
    else
      putc(*fontname, res);
    for (++fontname; *fontname; ++fontname)
      putc(*fontname, res);
  }
}


x86 assembly (clang, -O0):
<putpsstring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1060 <putc@plt>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11f8 <putpsstring+0xb8>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <islower@plt>
cmp    $0x0,%rax
je     11a5 <putpsstring+0x65>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <toupper@plt>
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1060 <putc@plt>
jmp    11b7 <putpsstring+0x77>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1060 <putc@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11f3 <putpsstring+0xb3>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1060 <putc@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11c3 <putpsstring+0x83>
jmp    11f8 <putpsstring+0xb8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putpsstring>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1050 <strlen@plt>
movsbl %al,%edi
mov    %r14,%rsi
call   1060 <putc@plt>
mov    (%rbx),%al
test   %al,%al
je     11b6 <putpsstring+0x76>
movsbl %al,%edi
call   1030 <islower@plt>
mov    %rax,%rcx
mov    (%rbx),%al
test   %rcx,%rcx
je     117d <putpsstring+0x3d>
movsbl %al,%edi
call   1040 <toupper@plt>
movsbl %al,%edi
mov    %r14,%rsi
call   1060 <putc@plt>
mov    0x1(%rbx),%al
test   %al,%al
je     11b6 <putpsstring+0x76>
add    $0x2,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %al,%edi
mov    %r14,%rsi
call   1060 <putc@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    11a0 <putpsstring+0x60>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @putpsstring(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = call signext i8 @strlen(i8* %5)
%7 = load i32*, i32** %3
%8 = call i32 @putc(i8 signext %6, i32* %7)
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
br i1 %11, label %12, label %44
12: ; preds = %2
%13 = load i8*, i8** %4
%14 = load i8, i8* %13
%15 = call i64 @islower(i8 signext %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %12
%18 = load i8*, i8** %4
%19 = load i8, i8* %18
%20 = call signext i8 @toupper(i8 signext %19)
%21 = load i32*, i32** %3
%22 = call i32 @putc(i8 signext %20, i32* %21)
br label %28
23: ; preds = %12
%24 = load i8*, i8** %4
%25 = load i8, i8* %24
%26 = load i32*, i32** %3
%27 = call i32 @putc(i8 signext %25, i32* %26)
br label %28
28: ; preds = %23, %17
%29 = load i8*, i8** %4
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** %4
br label %31
31: ; preds = %40, %28
%32 = load i8*, i8** %4
%33 = load i8, i8* %32
%34 = icmp ne i8 %33, 0
br i1 %34, label %35, label %43
35: ; preds = %31
%36 = load i8*, i8** %4
%37 = load i8, i8* %36
%38 = load i32*, i32** %3
%39 = call i32 @putc(i8 signext %37, i32* %38)
br label %40
40: ; preds = %35
%41 = load i8*, i8** %4
%42 = getelementptr inbounds i8, i8* %41, i32 1
store i8* %42, i8** %4
br label %31
43: ; preds = %31
br label %44
44: ; preds = %43, %2
ret void
}

LLVM IR (-O2):
define void @putpsstring(i32* nocapture %0, i8* %1) {
%3 = tail call signext i8 @strlen(i8* %1)
%4 = tail call i32 @putc(i8 signext %3, i32* %0)
%5 = load i8, i8* %1
%6 = icmp eq i8 %5, 0
br i1 %6, label %26, label %7
7: ; preds = %2
%8 = tail call i64 @islower(i8 signext %5)
%9 = icmp eq i64 %8, 0
%10 = load i8, i8* %1
br i1 %9, label %13, label %11
11: ; preds = %7
%12 = tail call signext i8 @toupper(i8 signext %10)
br label %13
13: ; preds = %7, %11
%14 = phi i8 [ %12, %11 ], [ %10, %7 ]
%15 = tail call i32 @putc(i8 signext %14, i32* %0)
%16 = getelementptr inbounds i8, i8* %1, 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, %2
ret void
}