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

/* Variables and functions */
int create_socket(struct in_addr *, int);
int /*<<< orphan*/ inet_aton(char *, struct in_addr *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ recv_frames(int);
int main(int argc, char *argv[]) {
  if (argc < 2) {
    printf("Syntax: %s <local ip address>\n", argv[0]);
    return 1;
  }
  struct in_addr local_ip;
  int port = 7653;
  printf("Local IP: '%s', port %d\n", argv[1], port);
  inet_aton(argv[1], &local_ip);
  int mySocket = create_socket(&local_ip, port);
  recv_frames(mySocket);
  printf("Receiver finished\n");
  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)
cmpl   $0x2,-0x8(%rbp)
jge    1181 <main+0x41>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11de <main+0x9e>
movl   $0x1de5,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x1c(%rbp),%edx
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <inet_aton@plt>
mov    -0x1c(%rbp),%esi
lea    -0x18(%rbp),%rdi
call   1050 <create_socket@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%edi
call   1060 <recv_frames@plt>
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x1,%edi
jg     1173 <main+0x23>
mov    (%rbx),%rsi
lea    0xe9b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%ebp
jmp    11bb <main+0x6b>
mov    0x8(%rbx),%rsi
lea    0xea1(%rip),%rdi
xor    %ebp,%ebp
mov    $0x1de5,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <inet_aton@plt>
mov    %rbx,%rdi
mov    $0x1de5,%esi
call   1060 <create_socket@plt>
mov    %eax,%edi
call   1070 <recv_frames@plt>
lea    0xe82(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.in_addr = type { i32 }
@.str = [31 x i8] c"Syntax: %s <local ip address>\0A\00"
@.str.1 = [25 x i8] c"Local IP: '%s', port %d\0A\00"
@.str.2 = [19 x i8] c"Receiver finished\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.in_addr
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 2
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %14)
store i32 1, i32* %3
br label %31
16: ; preds = %2
store i32 7653, i32* %7
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = load i32, i32* %7
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %19, i32 %20)
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32 @inet_aton(i8* %24, %struct.in_addr* %6)
%26 = load i32, i32* %7
%27 = call i32 @create_socket(%struct.in_addr* %6, i32 %26)
store i32 %27, i32* %8
%28 = load i32, i32* %8
%29 = call i32 @recv_frames(i32 %28)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %31
31: ; preds = %16, %11
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
%struct.in_addr = type { i32 }
@.str = [31 x i8] c"Syntax: %s <local ip address>\0A\00"
@.str.1 = [25 x i8] c"Local IP: '%s', port %d\0A\00"
@str = [18 x i8] c"Receiver finished\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.in_addr
%4 = icmp slt i32 %0, 2
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i8*, i8** %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %18
8: ; preds = %2
%9 = bitcast %struct.in_addr* %3 to i8*
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %11, i32 7653)
%13 = load i8*, i8** %10
%14 = call i32 @inet_aton(i8* %13, %struct.in_addr* %3)
%15 = call i32 @create_socket(%struct.in_addr* %3, i32 7653)
%16 = call i32 @recv_frames(i32 %15)
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
br label %18
18: ; preds = %8, %5
%19 = phi i32 [ 1, %5 ], [ 0, %8 ]
ret i32 %19
}