#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 long uint64_t;
typedef long uint32_t;
typedef long uint16_t;
struct mp_buf {
  int dummy;
};
typedef scalar_t__ int64_t;
typedef scalar_t__ int32_t;
typedef scalar_t__ int16_t;

/* Variables and functions */
int ENOMEM;
int /*<<< orphan*/ mp_byte(struct mp_buf *, int);
int /*<<< orphan*/ mp_ensure_bytes(struct mp_buf *, int);
int /*<<< orphan*/ mp_u16(struct mp_buf *, long);
int /*<<< orphan*/ mp_u32(struct mp_buf *, long);
int /*<<< orphan*/ mp_u64(struct mp_buf *, long);
int mp_put_int(struct mp_buf *buf, long val) {
  if (val < 0) {
    if (val > -32) {
      if (!mp_ensure_bytes(buf, 1))
        return -ENOMEM;
      mp_byte(buf, (unsigned char)(signed char)val);
    } else if (val > -128) {
      if (!mp_ensure_bytes(buf, 2))
        return -ENOMEM;
      mp_byte(buf, 0xD0);
      mp_byte(buf, (unsigned char)(signed char)val);
    } else if (val > -32768) {
      if (!mp_ensure_bytes(buf, 3))
        return -ENOMEM;
      mp_byte(buf, 0xD1);
      mp_u16(buf, (uint16_t)(int16_t)val);
    } else if (val > -(1L << 31)) {
      if (!mp_ensure_bytes(buf, 5))
        return -ENOMEM;
      mp_byte(buf, 0xD2);
      mp_u32(buf, (uint32_t)(int32_t)val);
    } else {
      if (!mp_ensure_bytes(buf, 5))
        return -ENOMEM;
      mp_byte(buf, 0xD3);
      mp_u64(buf, (uint64_t)(int64_t)val);
    }
  } else {
    if (val < 128) {
      if (!mp_ensure_bytes(buf, 1))
        return -ENOMEM;
      mp_byte(buf, val);
    } else if (val < 65536) {
      if (!mp_ensure_bytes(buf, 3))
        return -ENOMEM;
      mp_byte(buf, 0xCD);
      mp_u16(buf, val);
    } else if (val < (1L << 32)) {
      if (!mp_ensure_bytes(buf, 5))
        return -ENOMEM;
      mp_byte(buf, 0xCE);
      mp_u32(buf, val);
    } else {
      if (!mp_ensure_bytes(buf, 9))
        return -ENOMEM;
      mp_byte(buf, 0xCF);
      mp_u64(buf, val);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<mp_put_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jge    1316 <mp_put_int+0x1c6>
cmpq   $0xffffffffffffffe0,-0x18(%rbp)
jle    11b5 <mp_put_int+0x65>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1050 <mp_ensure_bytes@plt>
cmp    $0x0,%eax
jne    11a0 <mp_put_int+0x50>
xor    %eax,%eax
mov    0x2e4a(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1473 <mp_put_int+0x323>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
movzbl %al,%esi
call   1060 <mp_byte@plt>
jmp    1311 <mp_put_int+0x1c1>
cmpq   $0xffffffffffffff80,-0x18(%rbp)
jle    120d <mp_put_int+0xbd>
mov    -0x10(%rbp),%rdi
mov    $0x2,%esi
call   1050 <mp_ensure_bytes@plt>
cmp    $0x0,%eax
jne    11ea <mp_put_int+0x9a>
xor    %eax,%eax
mov    0x2e00(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1473 <mp_put_int+0x323>
mov    -0x10(%rbp),%rdi
mov    $0xd0,%esi
call   1060 <mp_byte@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
movzbl %al,%esi
call   1060 <mp_byte@plt>
jmp    130c <mp_put_int+0x1bc>
cmpq   $0xffffffffffff8000,-0x18(%rbp)
ff
jle    1265 <mp_put_int+0x115>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1050 <mp_ensure_bytes@plt>
cmp    $0x0,%eax
jne    1245 <mp_put_int+0xf5>
xor    %eax,%eax
mov    0x2da5(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1473 <mp_put_int+0x323>
mov    -0x10(%rbp),%rdi
mov    $0xd1,%esi
call   1060 <mp_byte@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <mp_u16@plt>
jmp    1307 <mp_put_int+0x1b7>
cmpq   $0xffffffff80000000,-0x18(%rbp)
80
jle    12bd <mp_put_int+0x16d>
mov    -0x10(%rbp),%rdi
mov    $0x5,%esi
call   1050 <mp_ensure_bytes@plt>
cmp    $0x0,%eax
jne    129d <mp_put_int+0x14d>
xor    %eax,%eax
mov    0x2d4d(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1473 <mp_put_int+0x323>
mov    -0x10(%rbp),%rdi
mov    $0xd2,%esi
call   1060 <mp_byte@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1070 <mp_u32@plt>
jmp    1302 <mp_put_int+0x1b2>
mov    -0x10(%rbp),%rdi
mov    $0x5,%esi
call   1050 <mp_ensure_bytes@plt>
cmp    $0x0,%eax
jne    12e7 <mp_put_int+0x197>
xor    %eax,%eax
mov    0x2d03(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1473 <mp_put_int+0x323>
mov    -0x10(%rbp),%rdi
mov    $0xd3,%esi
call   1060 <mp_byte@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <mp_u64@plt>
jmp    1307 <mp_put_int+0x1b7>
jmp    130c <mp_put_int+0x1bc>
jmp    1311 <mp_put_int+0x1c1>
jmp    146c <mp_put_int+0x31c>
cmpq   $0x80,-0x18(%rbp)
jge    1362 <mp_put_int+0x212>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1050 <mp_ensure_bytes@plt>
cmp    $0x0,%eax
jne    134e <mp_put_int+0x1fe>
xor    %eax,%eax
mov    0x2c9c(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1473 <mp_put_int+0x323>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    %eax,%esi
call   1060 <mp_byte@plt>
jmp    1467 <mp_put_int+0x317>
cmpq   $0x10000,-0x18(%rbp)
jge    13ba <mp_put_int+0x26a>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1050 <mp_ensure_bytes@plt>
cmp    $0x0,%eax
jne    139a <mp_put_int+0x24a>
xor    %eax,%eax
mov    0x2c50(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1473 <mp_put_int+0x323>
mov    -0x10(%rbp),%rdi
mov    $0xcd,%esi
call   1060 <mp_byte@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <mp_u16@plt>
jmp    1462 <mp_put_int+0x312>
movabs $0x100000000,%rax
cmp    %rax,-0x18(%rbp)
jge    1418 <mp_put_int+0x2c8>
mov    -0x10(%rbp),%rdi
mov    $0x5,%esi
call   1050 <mp_ensure_bytes@plt>
cmp    $0x0,%eax
jne    13f8 <mp_put_int+0x2a8>
xor    %eax,%eax
mov    0x2bf2(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1473 <mp_put_int+0x323>
mov    -0x10(%rbp),%rdi
mov    $0xce,%esi
call   1060 <mp_byte@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1070 <mp_u32@plt>
jmp    145d <mp_put_int+0x30d>
mov    -0x10(%rbp),%rdi
mov    $0x9,%esi
call   1050 <mp_ensure_bytes@plt>
cmp    $0x0,%eax
jne    1442 <mp_put_int+0x2f2>
xor    %eax,%eax
mov    0x2ba8(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1473 <mp_put_int+0x323>
mov    -0x10(%rbp),%rdi
mov    $0xcf,%esi
call   1060 <mp_byte@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <mp_u64@plt>
jmp    1462 <mp_put_int+0x312>
jmp    1467 <mp_put_int+0x317>
jmp    146c <mp_put_int+0x31c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp_put_int>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
test   %rsi,%rsi
js     1189 <mp_put_int+0x39>
cmp    $0x7f,%rbx
ja     11a5 <mp_put_int+0x55>
mov    %r14,%rdi
mov    $0x1,%esi
call   1050 <mp_ensure_bytes@plt>
test   %eax,%eax
je     12cb <mp_put_int+0x17b>
mov    %r14,%rdi
mov    %ebx,%esi
call   1060 <mp_byte@plt>
jmp    12c7 <mp_put_int+0x177>
mov    %r14,%rdi
cmp    $0xffffffffffffffe1,%rbx
jb     11d0 <mp_put_int+0x80>
mov    $0x1,%esi
call   1050 <mp_ensure_bytes@plt>
test   %eax,%eax
jne    11f5 <mp_put_int+0xa5>
jmp    12cb <mp_put_int+0x17b>
cmp    $0xffff,%rbx
ja     1205 <mp_put_int+0xb5>
mov    %r14,%rdi
mov    $0x3,%esi
call   1050 <mp_ensure_bytes@plt>
test   %eax,%eax
je     12cb <mp_put_int+0x17b>
mov    %r14,%rdi
mov    $0xcd,%esi
jmp    1250 <mp_put_int+0x100>
cmp    $0xffffffffffffff81,%rbx
jb     122d <mp_put_int+0xdd>
mov    $0x2,%esi
call   1050 <mp_ensure_bytes@plt>
test   %eax,%eax
je     12cb <mp_put_int+0x17b>
mov    %r14,%rdi
mov    $0xd0,%esi
call   1060 <mp_byte@plt>
movzbl %bl,%esi
mov    %r14,%rdi
call   1060 <mp_byte@plt>
jmp    12c7 <mp_put_int+0x177>
mov    %rbx,%rax
mov    %r14,%rdi
shr    $0x20,%rax
jne    1262 <mp_put_int+0x112>
mov    $0x5,%esi
call   1050 <mp_ensure_bytes@plt>
test   %eax,%eax
je     12cb <mp_put_int+0x17b>
mov    %r14,%rdi
mov    $0xce,%esi
jmp    1299 <mp_put_int+0x149>
cmp    $0xffffffffffff8001,%rbx
jb     127a <mp_put_int+0x12a>
mov    $0x3,%esi
call   1050 <mp_ensure_bytes@plt>
test   %eax,%eax
je     12cb <mp_put_int+0x17b>
mov    %r14,%rdi
mov    $0xd1,%esi
call   1060 <mp_byte@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <mp_u16@plt>
jmp    12c7 <mp_put_int+0x177>
mov    $0x9,%esi
call   1050 <mp_ensure_bytes@plt>
test   %eax,%eax
je     12cb <mp_put_int+0x17b>
mov    %r14,%rdi
mov    $0xcf,%esi
jmp    12b7 <mp_put_int+0x167>
mov    $0x5,%esi
call   1050 <mp_ensure_bytes@plt>
cmp    $0xffffffff80000001,%rbx
jb     12ab <mp_put_int+0x15b>
test   %eax,%eax
je     12cb <mp_put_int+0x17b>
mov    %r14,%rdi
mov    $0xd2,%esi
call   1060 <mp_byte@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <mp_u32@plt>
jmp    12c7 <mp_put_int+0x177>
test   %eax,%eax
je     12cb <mp_put_int+0x17b>
mov    %r14,%rdi
mov    $0xd3,%esi
call   1060 <mp_byte@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <mp_u64@plt>
xor    %eax,%eax
jmp    12d6 <mp_put_int+0x186>
mov    0x2d0e(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.mp_buf = type { i32 }
@ENOMEM = global i32 0
define i32 @mp_put_int(%struct.mp_buf* %0, i64 %1) {
%3 = alloca i32
%4 = alloca %struct.mp_buf*
%5 = alloca i64
store %struct.mp_buf* %0, %struct.mp_buf** %4
store i64 %1, i64* %5
%6 = load i64, i64* %5
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %91
8: ; preds = %2
%9 = load i64, i64* %5
%10 = icmp sgt i64 %9, -32
br i1 %10, label %11, label %24
11: ; preds = %8
%12 = load %struct.mp_buf*, %struct.mp_buf** %4
%13 = call i32 @mp_ensure_bytes(%struct.mp_buf* %12, i32 1)
%14 = icmp ne i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %11
%16 = load i32, i32* @ENOMEM
%17 = sub nsw i32 0, %16
store i32 %17, i32* %3
br label %155
18: ; preds = %11
%19 = load %struct.mp_buf*, %struct.mp_buf** %4
%20 = load i64, i64* %5
%21 = trunc i64 %20 to i8
%22 = zext i8 %21 to i32
%23 = call i32 @mp_byte(%struct.mp_buf* %19, i32 %22)
br label %90
24: ; preds = %8
%25 = load i64, i64* %5
%26 = icmp sgt i64 %25, -128
br i1 %26, label %27, label %42
27: ; preds = %24
%28 = load %struct.mp_buf*, %struct.mp_buf** %4
%29 = call i32 @mp_ensure_bytes(%struct.mp_buf* %28, i32 2)
%30 = icmp ne i32 %29, 0
br i1 %30, label %34, label %31
31: ; preds = %27
%32 = load i32, i32* @ENOMEM
%33 = sub nsw i32 0, %32
store i32 %33, i32* %3
br label %155
34: ; preds = %27
%35 = load %struct.mp_buf*, %struct.mp_buf** %4
%36 = call i32 @mp_byte(%struct.mp_buf* %35, i32 208)
%37 = load %struct.mp_buf*, %struct.mp_buf** %4
%38 = load i64, i64* %5
%39 = trunc i64 %38 to i8
%40 = zext i8 %39 to i32
%41 = call i32 @mp_byte(%struct.mp_buf* %37, i32 %40)
br label %89
42: ; preds = %24
%43 = load i64, i64* %5
%44 = icmp sgt i64 %43, -32768
br i1 %44, label %45, label %58
45: ; preds = %42
%46 = load %struct.mp_buf*, %struct.mp_buf** %4
%47 = call i32 @mp_ensure_bytes(%struct.mp_buf* %46, i32 3)
%48 = icmp ne i32 %47, 0
br i1 %48, label %52, label %49
49: ; preds = %45
%50 = load i32, i32* @ENOMEM
%51 = sub nsw i32 0, %50
store i32 %51, i32* %3
br label %155
52: ; preds = %45
%53 = load %struct.mp_buf*, %struct.mp_buf** %4
%54 = call i32 @mp_byte(%struct.mp_buf* %53, i32 209)
%55 = load %struct.mp_buf*, %struct.mp_buf** %4
%56 = load i64, i64* %5
%57 = call i32 @mp_u16(%struct.mp_buf* %55, i64 %56)
br label %88
58: ; preds = %42
%59 = load i64, i64* %5
%60 = icmp sgt i64 %59, -2147483648
br i1 %60, label %61, label %74
61: ; preds = %58
%62 = load %struct.mp_buf*, %struct.mp_buf** %4
%63 = call i32 @mp_ensure_bytes(%struct.mp_buf* %62, i32 5)
%64 = icmp ne i32 %63, 0
br i1 %64, label %68, label %65
65: ; preds = %61
%66 = load i32, i32* @ENOMEM
%67 = sub nsw i32 0, %66
store i32 %67, i32* %3
br label %155
68: ; preds = %61
%69 = load %struct.mp_buf*, %struct.mp_buf** %4
%70 = call i32 @mp_byte(%struct.mp_buf* %69, i32 210)
%71 = load %struct.mp_buf*, %struct.mp_buf** %4
%72 = load i64, i64* %5
%73 = call i32 @mp_u32(%struct.mp_buf* %71, i64 %72)
br label %87
74: ; preds = %58
%75 = load %struct.mp_buf*, %struct.mp_buf** %4
%76 = call i32 @mp_ensure_bytes(%struct.mp_buf* %75, i32 5)
%77 = icmp ne i32 %76, 0
br i1 %77, label %81, label %78
78: ; preds = %74
%79 = load i32, i32* @ENOMEM
%80 = sub nsw i32 0, %79
store i32 %80, i32* %3
br label %155
81: ; preds = %74
%82 = load %struct.mp_buf*, %struct.mp_buf** %4
%83 = call i32 @mp_byte(%struct.mp_buf* %82, i32 211)
%84 = load %struct.mp_buf*, %struct.mp_buf** %4
%85 = load i64, i64* %5
%86 = call i32 @mp_u64(%struct.mp_buf* %84, i64 %85)
br label %87
87: ; preds = %81, %68
br label %88
88: ; preds = %87, %52
br label %89
89: ; preds = %88, %34
br label %90
90: ; preds = %89, %18
br label %154
91: ; preds = %2
%92 = load i64, i64* %5
%93 = icmp slt i64 %92, 128
br i1 %93, label %94, label %106
94: ; preds = %91
%95 = load %struct.mp_buf*, %struct.mp_buf** %4
%96 = call i32 @mp_ensure_bytes(%struct.mp_buf* %95, i32 1)
%97 = icmp ne i32 %96, 0
br i1 %97, label %101, label %98
98: ; preds = %94
%99 = load i32, i32* @ENOMEM
%100 = sub nsw i32 0, %99
store i32 %100, i32* %3
br label %155
101: ; preds = %94
%102 = load %struct.mp_buf*, %struct.mp_buf** %4
%103 = load i64, i64* %5
%104 = trunc i64 %103 to i32
%105 = call i32 @mp_byte(%struct.mp_buf* %102, i32 %104)
br label %153
106: ; preds = %91
%107 = load i64, i64* %5
%108 = icmp slt i64 %107, 65536
br i1 %108, label %109, label %122
109: ; preds = %106
%110 = load %struct.mp_buf*, %struct.mp_buf** %4
%111 = call i32 @mp_ensure_bytes(%struct.mp_buf* %110, i32 3)
%112 = icmp ne i32 %111, 0
br i1 %112, label %116, label %113
113: ; preds = %109
%114 = load i32, i32* @ENOMEM
%115 = sub nsw i32 0, %114
store i32 %115, i32* %3
br label %155
116: ; preds = %109
%117 = load %struct.mp_buf*, %struct.mp_buf** %4
%118 = call i32 @mp_byte(%struct.mp_buf* %117, i32 205)
%119 = load %struct.mp_buf*, %struct.mp_buf** %4
%120 = load i64, i64* %5
%121 = call i32 @mp_u16(%struct.mp_buf* %119, i64 %120)
br label %152
122: ; preds = %106
%123 = load i64, i64* %5
%124 = icmp slt i64 %123, 4294967296
br i1 %124, label %125, label %138
125: ; preds = %122
%126 = load %struct.mp_buf*, %struct.mp_buf** %4
%127 = call i32 @mp_ensure_bytes(%struct.mp_buf* %126, i32 5)
%128 = icmp ne i32 %127, 0
br i1 %128, label %132, label %129
129: ; preds = %125
%130 = load i32, i32* @ENOMEM
%131 = sub nsw i32 0, %130
store i32 %131, i32* %3
br label %155
132: ; preds = %125
%133 = load %struct.mp_buf*, %struct.mp_buf** %4
%134 = call i32 @mp_byte(%struct.mp_buf* %133, i32 206)
%135 = load %struct.mp_buf*, %struct.mp_buf** %4
%136 = load i64, i64* %5
%137 = call i32 @mp_u32(%struct.mp_buf* %135, i64 %136)
br label %151
138: ; preds = %122
%139 = load %struct.mp_buf*, %struct.mp_buf** %4
%140 = call i32 @mp_ensure_bytes(%struct.mp_buf* %139, i32 9)
%141 = icmp ne i32 %140, 0
br i1 %141, label %145, label %142
142: ; preds = %138
%143 = load i32, i32* @ENOMEM
%144 = sub nsw i32 0, %143
store i32 %144, i32* %3
br label %155
145: ; preds = %138
%146 = load %struct.mp_buf*, %struct.mp_buf** %4
%147 = call i32 @mp_byte(%struct.mp_buf* %146, i32 207)
%148 = load %struct.mp_buf*, %struct.mp_buf** %4
%149 = load i64, i64* %5
%150 = call i32 @mp_u64(%struct.mp_buf* %148, i64 %149)
br label %151
151: ; preds = %145, %132
br label %152
152: ; preds = %151, %116
br label %153
153: ; preds = %152, %101
br label %154
154: ; preds = %153, %90
store i32 0, i32* %3
br label %155
155: ; preds = %154, %142, %129, %113, %98, %78, %65, %49, %31, %15
%156 = load i32, i32* %3
ret i32 %156
}

LLVM IR (-O2):
%struct.mp_buf = type { i32 }
@ENOMEM = global i32 0
define i32 @mp_put_int(%struct.mp_buf* %0, i64 %1) {
%3 = icmp slt i64 %1, 0
br i1 %3, label %4, label %58
4: ; preds = %2
%5 = icmp ugt i64 %1, -32
br i1 %5, label %6, label %16
6: ; preds = %4
%7 = tail call i32 @mp_ensure_bytes(%struct.mp_buf* %0, i32 1)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i32, i32* @ENOMEM
%11 = sub nsw i32 0, %10
br label %100
12: ; preds = %6
%13 = trunc i64 %1 to i32
%14 = and i32 %13, 255
%15 = tail call i32 @mp_byte(%struct.mp_buf* %0, i32 %14)
br label %100
16: ; preds = %4
%17 = icmp ugt i64 %1, -128
br i1 %17, label %18, label %29
18: ; preds = %16
%19 = tail call i32 @mp_ensure_bytes(%struct.mp_buf* %0, i32 2)
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = load i32, i32* @ENOMEM
%23 = sub nsw i32 0, %22
br label %100
24: ; preds = %18
%25 = tail call i32 @mp_byte(%struct.mp_buf* %0, i32 208)
%26 = trunc i64 %1 to i32
%27 = and i32 %26, 255
%28 = tail call i32 @mp_byte(%struct.mp_buf* %0, i32 %27)
br label %100
29: ; preds = %16
%30 = icmp ugt i64 %1, -32768
br i1 %30, label %31, label %40
31: ; preds = %29
%32 = tail call i32 @mp_ensure_bytes(%struct.mp_buf* %0, i32 3)
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %31
%35 = load i32, i32* @ENOMEM
%36 = sub nsw i32 0, %35
br label %100
37: ; preds = %31
%38 = tail call i32 @mp_byte(%struct.mp_buf* %0, i32 209)
%39 = tail call i32 @mp_u16(%struct.mp_buf* %0, i64 %1)
br label %100
40: ; preds = %29
%41 = icmp ugt i64 %1, -2147483648
%42 = tail call i32 @mp_ensure_bytes(%struct.mp_buf* %0, i32 5)
%43 = icmp eq i32 %42, 0
br i1 %41, label %44, label %51
44: ; preds = %40
br i1 %43, label %45, label %48
45: ; preds = %44
%46 = load i32, i32* @ENOMEM
%47 = sub nsw i32 0, %46
br label %100
48: ; preds = %44
%49 = tail call i32 @mp_byte(%struct.mp_buf* %0, i32 210)
%50 = tail call i32 @mp_u32(%struct.mp_buf* %0, i64 %1)
br label %100
51: ; preds = %40
br i1 %43, label %52, label %55
52: ; preds = %51
%53 = load i32, i32* @ENOMEM
%54 = sub nsw i32 0, %53
br label %100
55: ; preds = %51
%56 = tail call i32 @mp_byte(%struct.mp_buf* %0, i32 211)
%57 = tail call i32 @mp_u64(%struct.mp_buf* %0, i64 %1)
br label %100
58: ; preds = %2
%59 = icmp ult i64 %1, 128
br i1 %59, label %60, label %69
60: ; preds = %58
%61 = tail call i32 @mp_ensure_bytes(%struct.mp_buf* %0, i32 1)
%62 = icmp eq i32 %61, 0
br i1 %62, label %63, label %66
63: ; preds = %60
%64 = load i32, i32* @ENOMEM
%65 = sub nsw i32 0, %64
br label %100
66: ; preds = %60
%67 = trunc i64 %1 to i32
%68 = tail call i32 @mp_byte(%struct.mp_buf* %0, i32 %67)
br label %100
69: ; preds = %58
%70 = icmp ult i64 %1, 65536
br i1 %70, label %71, label %80
71: ; preds = %69
%72 = tail call i32 @mp_ensure_bytes(%struct.mp_buf* %0, i32 3)
%73 = icmp eq i32 %72, 0
br i1 %73, label %74, label %77
74: ; preds = %71
%75 = load i32, i32* @ENOMEM
%76 = sub nsw i32 0, %75
br label %100
77: ; preds = %71
%78 = tail call i32 @mp_byte(%struct.mp_buf* %0, i32 205)
%79 = tail call i32 @mp_u16(%struct.mp_buf* %0, i64 %1)
br label %100
80: ; preds = %69
%81 = icmp ult i64 %1, 4294967296
br i1 %81, label %82, label %91
82: ; preds = %80
%83 = tail call i32 @mp_ensure_bytes(%struct.mp_buf* %0, i32 5)
%84 = icmp eq i32 %83, 0
br i1 %84, label %85, label %88
85: ; preds = %82
%86 = load i32, i32* @ENOMEM
%87 = sub nsw i32 0, %86
br label %100
88: ; preds = %82
%89 = tail call i32 @mp_byte(%struct.mp_buf* %0, i32 206)
%90 = tail call i32 @mp_u32(%struct.mp_buf* %0, i64 %1)
br label %100
91: ; preds = %80
%92 = tail call i32 @mp_ensure_bytes(%struct.mp_buf* %0, i32 9)
%93 = icmp eq i32 %92, 0
br i1 %93, label %94, label %97
94: ; preds = %91
%95 = load i32, i32* @ENOMEM
%96 = sub nsw i32 0, %95
br label %100
97: ; preds = %91
%98 = tail call i32 @mp_byte(%struct.mp_buf* %0, i32 207)
%99 = tail call i32 @mp_u64(%struct.mp_buf* %0, i64 %1)
br label %100
100: ; preds = %24, %48, %55, %37, %12, %77, %97, %88, %66, %94, %85, %74, %63, %52, %45, %34, %21, %9
%101 = phi i32 [ %11, %9 ], [ %23, %21 ], [ %36, %34 ], [ %47, %45 ], [ %54, %52 ], [ %65, %63 ], [ %76, %74 ], [ %87, %85 ], [ %96, %94 ], [ 0, %66 ], [ 0, %88 ], [ 0, %97 ], [ 0, %77 ], [ 0, %12 ], [ 0, %37 ], [ 0, %55 ], [ 0, %48 ], [ 0, %24 ]
ret i32 %101
}