#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 *);
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 REXEC sessions") + strlen("2.0") +
              strlen("%s : version %s") + 1;
    *ppszSummary = (char *)malloc(iLength);
    memset(*ppszSummary, 0, iLength);
    snprintf(*ppszSummary, iLength, "%s : version %s",
             "Brute force module for REXEC sessions", "2.0");
  } else {
    writeError(3,
               "%s reports an error in summaryUsage() : ppszSummary must be "
               "NULL when called",
               "rexec.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    11fb <summaryUsage+0xab>
lea    0xe88(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
lea    0xe9f(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
lea    0xe8d(%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    0xe47(%rip),%rdx
lea    0xe16(%rip),%rcx
lea    0xe35(%rip),%r8
call   1040 <snprintf@plt>
jmp    1213 <summaryUsage+0xc3>
mov    $0x3,%edi
lea    0xe33(%rip),%rsi
lea    0xe79(%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    0xed2(%rip),%rsi
lea    0xf18(%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),%r14
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%r12d
lea    0xe83(%rip),%r15
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
lea    0xe76(%rip),%r13
mov    %r13,%rdi
call   1030 <strlen@plt>
add    %r12d,%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
mov    %ebp,%esi
mov    %r13,%rdx
mov    %r14,%rcx
mov    %r15,%r8
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <snprintf@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"Brute force module for REXEC sessions\00"
@.str.1 = [4 x i8] c"2.0\00"
@.str.2 = [16 x i8] c"%s : version %s\00"
@.str.3 = [77 x i8] c"%s reports an error in summaryUsage() : ppszSummary must be NULL when called\00"
@.str.4 = [10 x i8] c"rexec.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 %26
7: ; preds = %1
%8 = call i32 @strlen(i8* getelementptr inbounds ([38 x i8], [38 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 = add nsw i32 %12, 1
store i32 %13, i32* %3
%14 = load i32, i32* %3
%15 = call i64 @malloc(i32 %14)
%16 = inttoptr i64 %15 to i8*
%17 = load i8**, i8*** %2
store i8* %16, i8** %17
%18 = load i8**, i8*** %2
%19 = load i8*, i8** %18
%20 = load i32, i32* %3
%21 = call i32 @memset(i8* %19, i32 0, i32 %20)
%22 = load i8**, i8*** %2
%23 = load i8*, i8** %22
%24 = load i32, i32* %3
%25 = call i32 @snprintf(i8* %23, i32 %24, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %28
26: ; preds = %1
%27 = call i32 @writeError(i32 3, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
br label %28
28: ; preds = %26, %7
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c"Brute force module for REXEC sessions\00"
@.str.1 = [4 x i8] c"2.0\00"
@.str.2 = [16 x i8] c"%s : version %s\00"
@.str.3 = [77 x i8] c"%s reports an error in summaryUsage() : ppszSummary must be NULL when called\00"
@.str.4 = [10 x i8] c"rexec.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 %16
4: ; preds = %1
%5 = tail call i32 @strlen(i8* getelementptr inbounds ([38 x i8], [38 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 = add i32 %5, 1
%9 = add i32 %8, %6
%10 = add i32 %9, %7
%11 = tail call i64 @malloc(i32 %10)
%12 = inttoptr i64 %11 to i8*
store i8* %12, i8** %0
%13 = tail call i32 @memset(i8* %12, i32 0, i32 %10)
%14 = load i8*, i8** %0
%15 = tail call i32 @snprintf(i8* %14, i32 %10, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %18
16: ; preds = %1
%17 = tail call i32 @writeError(i32 3, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
br label %18
18: ; preds = %16, %4
ret void
}