#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 sockaddr_in {
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_addr;
};
struct ether_addr {
  int dummy;
};
typedef int /*<<< orphan*/ printBuf;

/* Variables and functions */
int BUFSIZ;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int htons(int /*<<< orphan*/);
char *inet_ntoa(int /*<<< orphan*/);
int /*<<< orphan*/ snprintfMacAdress(char *, int, struct ether_addr *);
int /*<<< orphan*/ stdout;
int printGedekConfig(struct sockaddr_in *gedekIpPort,
                     struct ether_addr *srcDefaultGedekMacAddress,
                     struct sockaddr_in *destinationIpPort1,
                     struct ether_addr *destinationMacAdress1,
                     struct sockaddr_in *destinationIpPort2,
                     struct ether_addr *destinationMacAdress2) {
  char printBuf[BUFSIZ];
  fprintf(stdout, "GEDEK MAC ADDRESS: ");
  snprintfMacAdress(printBuf, sizeof(printBuf), srcDefaultGedekMacAddress);
  fprintf(stdout, "%s\n", printBuf);
  fprintf(stdout, "GEDEK IP ADDRESS: %s\n", inet_ntoa(gedekIpPort->sin_addr));
  fprintf(stdout, "GEDEK DESTINATION1 IP ADDRESS: %s:%d\n",
          inet_ntoa(destinationIpPort1->sin_addr),
          htons(destinationIpPort1->sin_port));
  fprintf(stdout, "GEDEK DESTINATION1 MAC ADDRESS: ");
  snprintfMacAdress(printBuf, sizeof(printBuf), destinationMacAdress1);
  fprintf(stdout, "%s\n", printBuf);
  fprintf(stdout, "GEDEK DESTINATION2 IP ADDRESS: %s:%d\n",
          inet_ntoa(destinationIpPort2->sin_addr),
          htons(destinationIpPort2->sin_port));
  fprintf(stdout, "GEDEK DESTINATION2 MAC ADDRESS: ");
  snprintfMacAdress(printBuf, sizeof(printBuf), destinationMacAdress2);
  fprintf(stdout, "%s\n", printBuf);
  return (0);
}


