#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*/ exit(int);
int /*<<< orphan*/ printf(char *, char *, char *);
char *strstr(char *, char *);
void check_percent_ess(char *value, char *name) {
  int OK = 0;
  char *p = strstr(value, "%s");
  if (p != NULL)
    OK = strstr(p + 2, "%s") == NULL;
  if (!OK) {
    printf("\n*** \"%s\" (%s) must contain precisely one occurrence of\n"
           "*** \"%%s\". Please review your build-time configuration.\n\n/",
           value, name);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<check_percent_ess>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeae(%rip),%rsi
call   1050 <strstr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1189 <check_percent_ess+0x59>
mov    -0x20(%rbp),%rdi
add    $0x2,%rdi
lea    0xe8b(%rip),%rsi
call   1050 <strstr@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    11b1 <check_percent_ess+0x81>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xe61(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_percent_ess>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xebf(%rip),%rsi
call   1050 <strstr@plt>
test   %rax,%rax
je     116b <check_percent_ess+0x3b>
add    $0x2,%rax
lea    0xeaa(%rip),%rsi
mov    %rax,%rdi
call   1050 <strstr@plt>
test   %rax,%rax
jne    116b <check_percent_ess+0x3b>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe91(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [115 x i8] c"\0A*** \22%s\22 (%s) must contain precisely one occurrence of\0A*** \22%%s\22. Please review your build-time configuration.\0A\0A/\00"
define void @check_percent_ess(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %5
%7 = load i8*, i8** %3
%8 = call i8* @strstr(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %8, i8** %6
%9 = load i8*, i8** %6
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = load i8*, i8** %6
%13 = getelementptr inbounds i8, i8* %12, i64 2
%14 = call i8* @strstr(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%15 = icmp eq i8* %14, null
%16 = zext i1 %15 to i32
store i32 %16, i32* %5
br label %17
17: ; preds = %11, %2
%18 = load i32, i32* %5
%19 = icmp ne i32 %18, 0
br i1 %19, label %25, label %20
20: ; preds = %17
%21 = load i8*, i8** %3
%22 = load i8*, i8** %4
%23 = call i32 @printf(i8* getelementptr inbounds ([115 x i8], [115 x i8]* @.str.1, i64 0, i64 0), i8* %21, i8* %22)
%24 = call i32 @exit(i32 1)
unreachable
25: ; preds = %17
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [115 x i8] c"\0A*** \22%s\22 (%s) must contain precisely one occurrence of\0A*** \22%%s\22. Please review your build-time configuration.\0A\0A/\00"
define void @check_percent_ess(i8* %0, i8* %1) {
%3 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i8* %3, null
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %3, i64 2
%7 = tail call i8* @strstr(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i8* %7, null
br i1 %8, label %12, label %9
9: ; preds = %2, %5
%10 = tail call i32 @printf(i8* getelementptr inbounds ([115 x i8], [115 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %1)
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %5
ret void
}