#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 */
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *, char *);
int strlen(char *);
int /*<<< orphan*/ writeError(int, char *, char *);
void summaryUsage(char **ppszSummary) {
  int iLength = 0;
  if (*ppszSummary == NULL) {
    iLength = strlen("Brute force module for PostgreSQL sessions") +
              strlen("2.0") + strlen("%s : version %s") +
              strlen("No usable LIBPQ. Module disabled.") + 1;
    *ppszSummary = (char *)malloc(iLength);
    memset(*ppszSummary, 0, iLength);
    snprintf(*ppszSummary, iLength, "%s : version %s (%s)",
             "Brute force module for PostgreSQL sessions", "2.0",
             "No usable LIBPQ. Module disabled.");
  } else {
    writeError(3,
               "%s reports an error in summaryUsage() : ppszSummary must be "
               "NULL when called",
               "postgres.mod");
  }
}


x86 assembly (clang, -O0):
<summaryUsage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1218 <summaryUsage+0xc8>
lea    0xe88(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x18(%rbp)
lea    0xea4(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
lea    0xe92(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
lea    0xe8c(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1070 <malloc@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0xc(%rbp),%edx
xor    %esi,%esi
call   1050 <memset@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0xc(%rbp),%esi
lea    0xe68(%rip),%rdx
lea    0xe00(%rip),%rcx
lea    0xe24(%rip),%r8
lea    0xe31(%rip),%r9
call   1040 <snprintf@plt>
jmp    1230 <summaryUsage+0xe0>
mov    $0x3,%edi
lea    0xe52(%rip),%rsi
lea    0xe98(%rip),%rdx
call   1060 <writeError@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<summaryUsage>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmpq   $0x0,(%rdi)
je     1187 <summaryUsage+0x37>
lea    0xf0e(%rip),%rsi
lea    0xf54(%rip),%rdx
mov    $0x3,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <writeError@plt>
mov    %rdi,%rbx
lea    0xe6f(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,%r13d
lea    0xe8b(%rip),%r15
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
lea    0xe7e(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,%r14d
lea    0xe7f(%rip),%r12
mov    %r12,%rdi
call   1030 <strlen@plt>
add    %r13d,%ebp
add    %r14d,%ebp
add    %eax,%ebp
add    $0x1,%ebp
mov    %ebp,%edi
call   1070 <malloc@plt>
mov    %rax,(%rbx)
mov    %rax,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   1050 <memset@plt>
mov    (%rbx),%rdi
lea    0xe6e(%rip),%rdx
mov    %ebp,%esi
lea    0xe04(%rip),%rcx
mov    %r15,%r8
mov    %r12,%r9
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <snprintf@plt>

LLVM IR (-O0):
@.str = [43 x i8] c"Brute force module for PostgreSQL sessions\00"
@.str.1 = [4 x i8] c"2.0\00"
@.str.2 = [16 x i8] c"%s : version %s\00"
@.str.3 = [34 x i8] c"No usable LIBPQ. Module disabled.\00"
@.str.4 = [21 x i8] c"%s : version %s (%s)\00"
@.str.5 = [77 x i8] c"%s reports an error in summaryUsage() : ppszSummary must be NULL when called\00"
@.str.6 = [13 x i8] c"postgres.mod\00"
define void @summaryUsage(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
store i8** %0, i8*** %2
store i32 0, i32* %3
%4 = load i8**, i8*** %2
%5 = load i8*, i8** %4
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %28
7: ; preds = %1
%8 = call i32 @strlen(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @strlen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%10 = add nsw i32 %8, %9
%11 = call i32 @strlen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%12 = add nsw i32 %10, %11
%13 = call i32 @strlen(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%14 = add nsw i32 %12, %13
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
%16 = load i32, i32* %3
%17 = call i64 @malloc(i32 %16)
%18 = inttoptr i64 %17 to i8*
%19 = load i8**, i8*** %2
store i8* %18, i8** %19
%20 = load i8**, i8*** %2
%21 = load i8*, i8** %20
%22 = load i32, i32* %3
%23 = call i32 @memset(i8* %21, i32 0, i32 %22)
%24 = load i8**, i8*** %2
%25 = load i8*, i8** %24
%26 = load i32, i32* %3
%27 = call i32 @snprintf(i8* %25, i32 %26, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
br label %30
28: ; preds = %1
%29 = call i32 @writeError(i32 3, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
br label %30
30: ; preds = %28, %7
ret void
}

LLVM IR (-O2):
@.str = [43 x i8] c"Brute force module for PostgreSQL sessions\00"
@.str.1 = [4 x i8] c"2.0\00"
@.str.2 = [16 x i8] c"%s : version %s\00"
@.str.3 = [34 x i8] c"No usable LIBPQ. Module disabled.\00"
@.str.4 = [21 x i8] c"%s : version %s (%s)\00"
@.str.5 = [77 x i8] c"%s reports an error in summaryUsage() : ppszSummary must be NULL when called\00"
@.str.6 = [13 x i8] c"postgres.mod\00"
define void @summaryUsage(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %18
4: ; preds = %1
%5 = tail call i32 @strlen(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @strlen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @strlen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 @strlen(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%9 = add i32 %5, 1
%10 = add i32 %9, %6
%11 = add i32 %10, %7
%12 = add i32 %11, %8
%13 = tail call i64 @malloc(i32 %12)
%14 = inttoptr i64 %13 to i8*
store i8* %14, i8** %0
%15 = tail call i32 @memset(i8* %14, i32 0, i32 %12)
%16 = load i8*, i8** %0
%17 = tail call i32 @snprintf(i8* %16, i32 %12, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
br label %20
18: ; preds = %1
%19 = tail call i32 @writeError(i32 3, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
br label %20
20: ; preds = %18, %4
ret void
}