#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 mls_net_ud_cln {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ client_dispatch(struct mls_net_ud_cln *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ mls_net_udgram_cln_close(struct mls_net_ud_cln *);
struct mls_net_ud_cln *mls_net_udgram_cln_open(char *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  struct mls_net_ud_cln *cln = NULL;
  if (argc <= 1) {
    fprintf(stderr, "%s address\n", argv[0]);
    fprintf(stderr, "   address: /tmp/test_ud_dgram\n");
    goto out;
  }
  cln = mls_net_udgram_cln_open(argv[1]);
  if (NULL == cln) {
    fprintf(stderr, "mls_net_udgram_cln_open() error.\n");
    goto out;
  }
  client_dispatch(cln);
out:
  if (NULL != cln)
    mls_net_udgram_cln_close(cln);
  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)
movq   $0x0,-0x18(%rbp)
cmpl   $0x1,-0x8(%rbp)
jg     11a2 <main+0x62>
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe81(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
lea    0xe76(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    11e4 <main+0xa4>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <mls_net_udgram_cln_open@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
jne    11db <main+0x9b>
mov    0x2e1a(%rip),%rax
mov    (%rax),%edi
lea    0xe5d(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    11e4 <main+0xa4>
mov    -0x18(%rbp),%rdi
call   1030 <client_dispatch@plt>
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
je     11f9 <main+0xb9>
mov    -0x18(%rbp),%rdi
call   1050 <mls_net_udgram_cln_close@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x1,%edi
jg     116b <main+0x2b>
mov    0x2e93(%rip),%rbx
mov    (%rbx),%edi
mov    (%rsi),%rdx
lea    0xea7(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xea3(%rip),%rsi
jmp    119e <main+0x5e>
mov    0x8(%rsi),%rdi
call   1060 <mls_net_udgram_cln_open@plt>
test   %rax,%rax
je     118e <main+0x4e>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <client_dispatch@plt>
mov    %rbx,%rdi
call   1050 <mls_net_udgram_cln_close@plt>
jmp    11a5 <main+0x65>
mov    0x2e4b(%rip),%rax
mov    (%rax),%edi
lea    0xe8e(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.mls_net_ud_cln = type { i32 }
@stderr = global i32 0
@.str = [12 x i8] c"%s address\0A\00"
@.str.1 = [32 x i8] c" address: /tmp/test_ud_dgram\0A\00"
@.str.2 = [34 x i8] c"mls_net_udgram_cln_open() error.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.mls_net_ud_cln*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store %struct.mls_net_ud_cln* null, %struct.mls_net_ud_cln** %6
%7 = load i32, i32* %4
%8 = icmp sle i32 %7, 1
br i1 %8, label %9, label %17
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = load i32, i32* @stderr
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
br label %30
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call %struct.mls_net_ud_cln* @mls_net_udgram_cln_open(i8* %20)
store %struct.mls_net_ud_cln* %21, %struct.mls_net_ud_cln** %6
%22 = load %struct.mls_net_ud_cln*, %struct.mls_net_ud_cln** %6
%23 = icmp eq %struct.mls_net_ud_cln* null, %22
br i1 %23, label %24, label %27
24: ; preds = %17
%25 = load i32, i32* @stderr
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
br label %30
27: ; preds = %17
%28 = load %struct.mls_net_ud_cln*, %struct.mls_net_ud_cln** %6
%29 = call i32 @client_dispatch(%struct.mls_net_ud_cln* %28)
br label %30
30: ; preds = %27, %24, %9
%31 = load %struct.mls_net_ud_cln*, %struct.mls_net_ud_cln** %6
%32 = icmp ne %struct.mls_net_ud_cln* null, %31
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = load %struct.mls_net_ud_cln*, %struct.mls_net_ud_cln** %6
%35 = call i32 @mls_net_udgram_cln_close(%struct.mls_net_ud_cln* %34)
br label %36
36: ; preds = %33, %30
ret i32 0
}

LLVM IR (-O2):
%struct.mls_net_ud_cln = type { i32 }
@stderr = global i32 0
@.str = [12 x i8] c"%s address\0A\00"
@.str.1 = [32 x i8] c" address: /tmp/test_ud_dgram\0A\00"
@.str.2 = [34 x i8] c"mls_net_udgram_cln_open() error.\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %10
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i32, i32* @stderr
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
br label %21
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call %struct.mls_net_ud_cln* @mls_net_udgram_cln_open(i8* %12)
%14 = icmp eq %struct.mls_net_ud_cln* %13, null
br i1 %14, label %15, label %18
15: ; preds = %10
%16 = load i32, i32* @stderr
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
br label %21
18: ; preds = %10
%19 = tail call i32 @client_dispatch(%struct.mls_net_ud_cln* %13)
%20 = tail call i32 @mls_net_udgram_cln_close(%struct.mls_net_ud_cln* %13)
br label %21
21: ; preds = %15, %4, %18
ret i32 0
}