#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 accept(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
int getsockopt(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/,
               int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int recvfrom(int /*<<< orphan*/, int /*<<< orphan*/ *, int /*<<< orphan*/,
             int /*<<< orphan*/, int /*<<< orphan*/ *, int /*<<< orphan*/);
int main(void) {
  if (-1 != accept(99, NULL, 0))
    printf("accept succeeded?\n");
  if (-1 != recvfrom(0, NULL, 0, 0, NULL, 0))
    printf("recvfrom succeeded?\n");
  if (-1 != getsockopt(0, 0, 0, NULL, 0))
    printf("getsockopt succeeded?\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x63,%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <accept@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
je     117a <main+0x3a>
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
xor    %r9d,%r9d
xor    %eax,%eax
mov    %eax,%r8d
mov    %r9d,%edi
mov    %r8,%rsi
mov    %r9d,%edx
mov    %r9d,%ecx
call   1050 <recvfrom@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
je     11ae <main+0x6e>
lea    0xe6a(%rip),%rdi
call   1030 <printf@plt>
xor    %r8d,%r8d
xor    %eax,%eax
mov    %eax,%ecx
mov    %r8d,%edi
mov    %r8d,%esi
mov    %r8d,%edx
call   1040 <getsockopt@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
je     11de <main+0x9e>
lea    0xe4f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x63,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <accept@plt>
cmp    $0xffffffff,%eax
je     1160 <main+0x20>
lea    0xecf(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1050 <recvfrom@plt>
cmp    $0xffffffff,%eax
je     1184 <main+0x44>
lea    0xe97(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1040 <getsockopt@plt>
cmp    $0xffffffff,%eax
je     11a5 <main+0x65>
lea    0xe60(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"accept succeeded?\0A\00"
@.str.1 = [21 x i8] c"recvfrom succeeded?\0A\00"
@.str.2 = [23 x i8] c"getsockopt succeeded?\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @accept(i32 99, i32* null, i32 0)
%3 = icmp ne i32 -1, %2
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %0
%7 = call i32 @recvfrom(i32 0, i32* null, i32 0, i32 0, i32* null, i32 0)
%8 = icmp ne i32 -1, %7
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %6
%12 = call i32 @getsockopt(i32 0, i32 0, i32 0, i32* null, i32 0)
%13 = icmp ne i32 -1, %12
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %14, %11
ret i32 0
}

LLVM IR (-O2):
@str = [22 x i8] c"getsockopt succeeded?\00"
@str.3 = [20 x i8] c"recvfrom succeeded?\00"
@str.4 = [18 x i8] c"accept succeeded?\00"
define i32 @main() {
%1 = tail call i32 @accept(i32 99, i32* null, i32 0)
%2 = icmp eq i32 %1, -1
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.4, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
%6 = tail call i32 @recvfrom(i32 0, i32* null, i32 0, i32 0, i32* null, i32 0)
%7 = icmp eq i32 %6, -1
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.3, i64 0, i64 0))
br label %10
10: ; preds = %8, %5
%11 = tail call i32 @getsockopt(i32 0, i32 0, i32 0, i32* null, i32 0)
%12 = icmp eq i32 %11, -1
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
br label %15
15: ; preds = %13, %10
ret i32 0
}