#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 /*<<< orphan*/ bad;

/* Variables and functions */
int /*<<< orphan*/ send(int, char *, int, int /*<<< orphan*/);
int setup();
int /*<<< orphan*/ sleep(int);
int main(void) {
  int s;
  char bad[150 * 2];
  char msg[] = "Test\n";
  s = setup();
  send(s, bad, sizeof(bad), 0);
  s = setup();
  send(s, bad, 10, 0);
  sleep(1);
  send(s, bad, 160, 0);
  s = setup();
  send(s, msg, 2, 0);
  sleep(2);
  send(s, msg + 2, 3, 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeb8(%rip),%eax
mov    %eax,-0x146(%rbp)
mov    0xeaf(%rip),%ax
mov    %ax,-0x142(%rbp)
mov    $0x0,%al
call   1050 <setup@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x140(%rbp),%rsi
mov    $0x12c,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
mov    $0x0,%al
call   1050 <setup@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x140(%rbp),%rsi
mov    $0xa,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    -0x8(%rbp),%edi
lea    -0x140(%rbp),%rsi
mov    $0xa0,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
mov    $0x0,%al
call   1050 <setup@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x146(%rbp),%rsi
mov    $0x2,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
mov    $0x2,%edi
call   1040 <sleep@plt>
mov    -0x8(%rbp),%edi
lea    -0x146(%rbp),%rsi
add    $0x2,%rsi
mov    $0x3,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
xor    %eax,%eax
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x148,%rsp
movw   $0xa,0xc(%rsp)
movl   $0x74736554,0x8(%rsp)
74
xor    %eax,%eax
call   1050 <setup@plt>
lea    0x10(%rsp),%rbx
mov    %eax,%edi
mov    %rbx,%rsi
mov    $0x12c,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
xor    %eax,%eax
call   1050 <setup@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    %rbx,%rsi
mov    $0xa,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0xa0,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
xor    %eax,%eax
call   1050 <setup@plt>
mov    %eax,%ebx
lea    0x8(%rsp),%rsi
mov    %eax,%edi
mov    $0x2,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
mov    $0x2,%edi
call   1040 <sleep@plt>
lea    0xa(%rsp),%rsi
mov    %ebx,%edi
mov    $0x3,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
xor    %eax,%eax
add    $0x148,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.msg = [6 x i8] c"Test\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [300 x i8]
%4 = alloca [6 x i8]
store i32 0, i32* %1
%5 = bitcast [6 x i8]* %4 to i8*
%6 = call i32 (...) @setup()
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 0
%9 = call i32 @send(i32 %7, i8* %8, i32 300, i32 0)
%10 = call i32 (...) @setup()
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 0
%13 = call i32 @send(i32 %11, i8* %12, i32 10, i32 0)
%14 = call i32 @sleep(i32 1)
%15 = load i32, i32* %2
%16 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 0
%17 = call i32 @send(i32 %15, i8* %16, i32 160, i32 0)
%18 = call i32 (...) @setup()
store i32 %18, i32* %2
%19 = load i32, i32* %2
%20 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 0
%21 = call i32 @send(i32 %19, i8* %20, i32 2, i32 0)
%22 = call i32 @sleep(i32 2)
%23 = load i32, i32* %2
%24 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 0
%25 = getelementptr inbounds i8, i8* %24, i64 2
%26 = call i32 @send(i32 %23, i8* %25, i32 3, i32 0)
ret i32 0
}

LLVM IR (-O2):
@__const.main.msg = [6 x i8] c"Test\0A\00"
define i32 @main() {
%1 = alloca [300 x i8]
%2 = alloca [6 x i8]
%3 = getelementptr inbounds [300 x i8], [300 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (...) @setup()
%6 = call i32 @send(i32 %5, i8* %3, i32 300, i32 0)
%7 = call i32 (...) @setup()
%8 = call i32 @send(i32 %7, i8* %3, i32 10, i32 0)
%9 = call i32 @sleep(i32 1)
%10 = call i32 @send(i32 %7, i8* %3, i32 160, i32 0)
%11 = call i32 (...) @setup()
%12 = call i32 @send(i32 %11, i8* %4, i32 2, i32 0)
%13 = call i32 @sleep(i32 2)
%14 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 2
%15 = call i32 @send(i32 %11, i8* %14, i32 3, i32 0)
ret i32 0
}