#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*/ free(char *);
int http_put(char *, char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
scalar_t__ read(int, char *, int);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *httpsqs_put(char *name, char *bodydata) {
  char data[3];
  char dataarr[2][20];
  char pos[10];
  int sock;
  char *query;
  int i = 0, j = 0, flag = 0;
  char queuedata[2000];
  char *fq;
  query = (char *)malloc((strlen(name) + strlen("utf-8") + 25) * sizeof(char));
  sprintf(query, "/?charset=%s&name=%s&opt=put", "utf-8", name);
  sock = http_put(bodydata, query);
  free(query);
  memset(dataarr[0], 0, strlen(dataarr[0]));
  memset(dataarr[1], 0, strlen(dataarr[1]));
  while (read(sock, data, 1) > 0) {
    if (j == 3) {
      if (data[0] == 'P') {
        flag = 1;
      }
      if (flag == 1) {
        i++;
        if (i >= 6) {
          dataarr[0][i - 6] = data[0];
        }
      }
    }
    if (j == 4 && strlen(dataarr[0]) > 2) {
      for (i = 0; i < strlen(dataarr[0]) - 2; i++) {
        pos[i] = dataarr[0][i];
      }
      pos[strlen(pos)] = '\0';
      memset(dataarr[0], 0, strlen(dataarr[0]));
      strcpy(dataarr[0], pos);
      i = 0;
      if (strlen(pos) > 0) {
        flag = 2;
      }
    }
    if (flag == 2 && strlen(pos) > 0) {
      if (j == 8) {
        dataarr[1][i] = data[0];
        i++;
      }
    }
    if (data[0] == '\n') {
      j++;
    }
  }
  if (strlen(dataarr[1]) > 0) {
    dataarr[1][i] = '\0';
  }
  memset(queuedata, 0, strlen(queuedata));
  sprintf(queuedata, "Pos:%s\nData:%s", dataarr[0], dataarr[1]);
  fq = (char *)malloc(strlen(queuedata) * sizeof(char));
  strcpy(fq, queuedata);
  return fq;
}


x86 assembly (clang, -O0):
<httpsqs_put>:
push   %rbp
mov    %rsp,%rbp
sub    $0x870,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x5c(%rbp)
movl   $0x0,-0x60(%rbp)
movl   $0x0,-0x64(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x85c(%rbp)
lea    0xe42(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x85c(%rbp),%eax
add    %ecx,%eax
add    $0x19,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
mov    -0x8(%rbp),%rcx
lea    0xe16(%rip),%rsi
lea    0xe09(%rip),%rdx
call   10a0 <sprintf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x58(%rbp),%rsi
call   1090 <http_put@plt>
mov    %eax,-0x50(%rbp)
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
lea    -0x40(%rbp),%rax
mov    %rax,-0x858(%rbp)
lea    -0x40(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x858(%rbp),%rdi
mov    %eax,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    -0x40(%rbp),%rax
add    $0x14,%rax
mov    %rax,-0x850(%rbp)
lea    -0x40(%rbp),%rdi
add    $0x14,%rdi
call   1050 <strlen@plt>
mov    -0x850(%rbp),%rdi
mov    %eax,%edx
xor    %esi,%esi
call   1060 <memset@plt>
mov    -0x50(%rbp),%edi
lea    -0x13(%rbp),%rsi
mov    $0x1,%edx
call   1070 <read@plt>
cmp    $0x0,%rax
jle    13fa <httpsqs_put+0x27a>
cmpl   $0x3,-0x60(%rbp)
jne    12d4 <httpsqs_put+0x154>
movsbl -0x13(%rbp),%eax
cmp    $0x50,%eax
jne    129e <httpsqs_put+0x11e>
movl   $0x1,-0x64(%rbp)
cmpl   $0x1,-0x64(%rbp)
jne    12cf <httpsqs_put+0x14f>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
cmpl   $0x6,-0x5c(%rbp)
jl     12ca <httpsqs_put+0x14a>
mov    -0x13(%rbp),%cl
mov    -0x5c(%rbp),%eax
sub    $0x6,%eax
cltq
mov    %cl,-0x40(%rbp,%rax,1)
jmp    12cf <httpsqs_put+0x14f>
jmp    12d4 <httpsqs_put+0x154>
cmpl   $0x4,-0x60(%rbp)
jne    13a0 <httpsqs_put+0x220>
lea    -0x40(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x2,%eax
jle    13a0 <httpsqs_put+0x220>
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
mov    %eax,-0x860(%rbp)
lea    -0x40(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x860(%rbp),%eax
sub    $0x2,%ecx
cmp    %ecx,%eax
jge    133a <httpsqs_put+0x1ba>
movslq -0x5c(%rbp),%rax
mov    -0x40(%rbp,%rax,1),%cl
movslq -0x5c(%rbp),%rax
mov    %cl,-0x4a(%rbp,%rax,1)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    12f7 <httpsqs_put+0x177>
lea    -0x4a(%rbp),%rdi
call   1050 <strlen@plt>
cltq
movb   $0x0,-0x4a(%rbp,%rax,1)
lea    -0x40(%rbp),%rax
mov    %rax,-0x868(%rbp)
lea    -0x40(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x868(%rbp),%rdi
mov    %eax,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    -0x40(%rbp),%rdi
lea    -0x4a(%rbp),%rsi
call   1040 <strcpy@plt>
movl   $0x0,-0x5c(%rbp)
lea    -0x4a(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%eax
jle    139b <httpsqs_put+0x21b>
movl   $0x2,-0x64(%rbp)
jmp    13a0 <httpsqs_put+0x220>
cmpl   $0x2,-0x64(%rbp)
jne    13df <httpsqs_put+0x25f>
lea    -0x4a(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%eax
jle    13df <httpsqs_put+0x25f>
cmpl   $0x8,-0x60(%rbp)
jne    13da <httpsqs_put+0x25a>
mov    -0x13(%rbp),%cl
movslq -0x5c(%rbp),%rax
mov    %cl,-0x2c(%rbp,%rax,1)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    13df <httpsqs_put+0x25f>
movsbl -0x13(%rbp),%eax
cmp    $0xa,%eax
jne    13f5 <httpsqs_put+0x275>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    1265 <httpsqs_put+0xe5>
lea    -0x40(%rbp),%rdi
add    $0x14,%rdi
call   1050 <strlen@plt>
cmp    $0x0,%eax
jle    1419 <httpsqs_put+0x299>
movslq -0x5c(%rbp),%rax
movb   $0x0,-0x2c(%rbp,%rax,1)
lea    -0x840(%rbp),%rax
mov    %rax,-0x870(%rbp)
lea    -0x840(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x870(%rbp),%rdi
mov    %eax,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    -0x840(%rbp),%rdi
lea    -0x40(%rbp),%rdx
lea    -0x40(%rbp),%rcx
add    $0x14,%rcx
lea    0xbc6(%rip),%rsi
call   10a0 <sprintf@plt>
lea    -0x840(%rbp),%rdi
call   1050 <strlen@plt>
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x848(%rbp)
mov    -0x848(%rbp),%rdi
lea    -0x840(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x848(%rbp),%rax
add    $0x870,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<httpsqs_put>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x828,%rsp
mov    %rsi,%r14
mov    %rdi,%rbp
call   1050 <strlen@plt>
mov    %eax,%ebx
lea    0xe5b(%rip),%r15
mov    %r15,%rdi
call   1050 <strlen@plt>
lea    (%rbx,%rax,1),%edi
add    $0x19,%edi
call   1080 <malloc@plt>
mov    %rax,%rbx
lea    0xe44(%rip),%rsi
mov    %rax,%rdi
mov    %r15,%rdx
mov    %rbp,%rcx
call   10a0 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1090 <http_put@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
xor    %r12d,%r12d
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   1060 <memset@plt>
lea    0x34(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   1060 <memset@plt>
lea    0xd(%rsp),%rsi
mov    %ebp,%edi
mov    $0x1,%edx
call   1070 <read@plt>
test   %rax,%rax
jle    1394 <httpsqs_put+0x214>
xor    %r15d,%r15d
lea    0x20(%rsp),%rbx
xor    %r13d,%r13d
xor    %r14d,%r14d
mov    %ebp,0x10(%rsp)
jmp    127a <httpsqs_put+0xfa>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
cmpb   $0xa,0xd(%rsp)
sete   %al
add    %eax,%r14d
mov    %ebp,%edi
lea    0xd(%rsp),%rsi
mov    $0x1,%edx
call   1070 <read@plt>
mov    %r12d,%r15d
test   %rax,%rax
jle    1394 <httpsqs_put+0x214>
cmp    $0x4,%r14d
je     12c0 <httpsqs_put+0x140>
cmp    $0x3,%r14d
jne    1350 <httpsqs_put+0x1d0>
mov    0xd(%rsp),%al
cmp    $0x50,%al
mov    $0x1,%ecx
cmove  %ecx,%r13d
cmp    $0x1,%r13d
jne    1350 <httpsqs_put+0x1d0>
lea    0x1(%r15),%r12d
mov    $0x1,%r13d
cmp    $0x5,%r15d
jl     1250 <httpsqs_put+0xd0>
add    $0xfffffffb,%r15d
mov    %al,0x20(%rsp,%r15,1)
jmp    1250 <httpsqs_put+0xd0>
xchg   %ax,%ax
mov    %rbx,%rdi
call   1050 <strlen@plt>
cmp    $0x3,%eax
jl     1350 <httpsqs_put+0x1d0>
mov    %rbx,%rdi
call   1050 <strlen@plt>
cmp    $0x3,%eax
jl     12ff <httpsqs_put+0x17f>
xor    %ebp,%ebp
movzbl 0x20(%rsp,%rbp,1),%eax
mov    %al,0x16(%rsp,%rbp,1)
add    $0x1,%rbp
mov    %rbx,%rdi
call   1050 <strlen@plt>
add    $0xfffffffe,%eax
cltq
cmp    %rax,%rbp
jl     12e0 <httpsqs_put+0x160>
lea    0x16(%rsp),%rbp
mov    %rbp,%rdi
call   1050 <strlen@plt>
cltq
movb   $0x0,0x16(%rsp,%rax,1)
mov    %rbx,%rdi
call   1050 <strlen@plt>
xor    %r15d,%r15d
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   1060 <memset@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1040 <strcpy@plt>
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    $0x0,%r12d
test   %eax,%eax
mov    0x10(%rsp),%ebp
jg     135d <httpsqs_put+0x1dd>
nopl   0x0(%rax,%rax,1)
mov    %r15d,%r12d
cmp    $0x2,%r13d
jne    1250 <httpsqs_put+0xd0>
lea    0x16(%rsp),%rdi
call   1050 <strlen@plt>
mov    $0x2,%r13d
test   %eax,%eax
jle    1250 <httpsqs_put+0xd0>
cmp    $0x8,%r14d
jne    1250 <httpsqs_put+0xd0>
mov    0xd(%rsp),%al
movslq %r12d,%r12
mov    %al,0x34(%rsp,%r12,1)
add    $0x1,%r12d
jmp    1250 <httpsqs_put+0xd0>
lea    0x34(%rsp),%rbp
mov    %rbp,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
jle    13ad <httpsqs_put+0x22d>
movslq %r12d,%rax
movb   $0x0,0x34(%rsp,%rax,1)
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   1060 <memset@plt>
lea    0xc56(%rip),%rsi
lea    0x20(%rsp),%rdx
mov    %rbx,%rdi
mov    %rbp,%rcx
call   10a0 <sprintf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
mov    %rbp,%rax
add    $0x828,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"utf-8\00"
@.str.1 = [29 x i8] c"/?charset=%s&name=%s&opt=put\00"
@.str.2 = [15 x i8] c"Pos:%s\0AData:%s\00"
define i8* @httpsqs_put(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [3 x i8]
%6 = alloca [2 x [20 x i8]]
%7 = alloca [10 x i8]
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca [2000 x i8]
%14 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %10
store i32 0, i32* %11
store i32 0, i32* %12
%15 = load i8*, i8** %3
%16 = call i32 @strlen(i8* %15)
%17 = call i32 @strlen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%18 = add nsw i32 %16, %17
%19 = add nsw i32 %18, 25
%20 = sext i32 %19 to i64
%21 = mul i64 %20, 1
%22 = trunc i64 %21 to i32
%23 = call i64 @malloc(i32 %22)
%24 = inttoptr i64 %23 to i8*
store i8* %24, i8** %9
%25 = load i8*, i8** %9
%26 = load i8*, i8** %3
%27 = call i32 @sprintf(i8* %25, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %26)
%28 = load i8*, i8** %4
%29 = load i8*, i8** %9
%30 = call i32 @http_put(i8* %28, i8* %29)
store i32 %30, i32* %8
%31 = load i8*, i8** %9
%32 = call i32 @free(i8* %31)
%33 = getelementptr inbounds [2 x [20 x i8]], [2 x [20 x i8]]* %6, i64 0, i64 0
%34 = getelementptr inbounds [20 x i8], [20 x i8]* %33, i64 0, i64 0
%35 = getelementptr inbounds [2 x [20 x i8]], [2 x [20 x i8]]* %6, i64 0, i64 0
%36 = getelementptr inbounds [20 x i8], [20 x i8]* %35, i64 0, i64 0
%37 = call i32 @strlen(i8* %36)
%38 = call i32 @memset(i8* %34, i32 0, i32 %37)
%39 = getelementptr inbounds [2 x [20 x i8]], [2 x [20 x i8]]* %6, i64 0, i64 1
%40 = getelementptr inbounds [20 x i8], [20 x i8]* %39, i64 0, i64 0
%41 = getelementptr inbounds [2 x [20 x i8]], [2 x [20 x i8]]* %6, i64 0, i64 1
%42 = getelementptr inbounds [20 x i8], [20 x i8]* %41, i64 0, i64 0
%43 = call i32 @strlen(i8* %42)
%44 = call i32 @memset(i8* %40, i32 0, i32 %43)
br label %45
45: ; preds = %153, %2
%46 = load i32, i32* %8
%47 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%48 = call i64 @read(i32 %46, i8* %47, i32 1)
%49 = icmp sgt i64 %48, 0
br i1 %49, label %50, label %154
50: ; preds = %45
%51 = load i32, i32* %11
%52 = icmp eq i32 %51, 3
br i1 %52, label %53, label %77
53: ; preds = %50
%54 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = icmp eq i32 %56, 80
br i1 %57, label %58, label %59
58: ; preds = %53
store i32 1, i32* %12
br label %59
59: ; preds = %58, %53
%60 = load i32, i32* %12
%61 = icmp eq i32 %60, 1
br i1 %61, label %62, label %76
62: ; preds = %59
%63 = load i32, i32* %10
%64 = add nsw i32 %63, 1
store i32 %64, i32* %10
%65 = load i32, i32* %10
%66 = icmp sge i32 %65, 6
br i1 %66, label %67, label %75
67: ; preds = %62
%68 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%69 = load i8, i8* %68
%70 = getelementptr inbounds [2 x [20 x i8]], [2 x [20 x i8]]* %6, i64 0, i64 0
%71 = load i32, i32* %10
%72 = sub nsw i32 %71, 6
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [20 x i8], [20 x i8]* %70, i64 0, i64 %73
store i8 %69, i8* %74
br label %75
75: ; preds = %67, %62
br label %76
76: ; preds = %75, %59
br label %77
77: ; preds = %76, %50
%78 = load i32, i32* %11
%79 = icmp eq i32 %78, 4
br i1 %79, label %80, label %125
80: ; preds = %77
%81 = getelementptr inbounds [2 x [20 x i8]], [2 x [20 x i8]]* %6, i64 0, i64 0
%82 = getelementptr inbounds [20 x i8], [20 x i8]* %81, i64 0, i64 0
%83 = call i32 @strlen(i8* %82)
%84 = icmp sgt i32 %83, 2
br i1 %84, label %85, label %125
85: ; preds = %80
store i32 0, i32* %10
br label %86
86: ; preds = %102, %85
%87 = load i32, i32* %10
%88 = getelementptr inbounds [2 x [20 x i8]], [2 x [20 x i8]]* %6, i64 0, i64 0
%89 = getelementptr inbounds [20 x i8], [20 x i8]* %88, i64 0, i64 0
%90 = call i32 @strlen(i8* %89)
%91 = sub nsw i32 %90, 2
%92 = icmp slt i32 %87, %91
br i1 %92, label %93, label %105
93: ; preds = %86
%94 = getelementptr inbounds [2 x [20 x i8]], [2 x [20 x i8]]* %6, i64 0, i64 0
%95 = load i32, i32* %10
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds [20 x i8], [20 x i8]* %94, i64 0, i64 %96
%98 = load i8, i8* %97
%99 = load i32, i32* %10
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 %100
store i8 %98, i8* %101
br label %102
102: ; preds = %93
%103 = load i32, i32* %10
%104 = add nsw i32 %103, 1
store i32 %104, i32* %10
br label %86
105: ; preds = %86
%106 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%107 = call i32 @strlen(i8* %106)
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 %108
store i8 0, i8* %109
%110 = getelementptr inbounds [2 x [20 x i8]], [2 x [20 x i8]]* %6, i64 0, i64 0
%111 = getelementptr inbounds [20 x i8], [20 x i8]* %110, i64 0, i64 0
%112 = getelementptr inbounds [2 x [20 x i8]], [2 x [20 x i8]]* %6, i64 0, i64 0
%113 = getelementptr inbounds [20 x i8], [20 x i8]* %112, i64 0, i64 0
%114 = call i32 @strlen(i8* %113)
%115 = call i32 @memset(i8* %111, i32 0, i32 %114)
%116 = getelementptr inbounds [2 x [20 x i8]], [2 x [20 x i8]]* %6, i64 0, i64 0
%117 = getelementptr inbounds [20 x i8], [20 x i8]* %116, i64 0, i64 0
%118 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%119 = call i32 @strcpy(i8* %117, i8* %118)
store i32 0, i32* %10
%120 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%121 = call i32 @strlen(i8* %120)
%122 = icmp sgt i32 %121, 0
br i1 %122, label %123, label %124
123: ; preds = %105
store i32 2, i32* %12
br label %124
124: ; preds = %123, %105
br label %125
125: ; preds = %124, %80, %77
%126 = load i32, i32* %12
%127 = icmp eq i32 %126, 2
br i1 %127, label %128, label %145
128: ; preds = %125
%129 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%130 = call i32 @strlen(i8* %129)
%131 = icmp sgt i32 %130, 0
br i1 %131, label %132, label %145
132: ; preds = %128
%133 = load i32, i32* %11
%134 = icmp eq i32 %133, 8
br i1 %134, label %135, label %144
135: ; preds = %132
%136 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%137 = load i8, i8* %136
%138 = getelementptr inbounds [2 x [20 x i8]], [2 x [20 x i8]]* %6, i64 0, i64 1
%139 = load i32, i32* %10
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds [20 x i8], [20 x i8]* %138, i64 0, i64 %140
store i8 %137, i8* %141
%142 = load i32, i32* %10
%143 = add nsw i32 %142, 1
store i32 %143, i32* %10
br label %144
144: ; preds = %135, %132
br label %145
145: ; preds = %144, %128, %125
%146 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%147 = load i8, i8* %146
%148 = sext i8 %147 to i32
%149 = icmp eq i32 %148, 10
br i1 %149, label %150, label %153
150: ; preds = %145
%151 = load i32, i32* %11
%152 = add nsw i32 %151, 1
store i32 %152, i32* %11
br label %153
153: ; preds = %150, %145
br label %45
154: ; preds = %45
%155 = getelementptr inbounds [2 x [20 x i8]], [2 x [20 x i8]]* %6, i64 0, i64 1
%156 = getelementptr inbounds [20 x i8], [20 x i8]* %155, i64 0, i64 0
%157 = call i32 @strlen(i8* %156)
%158 = icmp sgt i32 %157, 0
br i1 %158, label %159, label %164
159: ; preds = %154
%160 = getelementptr inbounds [2 x [20 x i8]], [2 x [20 x i8]]* %6, i64 0, i64 1
%161 = load i32, i32* %10
%162 = sext i32 %161 to i64
%163 = getelementptr inbounds [20 x i8], [20 x i8]* %160, i64 0, i64 %162
store i8 0, i8* %163
br label %164
164: ; preds = %159, %154
%165 = getelementptr inbounds [2000 x i8], [2000 x i8]* %13, i64 0, i64 0
%166 = getelementptr inbounds [2000 x i8], [2000 x i8]* %13, i64 0, i64 0
%167 = call i32 @strlen(i8* %166)
%168 = call i32 @memset(i8* %165, i32 0, i32 %167)
%169 = getelementptr inbounds [2000 x i8], [2000 x i8]* %13, i64 0, i64 0
%170 = getelementptr inbounds [2 x [20 x i8]], [2 x [20 x i8]]* %6, i64 0, i64 0
%171 = getelementptr inbounds [20 x i8], [20 x i8]* %170, i64 0, i64 0
%172 = getelementptr inbounds [2 x [20 x i8]], [2 x [20 x i8]]* %6, i64 0, i64 1
%173 = getelementptr inbounds [20 x i8], [20 x i8]* %172, i64 0, i64 0
%174 = call i32 @sprintf(i8* %169, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %171, i8* %173)
%175 = getelementptr inbounds [2000 x i8], [2000 x i8]* %13, i64 0, i64 0
%176 = call i32 @strlen(i8* %175)
%177 = sext i32 %176 to i64
%178 = mul i64 %177, 1
%179 = trunc i64 %178 to i32
%180 = call i64 @malloc(i32 %179)
%181 = inttoptr i64 %180 to i8*
store i8* %181, i8** %14
%182 = load i8*, i8** %14
%183 = getelementptr inbounds [2000 x i8], [2000 x i8]* %13, i64 0, i64 0
%184 = call i32 @strcpy(i8* %182, i8* %183)
%185 = load i8*, i8** %14
ret i8* %185
}

LLVM IR (-O2):
@.str = [6 x i8] c"utf-8\00"
@.str.1 = [29 x i8] c"/?charset=%s&name=%s&opt=put\00"
@.str.2 = [15 x i8] c"Pos:%s\0AData:%s\00"
define i8* @httpsqs_put(i8* %0, i8* %1) {
%3 = alloca [3 x i8]
%4 = alloca [2 x [20 x i8]]
%5 = alloca [10 x i8]
%6 = alloca [2000 x i8]
%7 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [2 x [20 x i8]], [2 x [20 x i8]]* %4, i64 0, i64 0, i64 0
%9 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%10 = getelementptr inbounds [2000 x i8], [2000 x i8]* %6, i64 0, i64 0
%11 = tail call i32 @strlen(i8* %0)
%12 = tail call i32 @strlen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%13 = add i32 %11, 25
%14 = add i32 %13, %12
%15 = tail call i64 @malloc(i32 %14)
%16 = inttoptr i64 %15 to i8*
%17 = tail call i32 @sprintf(i8* dereferenceable(1) %16, i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0)
%18 = tail call i32 @http_put(i8* %1, i8* %16)
%19 = tail call i32 @free(i8* %16)
%20 = call i32 @strlen(i8* %8)
%21 = call i32 @memset(i8* %8, i32 0, i32 %20)
%22 = getelementptr inbounds [2 x [20 x i8]], [2 x [20 x i8]]* %4, i64 0, i64 1, i64 0
%23 = call i32 @strlen(i8* %22)
%24 = call i32 @memset(i8* %22, i32 0, i32 %23)
%25 = call i64 @read(i32 %18, i8* %7, i32 1)
%26 = icmp sgt i64 %25, 0
br i1 %26, label %27, label %92
27: ; preds = %2, %83
%28 = phi i32 [ %85, %83 ], [ 0, %2 ]
%29 = phi i32 [ %84, %83 ], [ 0, %2 ]
%30 = phi i32 [ %89, %83 ], [ 0, %2 ]
switch i32 %30, label %68 [
i32 3, label %31
i32 4, label %43
]
31: ; preds = %27
%32 = load i8, i8* %7
%33 = icmp eq i8 %32, 80
%34 = select i1 %33, i32 1, i32 %29
%35 = icmp eq i32 %34, 1
br i1 %35, label %36, label %68
36: ; preds = %31
%37 = add nsw i32 %28, 1
%38 = icmp sgt i32 %28, 4
br i1 %38, label %39, label %83
39: ; preds = %36
%40 = add nsw i32 %28, -5
%41 = zext i32 %40 to i64
%42 = getelementptr inbounds [2 x [20 x i8]], [2 x [20 x i8]]* %4, i64 0, i64 0, i64 %41
store i8 %32, i8* %42
br label %83
43: ; preds = %27
%44 = call i32 @strlen(i8* %8)
%45 = icmp sgt i32 %44, 2
br i1 %45, label %46, label %68
46: ; preds = %43
%47 = call i32 @strlen(i8* %8)
%48 = icmp sgt i32 %47, 2
br i1 %48, label %49, label %59
49: ; preds = %46, %49
%50 = phi i64 [ %54, %49 ], [ 0, %46 ]
%51 = getelementptr inbounds [2 x [20 x i8]], [2 x [20 x i8]]* %4, i64 0, i64 0, i64 %50
%52 = load i8, i8* %51
%53 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 %50
store i8 %52, i8* %53
%54 = add nuw nsw i64 %50, 1
%55 = call i32 @strlen(i8* %8)
%56 = add nsw i32 %55, -2
%57 = sext i32 %56 to i64
%58 = icmp slt i64 %54, %57
br i1 %58, label %49, label %59
59: ; preds = %49, %46
%60 = call i32 @strlen(i8* %9)
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 %61
store i8 0, i8* %62
%63 = call i32 @strlen(i8* %8)
%64 = call i32 @memset(i8* %8, i32 0, i32 %63)
%65 = call i32 @strcpy(i8* %8, i8* %9)
%66 = call i32 @strlen(i8* %9)
%67 = icmp sgt i32 %66, 0
br i1 %67, label %72, label %68
68: ; preds = %27, %31, %59, %43
%69 = phi i32 [ %29, %43 ], [ %29, %59 ], [ %34, %31 ], [ %29, %27 ]
%70 = phi i32 [ %28, %43 ], [ 0, %59 ], [ %28, %31 ], [ %28, %27 ]
%71 = icmp eq i32 %69, 2
br i1 %71, label %72, label %83
72: ; preds = %59, %68
%73 = phi i32 [ %70, %68 ], [ 0, %59 ]
%74 = call i32 @strlen(i8* %9)
%75 = icmp sgt i32 %74, 0
%76 = icmp eq i32 %30, 8
%77 = select i1 %75, i1 %76, i1 false
br i1 %77, label %78, label %83
78: ; preds = %72
%79 = load i8, i8* %7
%80 = sext i32 %73 to i64
%81 = getelementptr inbounds [2 x [20 x i8]], [2 x [20 x i8]]* %4, i64 0, i64 1, i64 %80
store i8 %79, i8* %81
%82 = add nsw i32 %73, 1
br label %83
83: ; preds = %39, %36, %78, %72, %68
%84 = phi i32 [ 2, %78 ], [ 2, %72 ], [ %69, %68 ], [ 1, %36 ], [ 1, %39 ]
%85 = phi i32 [ %82, %78 ], [ %73, %72 ], [ %70, %68 ], [ %37, %36 ], [ %37, %39 ]
%86 = load i8, i8* %7
%87 = icmp eq i8 %86, 10
%88 = zext i1 %87 to i32
%89 = add nuw nsw i32 %30, %88
%90 = call i64 @read(i32 %18, i8* %7, i32 1)
%91 = icmp sgt i64 %90, 0
br i1 %91, label %27, label %92
92: ; preds = %83, %2
%93 = phi i32 [ 0, %2 ], [ %85, %83 ]
%94 = call i32 @strlen(i8* %22)
%95 = icmp sgt i32 %94, 0
br i1 %95, label %96, label %99
96: ; preds = %92
%97 = sext i32 %93 to i64
%98 = getelementptr inbounds [2 x [20 x i8]], [2 x [20 x i8]]* %4, i64 0, i64 1, i64 %97
store i8 0, i8* %98
br label %99
99: ; preds = %96, %92
%100 = call i32 @strlen(i8* %10)
%101 = call i32 @memset(i8* %10, i32 0, i32 %100)
%102 = call i32 @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %8, i8* %22)
%103 = call i32 @strlen(i8* %10)
%104 = call i64 @malloc(i32 %103)
%105 = inttoptr i64 %104 to i8*
%106 = call i32 @strcpy(i8* %105, i8* %10)
ret i8* %105
}