#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 */
typedef int int16_t;

/* Variables and functions */
int EIO;
int createQueryURL(char const *, int, char const *, char *, int, char const **,
                   char const **, char **);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int snprintf(char *, int, char *, int);
int createUrlForSETREPLICATION(const char *host, int nnPort, const char *path,
                               int16_t replication, const char *user,
                               char **url) {
  char repStr[6];
  const char *paraNames[2], *paraValues[2];
  int strlength;
  memset(repStr, 0, 6);
  if (replication > 0) {
    strlength = snprintf(repStr, 6, "%u", replication);
    if (strlength < 0 || strlength >= 6) {
      return EIO;
    }
  }
  paraNames[0] = "replication";
  paraNames[1] = "user.name";
  paraValues[0] = repStr;
  paraValues[1] = user;
  return createQueryURL(host, nnPort, path, "SETREPLICATION", 2, paraNames,
                        paraValues, url);
}


x86 assembly (clang, -O0):
<createUrlForSETREPLICATION>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
lea    -0x3e(%rbp),%rdi
xor    %esi,%esi
mov    $0x6,%edx
call   1050 <memset@plt>
cmpl   $0x0,-0x24(%rbp)
jle    11b0 <createUrlForSETREPLICATION+0x80>
lea    -0x3e(%rbp),%rdi
mov    -0x24(%rbp),%ecx
mov    $0x6,%esi
lea    0xe82(%rip),%rdx
call   1030 <snprintf@plt>
mov    %eax,-0x64(%rbp)
cmpl   $0x0,-0x64(%rbp)
jl     119a <createUrlForSETREPLICATION+0x6a>
cmpl   $0x6,-0x64(%rbp)
jl     11ab <createUrlForSETREPLICATION+0x7b>
mov    0x2e3f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    120b <createUrlForSETREPLICATION+0xdb>
jmp    11b0 <createUrlForSETREPLICATION+0x80>
lea    0xe4c(%rip),%rax
mov    %rax,-0x50(%rbp)
lea    0xe4d(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    -0x3e(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
lea    -0x50(%rbp),%r9
lea    -0x60(%rbp),%r10
mov    -0x38(%rbp),%rax
lea    0xe25(%rip),%rcx
mov    $0x2,%r8d
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1040 <createQueryURL@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createUrlForSETREPLICATION>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9,0x8(%rsp)
mov    %r8,%rbp
mov    %ecx,%r14d
mov    %rdx,%r15
mov    %esi,%r12d
mov    %rdi,%rbx
lea    0x2(%rsp),%r13
mov    %r13,%rdi
xor    %esi,%esi
mov    $0x6,%edx
call   1050 <memset@plt>
test   %r14d,%r14d
jle    1194 <createUrlForSETREPLICATION+0x64>
lea    0xe8e(%rip),%rdx
lea    0x2(%rsp),%rdi
mov    $0x6,%esi
mov    %r14d,%ecx
call   1030 <snprintf@plt>
cmp    $0x6,%eax
jb     1194 <createUrlForSETREPLICATION+0x64>
mov    0x2e50(%rip),%rax
mov    (%rax),%eax
jmp    11e4 <createUrlForSETREPLICATION+0xb4>
lea    0xe68(%rip),%rax
mov    %rax,0x20(%rsp)
lea    0xe68(%rip),%rax
mov    %rax,0x28(%rsp)
mov    %r13,0x10(%rsp)
mov    %rbp,0x18(%rsp)
lea    0x10(%rsp),%rax
lea    0xe57(%rip),%rcx
lea    0x20(%rsp),%r9
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %r15,%rdx
mov    $0x2,%r8d
push   0x8(%rsp)
push   %rax
call   1040 <createQueryURL@plt>
add    $0x10,%rsp
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%u\00"
@EIO = global i32 0
@.str.1 = [12 x i8] c"replication\00"
@.str.2 = [10 x i8] c"user.name\00"
@.str.3 = [15 x i8] c"SETREPLICATION\00"
define i32 @createUrlForSETREPLICATION(i8* %0, i32 %1, i8* %2, i32 %3, i8* %4, i8** %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i8**
%14 = alloca [6 x i8]
%15 = alloca [2 x i8*]
%16 = alloca [2 x i8*]
%17 = alloca i32
store i8* %0, i8** %8
store i32 %1, i32* %9
store i8* %2, i8** %10
store i32 %3, i32* %11
store i8* %4, i8** %12
store i8** %5, i8*** %13
%18 = getelementptr inbounds [6 x i8], [6 x i8]* %14, i64 0, i64 0
%19 = call i32 @memset(i8* %18, i32 0, i32 6)
%20 = load i32, i32* %11
%21 = icmp sgt i32 %20, 0
br i1 %21, label %22, label %34
22: ; preds = %6
%23 = getelementptr inbounds [6 x i8], [6 x i8]* %14, i64 0, i64 0
%24 = load i32, i32* %11
%25 = call i32 @snprintf(i8* %23, i32 6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %24)
store i32 %25, i32* %17
%26 = load i32, i32* %17
%27 = icmp slt i32 %26, 0
br i1 %27, label %31, label %28
28: ; preds = %22
%29 = load i32, i32* %17
%30 = icmp sge i32 %29, 6
br i1 %30, label %31, label %33
31: ; preds = %28, %22
%32 = load i32, i32* @EIO
store i32 %32, i32* %7
br label %48
33: ; preds = %28
br label %34
34: ; preds = %33, %6
%35 = getelementptr inbounds [2 x i8*], [2 x i8*]* %15, i64 0, i64 0
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8** %35
%36 = getelementptr inbounds [2 x i8*], [2 x i8*]* %15, i64 0, i64 1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8** %36
%37 = getelementptr inbounds [6 x i8], [6 x i8]* %14, i64 0, i64 0
%38 = getelementptr inbounds [2 x i8*], [2 x i8*]* %16, i64 0, i64 0
store i8* %37, i8** %38
%39 = load i8*, i8** %12
%40 = getelementptr inbounds [2 x i8*], [2 x i8*]* %16, i64 0, i64 1
store i8* %39, i8** %40
%41 = load i8*, i8** %8
%42 = load i32, i32* %9
%43 = load i8*, i8** %10
%44 = getelementptr inbounds [2 x i8*], [2 x i8*]* %15, i64 0, i64 0
%45 = getelementptr inbounds [2 x i8*], [2 x i8*]* %16, i64 0, i64 0
%46 = load i8**, i8*** %13
%47 = call i32 @createQueryURL(i8* %41, i32 %42, i8* %43, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 2, i8** %44, i8** %45, i8** %46)
store i32 %47, i32* %7
br label %48
48: ; preds = %34, %31
%49 = load i32, i32* %7
ret i32 %49
}

LLVM IR (-O2):
@.str = [3 x i8] c"%u\00"
@EIO = global i32 0
@.str.1 = [12 x i8] c"replication\00"
@.str.2 = [10 x i8] c"user.name\00"
@.str.3 = [15 x i8] c"SETREPLICATION\00"
define i32 @createUrlForSETREPLICATION(i8* %0, i32 %1, i8* %2, i32 %3, i8* %4, i8** %5) {
%7 = alloca [6 x i8]
%8 = alloca [2 x i8*]
%9 = alloca [2 x i8*]
%10 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 0
%11 = bitcast [2 x i8*]* %8 to i8*
%12 = bitcast [2 x i8*]* %9 to i8*
%13 = call i32 @memset(i8* %10, i32 0, i32 6)
%14 = icmp sgt i32 %3, 0
br i1 %14, label %15, label %20
15: ; preds = %6
%16 = call i32 @snprintf(i8* %10, i32 6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
%17 = icmp ugt i32 %16, 5
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = load i32, i32* @EIO
br label %26
20: ; preds = %15, %6
%21 = getelementptr inbounds [2 x i8*], [2 x i8*]* %8, i64 0, i64 0
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8** %21
%22 = getelementptr inbounds [2 x i8*], [2 x i8*]* %8, i64 0, i64 1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8** %22
%23 = getelementptr inbounds [2 x i8*], [2 x i8*]* %9, i64 0, i64 0
store i8* %10, i8** %23
%24 = getelementptr inbounds [2 x i8*], [2 x i8*]* %9, i64 0, i64 1
store i8* %4, i8** %24
%25 = call i32 @createQueryURL(i8* %0, i32 %1, i8* %2, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 2, i8** %21, i8** %23, i8** %5)
br label %26
26: ; preds = %20, %18
%27 = phi i32 [ %19, %18 ], [ %25, %20 ]
ret i32 %27
}