#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_DCCP;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ test_proto(int /*<<< orphan*/, char *);
int main(void) {
  test_proto(SOCK_DGRAM, "UDP");
  test_proto(SOCK_STREAM, "TCP");
  test_proto(SOCK_DCCP, "DCCP");
  fprintf(stderr, "SUCCESS\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
lea    0xec1(%rip),%rsi
call   1040 <test_proto@plt>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
call   1040 <test_proto@plt>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
lea    0xe9f(%rip),%rsi
call   1040 <test_proto@plt>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
lea    0xe8f(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1040 <test_proto@plt>
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
lea    0xebe(%rip),%rsi
call   1040 <test_proto@plt>
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
lea    0xead(%rip),%rsi
call   1040 <test_proto@plt>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
lea    0xe9d(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@SOCK_DGRAM = global i32 0
@.str = [4 x i8] c"UDP\00"
@SOCK_STREAM = global i32 0
@.str.1 = [4 x i8] c"TCP\00"
@SOCK_DCCP = global i32 0
@.str.2 = [5 x i8] c"DCCP\00"
@stderr = global i32 0
@.str.3 = [9 x i8] c"SUCCESS\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @SOCK_DGRAM
%3 = call i32 @test_proto(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @SOCK_STREAM
%5 = call i32 @test_proto(i32 %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%6 = load i32, i32* @SOCK_DCCP
%7 = call i32 @test_proto(i32 %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@SOCK_DGRAM = global i32 0
@.str = [4 x i8] c"UDP\00"
@SOCK_STREAM = global i32 0
@.str.1 = [4 x i8] c"TCP\00"
@SOCK_DCCP = global i32 0
@.str.2 = [5 x i8] c"DCCP\00"
@stderr = global i32 0
@.str.3 = [9 x i8] c"SUCCESS\0A\00"
define i32 @main() {
%1 = load i32, i32* @SOCK_DGRAM
%2 = tail call i32 @test_proto(i32 %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @SOCK_STREAM
%4 = tail call i32 @test_proto(i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @SOCK_DCCP
%6 = tail call i32 @test_proto(i32 %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}