#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*/ SOCK_DGRAM;
int /*<<< orphan*/ SOCK_STREAM;
int _socket(char *, char *, int /*<<< orphan*/);
int _socket_udp(char *);
int main(int argc, char *argv[]) {
  int ret = 0;
  (void)argc;
  ret |= _socket(argv[0], "1/2", SOCK_DGRAM);
  ret |= _socket(argv[0], "2/2", SOCK_STREAM);
  ret |= _socket_udp(argv[0]);
  return (ret == 0) ? 0 : 2;
}


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)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    0x2e9d(%rip),%rax
mov    (%rax),%edx
lea    0xeac(%rip),%rsi
call   1030 <_socket@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    0x2e6b(%rip),%rax
mov    (%rax),%edx
lea    0xe8e(%rip),%rsi
call   1030 <_socket@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <_socket_udp@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edx
mov    $0x2,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    (%rsi),%rdi
mov    0x2eb7(%rip),%rax
mov    (%rax),%edx
lea    0xec6(%rip),%rsi
call   1030 <_socket@plt>
mov    %eax,%r14d
mov    (%rbx),%rdi
mov    0x2e8c(%rip),%rax
mov    (%rax),%edx
lea    0xeaf(%rip),%rsi
call   1030 <_socket@plt>
mov    %eax,%ebp
or     %r14d,%ebp
mov    (%rbx),%rdi
call   1040 <_socket_udp@plt>
xor    %ecx,%ecx
or     %ebp,%eax
setne  %cl
add    %ecx,%ecx
mov    %ecx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"1/2\00"
@SOCK_DGRAM = global i32 0
@.str.1 = [4 x i8] c"2/2\00"
@SOCK_STREAM = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 0
%10 = load i8*, i8** %9
%11 = load i32, i32* @SOCK_DGRAM
%12 = call i32 @_socket(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %6
%14 = or i32 %13, %12
store i32 %14, i32* %6
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = load i32, i32* @SOCK_STREAM
%19 = call i32 @_socket(i8* %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %6
%21 = or i32 %20, %19
store i32 %21, i32* %6
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 0
%24 = load i8*, i8** %23
%25 = call i32 @_socket_udp(i8* %24)
%26 = load i32, i32* %6
%27 = or i32 %26, %25
store i32 %27, i32* %6
%28 = load i32, i32* %6
%29 = icmp eq i32 %28, 0
%30 = zext i1 %29 to i64
%31 = select i1 %29, i32 0, i32 2
ret i32 %31
}

LLVM IR (-O2):
@.str = [4 x i8] c"1/2\00"
@SOCK_DGRAM = global i32 0
@.str.1 = [4 x i8] c"2/2\00"
@SOCK_STREAM = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = load i32, i32* @SOCK_DGRAM
%5 = tail call i32 @_socket(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load i8*, i8** %1
%7 = load i32, i32* @SOCK_STREAM
%8 = tail call i32 @_socket(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = or i32 %8, %5
%10 = load i8*, i8** %1
%11 = tail call i32 @_socket_udp(i8* %10)
%12 = or i32 %9, %11
%13 = icmp eq i32 %12, 0
%14 = select i1 %13, i32 0, i32 2
ret i32 %14
}