int main(argc, argv)
int argc;
char **argv;
{
  int port, lenbuf;
  char *hostname, *buf;
  if (argc != 4)
    Error("usage: udp_put hostname port 'Message to server'", argc);
  hostname = argv[1];
  port = atoi(argv[2]);
  buf = argv[3];
  lenbuf = strlen(buf) + 1;
  if (udp_send(hostname, port, buf, lenbuf) != lenbuf)
    Error("udp_put: udp_send failed", -1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     1171 <main+0x31>
mov    -0x8(%rbp),%esi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1040 <Error@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    $0x0,%al
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%rax
mov    %eax,-0x18(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x18(%rbp),%ecx
mov    $0x0,%al
call   1050 <udp_send@plt>
cmp    -0x18(%rbp),%eax
je     11dc <main+0x9c>
lea    0xe61(%rip),%rdi
mov    $0xffffffff,%esi
mov    $0x0,%al
call   1040 <Error@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x4,%edi
je     115f <main+0x1f>
mov    %edi,%esi
lea    0xea8(%rip),%rdi
xor    %eax,%eax
call   1040 <Error@plt>
mov    0x8(%rbx),%r14
mov    0x10(%rbx),%rdi
xor    %eax,%eax
call   1060 <atoi@plt>
mov    %eax,%r15d
mov    0x18(%rbx),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rax,%rbp
add    $0x1,%ebp
mov    %r14,%rdi
mov    %r15d,%esi
mov    %rbx,%rdx
mov    %ebp,%ecx
xor    %eax,%eax
call   1050 <udp_send@plt>
cmp    %ebp,%eax
je     11ac <main+0x6c>
lea    0xe91(%rip),%rdi
mov    $0xffffffff,%esi
xor    %eax,%eax
call   1040 <Error@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [49 x i8] c"usage: udp_put hostname port 'Message to server'\00"
@.str.1 = [25 x i8] c"udp_put: udp_send failed\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 4
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i32, i32* %4
%14 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @Error to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %12, %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
store i8* %18, i8** %8
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 2
%21 = load i8*, i8** %20
%22 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %21)
store i32 %22, i32* %6
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 3
%25 = load i8*, i8** %24
store i8* %25, i8** %9
%26 = load i8*, i8** %9
%27 = call i64 @strlen(i8* %26)
%28 = add i64 %27, 1
%29 = trunc i64 %28 to i32
store i32 %29, i32* %7
%30 = load i8*, i8** %8
%31 = load i32, i32* %6
%32 = load i8*, i8** %9
%33 = load i32, i32* %7
%34 = call i32 (i8*, i32, i8*, i32, ...) bitcast (i32 (...)* @udp_send to i32 (i8*, i32, i8*, i32, ...)*)(i8* %30, i32 %31, i8* %32, i32 %33)
%35 = load i32, i32* %7
%36 = icmp ne i32 %34, %35
br i1 %36, label %37, label %39
37: ; preds = %15
%38 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @Error to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 -1)
br label %39
39: ; preds = %37, %15
ret i32 0
}

LLVM IR (-O2):
@.str = [49 x i8] c"usage: udp_put hostname port 'Message to server'\00"
@.str.1 = [25 x i8] c"udp_put: udp_send failed\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @Error to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %6
6: ; preds = %4, %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = getelementptr inbounds i8*, i8** %1, i64 2
%10 = load i8*, i8** %9
%11 = tail call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %10)
%12 = getelementptr inbounds i8*, i8** %1, i64 3
%13 = load i8*, i8** %12
%14 = tail call i64 @strlen(i8* dereferenceable(1) %13)
%15 = trunc i64 %14 to i32
%16 = add i32 %15, 1
%17 = tail call i32 (i8*, i32, i8*, i32, ...) bitcast (i32 (...)* @udp_send to i32 (i8*, i32, i8*, i32, ...)*)(i8* %8, i32 %11, i8* %13, i32 %16)
%18 = icmp eq i32 %17, %16
br i1 %18, label %21, label %19
19: ; preds = %6
%20 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @Error to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 -1)
br label %21
21: ; preds = %19, %6
ret i32 0
}