#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 */
struct connection_pool {
  int dummy;
};
struct connection {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ cc_close(struct connection *);
struct connection *cc_open();
int /*<<< orphan*/ close_client(struct connection_pool *, struct connection *);
int /*<<< orphan*/ dispatch(struct connection_pool *, struct connection *);
int /*<<< orphan*/ send_client(struct connection *, int);
void test(struct connection_pool *server) {
  struct connection *client = cc_open();
  send_client(client, 10);
  dispatch(server, client);
  send_client(client, 400);
  dispatch(server, client);
  close_client(server, client);
  dispatch(server, client);
  send_client(client, 500);
  dispatch(server, client);
  cc_close(client);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1070 <cc_open@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0xa,%esi
call   1050 <send_client@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <dispatch@plt>
mov    -0x10(%rbp),%rdi
mov    $0x190,%esi
call   1050 <send_client@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <dispatch@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <close_client@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <dispatch@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1f4,%esi
call   1050 <send_client@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <dispatch@plt>
mov    -0x10(%rbp),%rdi
call   1040 <cc_close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1070 <cc_open@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0xa,%esi
call   1050 <send_client@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <dispatch@plt>
mov    %rbx,%rdi
mov    $0x190,%esi
call   1050 <send_client@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <dispatch@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <close_client@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <dispatch@plt>
mov    %rbx,%rdi
mov    $0x1f4,%esi
call   1050 <send_client@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <dispatch@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <cc_close@plt>

LLVM IR (-O0):
%struct.connection_pool = type { i32 }
%struct.connection = type { i32 }
define void @test(%struct.connection_pool* %0) {
%2 = alloca %struct.connection_pool*
%3 = alloca %struct.connection*
store %struct.connection_pool* %0, %struct.connection_pool** %2
%4 = call %struct.connection* (...) @cc_open()
store %struct.connection* %4, %struct.connection** %3
%5 = load %struct.connection*, %struct.connection** %3
%6 = call i32 @send_client(%struct.connection* %5, i32 10)
%7 = load %struct.connection_pool*, %struct.connection_pool** %2
%8 = load %struct.connection*, %struct.connection** %3
%9 = call i32 @dispatch(%struct.connection_pool* %7, %struct.connection* %8)
%10 = load %struct.connection*, %struct.connection** %3
%11 = call i32 @send_client(%struct.connection* %10, i32 400)
%12 = load %struct.connection_pool*, %struct.connection_pool** %2
%13 = load %struct.connection*, %struct.connection** %3
%14 = call i32 @dispatch(%struct.connection_pool* %12, %struct.connection* %13)
%15 = load %struct.connection_pool*, %struct.connection_pool** %2
%16 = load %struct.connection*, %struct.connection** %3
%17 = call i32 @close_client(%struct.connection_pool* %15, %struct.connection* %16)
%18 = load %struct.connection_pool*, %struct.connection_pool** %2
%19 = load %struct.connection*, %struct.connection** %3
%20 = call i32 @dispatch(%struct.connection_pool* %18, %struct.connection* %19)
%21 = load %struct.connection*, %struct.connection** %3
%22 = call i32 @send_client(%struct.connection* %21, i32 500)
%23 = load %struct.connection_pool*, %struct.connection_pool** %2
%24 = load %struct.connection*, %struct.connection** %3
%25 = call i32 @dispatch(%struct.connection_pool* %23, %struct.connection* %24)
%26 = load %struct.connection*, %struct.connection** %3
%27 = call i32 @cc_close(%struct.connection* %26)
ret void
}

LLVM IR (-O2):
%struct.connection_pool = type { i32 }
%struct.connection = type { i32 }
define void @test(%struct.connection_pool* %0) {
%2 = tail call %struct.connection* (...) @cc_open()
%3 = tail call i32 @send_client(%struct.connection* %2, i32 10)
%4 = tail call i32 @dispatch(%struct.connection_pool* %0, %struct.connection* %2)
%5 = tail call i32 @send_client(%struct.connection* %2, i32 400)
%6 = tail call i32 @dispatch(%struct.connection_pool* %0, %struct.connection* %2)
%7 = tail call i32 @close_client(%struct.connection_pool* %0, %struct.connection* %2)
%8 = tail call i32 @dispatch(%struct.connection_pool* %0, %struct.connection* %2)
%9 = tail call i32 @send_client(%struct.connection* %2, i32 500)
%10 = tail call i32 @dispatch(%struct.connection_pool* %0, %struct.connection* %2)
%11 = tail call i32 @cc_close(%struct.connection* %2)
ret void
}