#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*/ mc_set_debug(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ test_basic_printbuf_memset();
int /*<<< orphan*/ test_printbuf_memappend(int *);
int /*<<< orphan*/ test_printbuf_memset_length();
int /*<<< orphan*/ test_sprintbuf(int);
int main(int argc, char **argv) {
  int before_resize = 0;
  mc_set_debug(1);
  test_basic_printbuf_memset();
  printf("========================================\n");
  test_printbuf_memset_length();
  printf("========================================\n");
  test_printbuf_memappend(&before_resize);
  printf("========================================\n");
  test_sprintbuf(before_resize);
  printf("========================================\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x1,%edi
call   1040 <mc_set_debug@plt>
mov    $0x0,%al
call   1080 <test_basic_printbuf_memset@plt>
lea    0xe6b(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <test_printbuf_memset_length@plt>
lea    0xe58(%rip),%rdi
call   1050 <printf@plt>
lea    -0x14(%rbp),%rdi
call   1070 <test_printbuf_memappend@plt>
lea    0xe43(%rip),%rdi
call   1050 <printf@plt>
mov    -0x14(%rbp),%edi
call   1060 <test_sprintbuf@plt>
lea    0xe2f(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
mov    $0x1,%edi
call   1050 <mc_set_debug@plt>
xor    %eax,%eax
call   1080 <test_basic_printbuf_memset@plt>
lea    0xe7b(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <test_printbuf_memset_length@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xc(%rsp),%rdi
call   1070 <test_printbuf_memappend@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%edi
call   1060 <test_sprintbuf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [42 x i8] c"========================================\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%7 = call i32 @mc_set_debug(i32 1)
%8 = call i32 (...) @test_basic_printbuf_memset()
%9 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (...) @test_printbuf_memset_length()
%11 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @test_printbuf_memappend(i32* %6)
%13 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* %6
%15 = call i32 @test_sprintbuf(i32 %14)
%16 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str.3 = [41 x i8] c"========================================\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%5 = tail call i32 @mc_set_debug(i32 1)
%6 = tail call i32 (...) @test_basic_printbuf_memset()
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.3, i64 0, i64 0))
%8 = tail call i32 (...) @test_printbuf_memset_length()
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.3, i64 0, i64 0))
%10 = call i32 @test_printbuf_memappend(i32* %3)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.3, i64 0, i64 0))
%12 = load i32, i32* %3
%13 = call i32 @test_sprintbuf(i32 %12)
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.3, i64 0, i64 0))
ret i32 0
}