x86 assembly (clang, -O0):
<printGedekConfig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    0x2e79(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x50(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x40(%rbp)
mov    0x2e41(%rip),%rax
mov    (%rax),%edi
lea    0xe60(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x48(%rbp),%rdi
mov    -0x50(%rbp),%rax
mov    %eax,%esi
mov    -0x10(%rbp),%rdx
call   1030 <snprintfMacAdress@plt>
mov    -0x48(%rbp),%rdx
mov    0x2e13(%rip),%rax
mov    (%rax),%edi
lea    0xe58(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2dfc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x70(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edi
call   1040 <inet_ntoa@plt>
mov    -0x70(%rbp),%edi
mov    %rax,%rdx
lea    0xe1a(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2dd0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,-0x68(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1050 <htons@plt>
mov    -0x6c(%rbp),%edi
mov    -0x68(%rbp),%rdx
mov    %eax,%ecx
lea    0xdf2(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2d92(%rip),%rax
mov    (%rax),%edi
lea    0xe01(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x48(%rbp),%rdi
mov    -0x50(%rbp),%rax
mov    %eax,%esi
mov    -0x20(%rbp),%rdx
call   1030 <snprintfMacAdress@plt>
mov    -0x48(%rbp),%rdx
mov    0x2d64(%rip),%rax
mov    (%rax),%edi
lea    0xda9(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2d4d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x28(%rbp),%rax
mov    0x4(%rax),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,-0x58(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%edi
call   1050 <htons@plt>
mov    -0x5c(%rbp),%edi
mov    -0x58(%rbp),%rdx
mov    %eax,%ecx
lea    0xdb6(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2d0f(%rip),%rax
mov    (%rax),%edi
lea    0xdc5(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x48(%rbp),%rdi
mov    -0x50(%rbp),%rax
mov    %eax,%esi
mov    -0x30(%rbp),%rdx
call   1030 <snprintfMacAdress@plt>
mov    -0x48(%rbp),%rdx
mov    0x2ce1(%rip),%rax
mov    (%rax),%edi
lea    0xd26(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x38(%rbp),%rax
mov    %rax,%rsp
xor    %eax,%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printGedekConfig>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9,-0x58(%rbp)
mov    %r8,-0x50(%rbp)
mov    %rcx,-0x48(%rbp)
mov    %rdx,-0x40(%rbp)
mov    %rsi,%r12
mov    %rdi,-0x30(%rbp)
mov    0x2e71(%rip),%rax
mov    (%rax),%ebx
mov    %rsp,%r13
mov    %rbx,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
mov    %rax,%r15
lea    0xe68(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %r13,%rdi
mov    %ebx,%esi
mov    %rbx,-0x38(%rbp)
mov    %r12,%rdx
call   1030 <snprintfMacAdress@plt>
mov    (%r15),%edi
lea    0xe6c(%rip),%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%r15),%r12d
mov    -0x30(%rbp),%rax
mov    0x4(%rax),%edi
call   1040 <inet_ntoa@plt>
lea    0xe3a(%rip),%rsi
mov    %r12d,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%r15),%r14d
mov    -0x40(%rbp),%r15
mov    0x4(%r15),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,%r12
mov    (%r15),%edi
call   1050 <htons@plt>
lea    0xe21(%rip),%rsi
mov    %r14d,%edi
mov    %r12,%rdx
mov    %eax,%ecx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x2db9(%rip),%r15
mov    (%r15),%edi
lea    0xe27(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %r13,%rdi
mov    %ebx,%esi
mov    -0x48(%rbp),%rdx
call   1030 <snprintfMacAdress@plt>
mov    (%r15),%edi
lea    0xdde(%rip),%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%r15),%r14d
mov    -0x50(%rbp),%rbx
mov    0x4(%rbx),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,%r12
mov    (%rbx),%edi
call   1050 <htons@plt>
lea    0xdff(%rip),%rsi
mov    %r14d,%edi
mov    %r12,%rdx
mov    %eax,%ecx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%r15),%edi
lea    0xe0c(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %r13,%rdi
mov    -0x38(%rbp),%rsi
mov    -0x58(%rbp),%rdx
call   1030 <snprintfMacAdress@plt>
mov    (%r15),%edi
lea    0xd7a(%rip),%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32 }
%struct.ether_addr = type { i32 }
@BUFSIZ = global i32 0
@stdout = global i32 0
@.str = [20 x i8] c"GEDEK MAC ADDRESS: \00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [22 x i8] c"GEDEK IP ADDRESS: %s\0A\00"
@.str.3 = [38 x i8] c"GEDEK DESTINATION1 IP ADDRESS: %s:%d\0A\00"
@.str.4 = [33 x i8] c"GEDEK DESTINATION1 MAC ADDRESS: \00"
@.str.5 = [38 x i8] c"GEDEK DESTINATION2 IP ADDRESS: %s:%d\0A\00"
@.str.6 = [33 x i8] c"GEDEK DESTINATION2 MAC ADDRESS: \00"
define i32 @printGedekConfig(%struct.sockaddr_in* %0, %struct.ether_addr* %1, %struct.sockaddr_in* %2, %struct.ether_addr* %3, %struct.sockaddr_in* %4, %struct.ether_addr* %5) {
%7 = alloca %struct.sockaddr_in*
%8 = alloca %struct.ether_addr*
%9 = alloca %struct.sockaddr_in*
%10 = alloca %struct.ether_addr*
%11 = alloca %struct.sockaddr_in*
%12 = alloca %struct.ether_addr*
%13 = alloca i8*
%14 = alloca i64
store %struct.sockaddr_in* %0, %struct.sockaddr_in** %7
store %struct.ether_addr* %1, %struct.ether_addr** %8
store %struct.sockaddr_in* %2, %struct.sockaddr_in** %9
store %struct.ether_addr* %3, %struct.ether_addr** %10
store %struct.sockaddr_in* %4, %struct.sockaddr_in** %11
store %struct.ether_addr* %5, %struct.ether_addr** %12
%15 = load i32, i32* @BUFSIZ
%16 = zext i32 %15 to i64
%17 = call i8* @llvm.stacksave()
store i8* %17, i8** %13
%18 = alloca i8, i64 %16
store i64 %16, i64* %14
%19 = load i32, i32* @stdout
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%21 = trunc i64 %16 to i32
%22 = load %struct.ether_addr*, %struct.ether_addr** %8
%23 = call i32 @snprintfMacAdress(i8* %18, i32 %21, %struct.ether_addr* %22)
%24 = load i32, i32* @stdout
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %18)
%26 = load i32, i32* @stdout
%27 = load %struct.sockaddr_in*, %struct.sockaddr_in** %7
%28 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %27, i32 0, i32 1
%29 = load i32, i32* %28
%30 = call i8* @inet_ntoa(i32 %29)
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %30)
%32 = load i32, i32* @stdout
%33 = load %struct.sockaddr_in*, %struct.sockaddr_in** %9
%34 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %33, i32 0, i32 1
%35 = load i32, i32* %34
%36 = call i8* @inet_ntoa(i32 %35)
%37 = load %struct.sockaddr_in*, %struct.sockaddr_in** %9
%38 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %37, i32 0, i32 0
%39 = load i32, i32* %38
%40 = call i32 @htons(i32 %39)
%41 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i8* %36, i32 %40)
%42 = load i32, i32* @stdout
%43 = call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0))
%44 = trunc i64 %16 to i32
%45 = load %struct.ether_addr*, %struct.ether_addr** %10
%46 = call i32 @snprintfMacAdress(i8* %18, i32 %44, %struct.ether_addr* %45)
%47 = load i32, i32* @stdout
%48 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %18)
%49 = load i32, i32* @stdout
%50 = load %struct.sockaddr_in*, %struct.sockaddr_in** %11
%51 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %50, i32 0, i32 1
%52 = load i32, i32* %51
%53 = call i8* @inet_ntoa(i32 %52)
%54 = load %struct.sockaddr_in*, %struct.sockaddr_in** %11
%55 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %54, i32 0, i32 0
%56 = load i32, i32* %55
%57 = call i32 @htons(i32 %56)
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i8* %53, i32 %57)
%59 = load i32, i32* @stdout
%60 = call i32 (i32, i8*, ...) @fprintf(i32 %59, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0))
%61 = trunc i64 %16 to i32
%62 = load %struct.ether_addr*, %struct.ether_addr** %12
%63 = call i32 @snprintfMacAdress(i8* %18, i32 %61, %struct.ether_addr* %62)
%64 = load i32, i32* @stdout
%65 = call i32 (i32, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %18)
%66 = load i8*, i8** %13
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32 }
%struct.ether_addr = type { i32 }
@BUFSIZ = global i32 0
@stdout = global i32 0
@.str = [20 x i8] c"GEDEK MAC ADDRESS: \00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [22 x i8] c"GEDEK IP ADDRESS: %s\0A\00"
@.str.3 = [38 x i8] c"GEDEK DESTINATION1 IP ADDRESS: %s:%d\0A\00"
@.str.4 = [33 x i8] c"GEDEK DESTINATION1 MAC ADDRESS: \00"
@.str.5 = [38 x i8] c"GEDEK DESTINATION2 IP ADDRESS: %s:%d\0A\00"
@.str.6 = [33 x i8] c"GEDEK DESTINATION2 MAC ADDRESS: \00"
define i32 @printGedekConfig(%struct.sockaddr_in* nocapture %0, %struct.ether_addr* %1, %struct.sockaddr_in* nocapture %2, %struct.ether_addr* %3, %struct.sockaddr_in* nocapture %4, %struct.ether_addr* %5) {
%7 = load i32, i32* @BUFSIZ
%8 = zext i32 %7 to i64
%9 = alloca i8, i64 %8
%10 = load i32, i32* @stdout
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @snprintfMacAdress(i8* %9, i32 %7, %struct.ether_addr* %1)
%13 = load i32, i32* @stdout
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%15 = load i32, i32* @stdout
%16 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %0, i64 0, i32 1
%17 = load i32, i32* %16
%18 = call i8* @inet_ntoa(i32 %17)
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %18)
%20 = load i32, i32* @stdout
%21 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 1
%22 = load i32, i32* %21
%23 = call i8* @inet_ntoa(i32 %22)
%24 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 0
%25 = load i32, i32* %24
%26 = call i32 @htons(i32 %25)
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i8* %23, i32 %26)
%28 = load i32, i32* @stdout
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0))
%30 = call i32 @snprintfMacAdress(i8* %9, i32 %7, %struct.ether_addr* %3)
%31 = load i32, i32* @stdout
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%33 = load i32, i32* @stdout
%34 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1
%35 = load i32, i32* %34
%36 = call i8* @inet_ntoa(i32 %35)
%37 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0
%38 = load i32, i32* %37
%39 = call i32 @htons(i32 %38)
%40 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i8* %36, i32 %39)
%41 = load i32, i32* @stdout
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0))
%43 = call i32 @snprintfMacAdress(i8* %9, i32 %7, %struct.ether_addr* %5)
%44 = load i32, i32* @stdout
%45 = call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %9)
ret i32 0
}