#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*/ PrintChar(char);
int /*<<< orphan*/ PrintInt(int);
int /*<<< orphan*/ PrintString(char *);
void PrintfNormal(char *formatSpecifier, ...) {
  char *argPtr = (char *)(&formatSpecifier) + sizeof(char *);
  int argInt;
  char argChar;
  char *argStr;
  while ((*formatSpecifier) != '\0') {
    if ((*formatSpecifier) == '%') {
      formatSpecifier++;
      if ((*formatSpecifier) == 'd') {
        argInt = *((int *)argPtr);
        PrintInt(argInt);
        argPtr += sizeof(int);
      } else if ((*formatSpecifier) == 's') {
        argStr = *((char **)argPtr);
        PrintString(argStr);
        argPtr += sizeof(char *);
      } else if ((*formatSpecifier) == 'c') {
        argChar = *((char *)argPtr);
        PrintChar(argChar);
        argPtr += sizeof(char);
      } else {
        return;
      }
    } else {
      PrintChar((*formatSpecifier));
    }
    formatSpecifier++;
  }
}


x86 assembly (clang, -O0):
<PrintfNormal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     123f <PrintfNormal+0x10f>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x25,%eax
jne    1222 <PrintfNormal+0xf2>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x64,%eax
jne    11a6 <PrintfNormal+0x76>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <PrintInt@plt>
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
jmp    121d <PrintfNormal+0xed>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x73,%eax
jne    11db <PrintfNormal+0xab>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <PrintString@plt>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1218 <PrintfNormal+0xe8>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x63,%eax
jne    120e <PrintfNormal+0xde>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x15(%rbp)
movsbl -0x15(%rbp),%edi
call   1030 <PrintChar@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1213 <PrintfNormal+0xe3>
jmp    123f <PrintfNormal+0x10f>
jmp    1218 <PrintfNormal+0xe8>
jmp    121d <PrintfNormal+0xed>
jmp    122e <PrintfNormal+0xfe>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <PrintChar@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1148 <PrintfNormal+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintfNormal>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r15
mov    %rdi,0x8(%rsp)
lea    0x10(%rsp),%r14
jmp    116c <PrintfNormal+0x3c>
movsbl (%r14),%edi
call   1030 <PrintChar@plt>
add    $0x1,%r14
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rbx
mov    %rbx,0x8(%rsp)
mov    %rbx,%r15
movzbl (%r15),%eax
cmp    $0x25,%al
je     1190 <PrintfNormal+0x60>
test   %al,%al
je     11c6 <PrintfNormal+0x96>
movsbl %al,%edi
call   1030 <PrintChar@plt>
mov    %r15,%rbx
jmp    1160 <PrintfNormal+0x30>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0x1(%r15),%rbx
mov    %rbx,0x8(%rsp)
movzbl 0x1(%r15),%eax
cmp    $0x63,%al
je     1148 <PrintfNormal+0x18>
cmp    $0x73,%al
je     11b8 <PrintfNormal+0x88>
cmp    $0x64,%al
jne    11c6 <PrintfNormal+0x96>
mov    (%r14),%edi
call   1040 <PrintInt@plt>
add    $0x4,%r14
jmp    1160 <PrintfNormal+0x30>
mov    (%r14),%rdi
call   1050 <PrintString@plt>
add    $0x8,%r14
jmp    1160 <PrintfNormal+0x30>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @PrintfNormal(i8* %0, ...) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8
%6 = alloca i8*
store i8* %0, i8** %2
%7 = bitcast i8** %2 to i8*
%8 = getelementptr inbounds i8, i8* %7, i64 8
store i8* %8, i8** %3
br label %9
9: ; preds = %67, %1
%10 = load i8*, i8** %2
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %70
14: ; preds = %9
%15 = load i8*, i8** %2
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 37
br i1 %18, label %19, label %63
19: ; preds = %14
%20 = load i8*, i8** %2
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %2
%22 = load i8*, i8** %2
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 100
br i1 %25, label %26, label %34
26: ; preds = %19
%27 = load i8*, i8** %3
%28 = bitcast i8* %27 to i32*
%29 = load i32, i32* %28
store i32 %29, i32* %4
%30 = load i32, i32* %4
%31 = call i32 @PrintInt(i32 %30)
%32 = load i8*, i8** %3
%33 = getelementptr inbounds i8, i8* %32, i64 4
store i8* %33, i8** %3
br label %62
34: ; preds = %19
%35 = load i8*, i8** %2
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 115
br i1 %38, label %39, label %47
39: ; preds = %34
%40 = load i8*, i8** %3
%41 = bitcast i8* %40 to i8**
%42 = load i8*, i8** %41
store i8* %42, i8** %6
%43 = load i8*, i8** %6
%44 = call i32 @PrintString(i8* %43)
%45 = load i8*, i8** %3
%46 = getelementptr inbounds i8, i8* %45, i64 8
store i8* %46, i8** %3
br label %61
47: ; preds = %34
%48 = load i8*, i8** %2
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 99
br i1 %51, label %52, label %59
52: ; preds = %47
%53 = load i8*, i8** %3
%54 = load i8, i8* %53
store i8 %54, i8* %5
%55 = load i8, i8* %5
%56 = call i32 @PrintChar(i8 signext %55)
%57 = load i8*, i8** %3
%58 = getelementptr inbounds i8, i8* %57, i64 1
store i8* %58, i8** %3
br label %60
59: ; preds = %47
br label %70
60: ; preds = %52
br label %61
61: ; preds = %60, %39
br label %62
62: ; preds = %61, %26
br label %67
63: ; preds = %14
%64 = load i8*, i8** %2
%65 = load i8, i8* %64
%66 = call i32 @PrintChar(i8 signext %65)
br label %67
67: ; preds = %63, %62
%68 = load i8*, i8** %2
%69 = getelementptr inbounds i8, i8* %68, i32 1
store i8* %69, i8** %2
br label %9
70: ; preds = %59, %9
ret void
}

