#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 dummy;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ buffer;

/* Variables and functions */
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ recvfrom(int, char *, int, int /*<<< orphan*/,
                            struct sockaddr *, int *);
void udp_respon(int sockfd) {
  struct sockaddr_in addr;
  int add_size;
  char buffer[80];
  while (1) {
    bzero(buffer, sizeof(buffer));
    add_size = sizeof(struct sockaddr);
    recvfrom(sockfd, buffer, sizeof(buffer), 0, (struct sockaddr *)&addr,
             &add_size);
    printf("server receive: %s\n", buffer);
  }
}


x86 assembly (clang, -O0):
<udp_respon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
mov    $0x50,%esi
call   1050 <bzero@plt>
movl   $0x4,-0xc(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x60(%rbp),%rsi
lea    -0x8(%rbp),%r8
mov    $0x50,%edx
xor    %ecx,%ecx
lea    -0xc(%rbp),%r9
call   1040 <recvfrom@plt>
lea    -0x60(%rbp),%rsi
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
jmp    113b <udp_respon+0xb>

x86 assembly (clang, -O2):
<udp_respon>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x60,%rsp
mov    %edi,%ebp
lea    0x10(%rsp),%rbx
lea    0x8(%rsp),%r14
lea    0x4(%rsp),%r15
lea    0xeac(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
mov    $0x50,%esi
call   1050 <bzero@plt>
movl   $0x4,0x4(%rsp)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x50,%edx
xor    %ecx,%ecx
mov    %r14,%r8
mov    %r15,%r9
call   1040 <recvfrom@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
jmp    1160 <udp_respon+0x30>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [20 x i8] c"server receive: %s\0A\00"
define void @udp_respon(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.sockaddr_in
%4 = alloca i32
%5 = alloca [80 x i8]
store i32 %0, i32* %2
br label %6
6: ; preds = %1, %6
%7 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%8 = call i32 @bzero(i8* %7, i32 80)
store i32 4, i32* %4
%9 = load i32, i32* %2
%10 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%11 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%12 = call i32 @recvfrom(i32 %9, i8* %10, i32 80, i32 0, %struct.sockaddr* %11, i32* %4)
%13 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%14 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %13)
br label %6
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [20 x i8] c"server receive: %s\0A\00"
define void @udp_respon(i32 %0) {
%2 = alloca %struct.sockaddr_in
%3 = alloca i32
%4 = alloca [80 x i8]
%5 = bitcast %struct.sockaddr_in* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%8 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
br label %9
9: ; preds = %9, %1
%10 = call i32 @bzero(i8* %7, i32 80)
store i32 4, i32* %3
%11 = call i32 @recvfrom(i32 %0, i8* %7, i32 80, i32 0, %struct.sockaddr* %8, i32* %3)
%12 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %9
}