#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*/ abort();
int /*<<< orphan*/ net_close(int);
scalar_t__ net_connect(int *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ net_send(int *, char *, int);
scalar_t__ net_set_block(int);
int /*<<< orphan*/ net_usleep(int);
void sender(char *msg) {
  int socket;
  net_usleep(20000);
  if (net_connect(&socket, NULL, 121212) != 0)
    abort();
  if (net_set_block(socket) != 0)
    abort();
  net_send(&socket, msg, 40);
  net_close(socket);
}


x86 assembly (clang, -O0):
<sender>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x4e20,%edi
call   1080 <net_usleep@plt>
lea    -0xc(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x1d97c,%edx
call   1040 <net_connect@plt>
cmp    $0x0,%rax
je     1199 <sender+0x39>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0xc(%rbp),%edi
call   1060 <net_set_block@plt>
cmp    $0x0,%rax
je     11b2 <sender+0x52>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdi
mov    $0x28,%edx
call   1050 <net_send@plt>
mov    -0xc(%rbp),%edi
call   1070 <net_close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sender>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    $0x4e20,%edi
call   1080 <net_usleep@plt>
lea    0xc(%rsp),%rdi
xor    %esi,%esi
mov    $0x1d97c,%edx
call   1040 <net_connect@plt>
test   %rax,%rax
jne    11b7 <sender+0x57>
mov    0xc(%rsp),%edi
call   1060 <net_set_block@plt>
test   %rax,%rax
jne    11b7 <sender+0x57>
lea    0xc(%rsp),%rdi
mov    %rbx,%rsi
mov    $0x28,%edx
call   1050 <net_send@plt>
mov    0xc(%rsp),%edi
call   1070 <net_close@plt>
add    $0x10,%rsp
pop    %rbx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @sender(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = call i32 @net_usleep(i32 20000)
%5 = call i64 @net_connect(i32* %3, i32* null, i32 121212)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 (...) @abort()
unreachable
9: ; preds = %1
%10 = load i32, i32* %3
%11 = call i64 @net_set_block(i32 %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = call i32 (...) @abort()
unreachable
15: ; preds = %9
%16 = load i8*, i8** %2
%17 = call i32 @net_send(i32* %3, i8* %16, i32 40)
%18 = load i32, i32* %3
%19 = call i32 @net_close(i32 %18)
ret void
}

LLVM IR (-O2):
define void @sender(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 @net_usleep(i32 20000)
%5 = call i64 @net_connect(i32* %2, i32* null, i32 121212)
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = call i32 (...) @abort()
unreachable
9: ; preds = %1
%10 = load i32, i32* %2
%11 = call i64 @net_set_block(i32 %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %9
%14 = call i32 (...) @abort()
unreachable
15: ; preds = %9
%16 = call i32 @net_send(i32* %2, i8* %0, i32 40)
%17 = load i32, i32* %2
%18 = call i32 @net_close(i32 %17)
ret void
}