#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 */
char *Format(int /*<<< orphan*/ *, char const *, int /*<<< orphan*/, char *,
             char *, char *, char *, char *, char *, char *);
int /*<<< orphan*/ free(char *);
bool FormatIsValid(const char *format) {
  char *f;
  f = Format(NULL, format, 0, "", "", "", "", "", "", "");
  free(f);
  return f != NULL;
}


x86 assembly (clang, -O0):
<FormatIsValid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
xor    %edx,%edx
lea    0xec3(%rip),%rax
mov    %rax,%rcx
mov    %rax,%r8
mov    %rax,%r9
mov    %rax,(%rsp)
mov    %rax,0x8(%rsp)
mov    %rax,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   1040 <Format@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FormatIsValid>:
push   %rbx
mov    %rdi,%rsi
lea    0xed5(%rip),%rcx
xor    %edi,%edi
xor    %edx,%edx
mov    %rcx,%r8
mov    %rcx,%r9
push   %rcx
push   %rcx
push   %rcx
push   %rcx
call   1040 <Format@plt>
add    $0x20,%rsp
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <free@plt>
xor    %eax,%eax
test   %rbx,%rbx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i32 @FormatIsValid(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @Format(i32* null, i8* %4, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @free(i8* %6)
%8 = load i8*, i8** %3
%9 = icmp ne i8* %8, null
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i32 @FormatIsValid(i8* %0) {
%2 = tail call i8* @Format(i32* null, i8* %0, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @free(i8* %2)
%4 = icmp ne i8* %2, null
%5 = zext i1 %4 to i32
ret i32 %5
}