#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*/ bzero(char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *, char *, char *,
                            char *, char *, char *, char *);
scalar_t__ spaghetti_get_prid(char *, char *, int);
int spaghetti_post_file(char *, char *);
int spaghetti_plugpost_wrapper(char *profilepath, char *plugin, char *gamename,
                               char *platform, char *data, char *fullpath) {
  char final_url[1024];
  char pridbuf[128 + 1];
  bzero(final_url, 1024);
  bzero(pridbuf, 128 + 1);
  if (spaghetti_get_prid(profilepath, pridbuf, 128) < 0) {
    return (-1);
  }
  snprintf(final_url, 1023, "%s/%s_%s/%s/%s/%s/%s?%s", "http://127.0.0.1:13001",
           "plugtally", "1", plugin, gamename, platform, pridbuf, data);
  return (spaghetti_post_file(fullpath, final_url));
}


x86 assembly (clang, -O0):
<spaghetti_plugpost_wrapper>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x500,%rsp
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
mov    %rcx,-0x38(%rbp)
mov    %r8,-0x40(%rbp)
mov    %r9,-0x48(%rbp)
lea    -0x450(%rbp),%rdi
mov    $0x400,%esi
call   1060 <bzero@plt>
lea    -0x4e0(%rbp),%rdi
mov    $0x81,%esi
call   1060 <bzero@plt>
mov    -0x20(%rbp),%rdi
lea    -0x4e0(%rbp),%rsi
mov    $0x80,%edx
call   1040 <spaghetti_get_prid@plt>
cmp    $0x0,%rax
jge    11b3 <spaghetti_plugpost_wrapper+0x73>
movl   $0xffffffff,-0x14(%rbp)
jmp    1222 <spaghetti_plugpost_wrapper+0xe2>
lea    -0x450(%rbp),%rdi
mov    -0x28(%rbp),%r14
mov    -0x30(%rbp),%rbx
mov    -0x38(%rbp),%r11
lea    -0x4e0(%rbp),%r10
mov    -0x40(%rbp),%rax
mov    $0x3ff,%esi
lea    0xe23(%rip),%rdx
lea    0xe34(%rip),%rcx
lea    0xe44(%rip),%r8
lea    0xe3b(%rip),%r9
mov    %r14,(%rsp)
mov    %rbx,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1030 <snprintf@plt>
mov    -0x48(%rbp),%rdi
lea    -0x450(%rbp),%rsi
call   1050 <spaghetti_post_file@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x500,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<spaghetti_plugpost_wrapper>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x4a8,%rsp
mov    %r9,0x8(%rsp)
mov    %r8,%rbx
mov    %rcx,%r13
mov    %rdx,%r12
mov    %rsi,%r15
mov    %rdi,%r14
lea    0xa0(%rsp),%rdi
mov    $0x400,%esi
call   1060 <bzero@plt>
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x81,%esi
call   1060 <bzero@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
mov    $0x80,%edx
call   1040 <spaghetti_get_prid@plt>
test   %rax,%rax
js     11ee <spaghetti_plugpost_wrapper+0xae>
sub    $0x8,%rsp
lea    0xe57(%rip),%rdx
lea    0xe68(%rip),%rcx
lea    0xe78(%rip),%r8
lea    0xe6f(%rip),%r9
lea    0xa8(%rsp),%r14
mov    %r14,%rdi
mov    $0x3ff,%esi
push   %rbx
push   %rbp
push   %r13
push   %r12
push   %r15
call   1030 <snprintf@plt>
add    $0x30,%rsp
mov    0x8(%rsp),%rdi
mov    %r14,%rsi
call   1050 <spaghetti_post_file@plt>
jmp    11f3 <spaghetti_plugpost_wrapper+0xb3>
mov    $0xffffffff,%eax
add    $0x4a8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"%s/%s_%s/%s/%s/%s/%s?%s\00"
@.str.1 = [23 x i8] c"http://127.0.0.1:13001\00"
@.str.2 = [10 x i8] c"plugtally\00"
@.str.3 = [2 x i8] c"1\00"
define i32 @spaghetti_plugpost_wrapper(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca [1024 x i8]
%15 = alloca [129 x i8]
store i8* %0, i8** %8
store i8* %1, i8** %9
store i8* %2, i8** %10
store i8* %3, i8** %11
store i8* %4, i8** %12
store i8* %5, i8** %13
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%17 = call i32 @bzero(i8* %16, i32 1024)
%18 = getelementptr inbounds [129 x i8], [129 x i8]* %15, i64 0, i64 0
%19 = call i32 @bzero(i8* %18, i32 129)
%20 = load i8*, i8** %8
%21 = getelementptr inbounds [129 x i8], [129 x i8]* %15, i64 0, i64 0
%22 = call i64 @spaghetti_get_prid(i8* %20, i8* %21, i32 128)
%23 = icmp slt i64 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %6
store i32 -1, i32* %7
br label %36
25: ; preds = %6
%26 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%27 = load i8*, i8** %9
%28 = load i8*, i8** %10
%29 = load i8*, i8** %11
%30 = getelementptr inbounds [129 x i8], [129 x i8]* %15, i64 0, i64 0
%31 = load i8*, i8** %12
%32 = call i32 @snprintf(i8* %26, i32 1023, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* %27, i8* %28, i8* %29, i8* %30, i8* %31)
%33 = load i8*, i8** %13
%34 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%35 = call i32 @spaghetti_post_file(i8* %33, i8* %34)
store i32 %35, i32* %7
br label %36
36: ; preds = %25, %24
%37 = load i32, i32* %7
ret i32 %37
}

LLVM IR (-O2):
@.str = [24 x i8] c"%s/%s_%s/%s/%s/%s/%s?%s\00"
@.str.1 = [23 x i8] c"http://127.0.0.1:13001\00"
@.str.2 = [10 x i8] c"plugtally\00"
@.str.3 = [2 x i8] c"1\00"
define i32 @spaghetti_plugpost_wrapper(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5) {
%7 = alloca [1024 x i8]
%8 = alloca [129 x i8]
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%10 = getelementptr inbounds [129 x i8], [129 x i8]* %8, i64 0, i64 0
%11 = call i32 @bzero(i8* %9, i32 1024)
%12 = call i32 @bzero(i8* %10, i32 129)
%13 = call i64 @spaghetti_get_prid(i8* %0, i8* %10, i32 128)
%14 = icmp slt i64 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %6
%16 = call i32 @snprintf(i8* %9, i32 1023, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* %1, i8* %2, i8* %3, i8* %10, i8* %4)
%17 = call i32 @spaghetti_post_file(i8* %5, i8* %9)
br label %18
18: ; preds = %6, %15
%19 = phi i32 [ %17, %15 ], [ -1, %6 ]
ret i32 %19
}