LLVM IR (-O2):
define void @PrintfNormal(i8* %0, ...) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = getelementptr inbounds i8*, i8** %2, i64 1
%4 = bitcast i8** %3 to i8*
br label %5
5: ; preds = %28, %1
%6 = phi i8* [ %0, %1 ], [ %31, %28 ]
%7 = phi i8* [ %4, %1 ], [ %30, %28 ]
%8 = load i8, i8* %6
switch i8 %8, label %26 [
i8 0, label %32
i8 37, label %9
]
9: ; preds = %5
%10 = getelementptr inbounds i8, i8* %6, i64 1
store i8* %10, i8** %2
%11 = load i8, i8* %10
switch i8 %11, label %32 [
i8 100, label %12
i8 115, label %17
i8 99, label %22
]
12: ; preds = %9
%13 = bitcast i8* %7 to i32*
%14 = load i32, i32* %13
%15 = tail call i32 @PrintInt(i32 %14)
%16 = getelementptr inbounds i8, i8* %7, i64 4
br label %28
17: ; preds = %9
%18 = bitcast i8* %7 to i8**
%19 = load i8*, i8** %18
%20 = tail call i32 @PrintString(i8* %19)
%21 = getelementptr inbounds i8, i8* %7, i64 8
br label %28
22: ; preds = %9
%23 = load i8, i8* %7
%24 = tail call i32 @PrintChar(i8 signext %23)
%25 = getelementptr inbounds i8, i8* %7, i64 1
br label %28
26: ; preds = %5
%27 = tail call i32 @PrintChar(i8 signext %8)
br label %28
28: ; preds = %12, %22, %17, %26
%29 = phi i8* [ %10, %12 ], [ %10, %17 ], [ %10, %22 ], [ %6, %26 ]
%30 = phi i8* [ %16, %12 ], [ %21, %17 ], [ %25, %22 ], [ %7, %26 ]
%31 = getelementptr inbounds i8, i8* %29, i64 1
store i8* %31, i8** %2
br label %5
32: ; preds = %5, %9
ret void
}