#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*/ atoi(char *);
int /*<<< orphan*/ printf(char *, unsigned char *);
int rddns_update(char *, int /*<<< orphan*/, unsigned char *, int);
int /*<<< orphan*/ usage(char *);
int update(int argc, char **argv) {
  unsigned char buf[1024];
  int r;
  if (argc != 3)
    usage("Need to specify the INS and port");
  r = rddns_update(argv[1], atoi(argv[2]), buf, sizeof buf);
  printf("%s\n", buf);
  return r;
}


x86 assembly (clang, -O0):
<update>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x4(%rbp)
je     1168 <update+0x28>
lea    0xe9d(%rip),%rdi
call   1040 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x420(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    -0x420(%rbp),%rdi
mov    %eax,%esi
lea    -0x410(%rbp),%rdx
mov    $0x400,%ecx
call   1050 <rddns_update@plt>
mov    %eax,-0x414(%rbp)
lea    -0x410(%rbp),%rsi
lea    0xe6f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x414(%rbp),%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<update>:
push   %rbp
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %rsi,%rbx
cmp    $0x3,%edi
je     115f <update+0x1f>
lea    0xea6(%rip),%rdi
call   1040 <usage@plt>
mov    0x8(%rbx),%r14
mov    0x10(%rbx),%rdi
call   1060 <atoi@plt>
mov    %rsp,%rbx
mov    %r14,%rdi
mov    %eax,%esi
mov    %rbx,%rdx
mov    $0x400,%ecx
call   1050 <rddns_update@plt>
mov    %eax,%ebp
lea    0xe97(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %ebp,%eax
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Need to specify the INS and port\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @update(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [1024 x i8]
%6 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 3
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @usage(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %2
%12 = load i8**, i8*** %4
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = load i8**, i8*** %4
%16 = getelementptr inbounds i8*, i8** %15, i64 2
%17 = load i8*, i8** %16
%18 = call i32 @atoi(i8* %17)
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%20 = call i32 @rddns_update(i8* %14, i32 %18, i8* %19, i32 1024)
store i32 %20, i32* %6
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %21)
%23 = load i32, i32* %6
ret i32 %23
}

LLVM IR (-O2):
@.str = [33 x i8] c"Need to specify the INS and port\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @update(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 3
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @usage(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32 @atoi(i8* %12)
%14 = call i32 @rddns_update(i8* %10, i32 %13, i8* %4, i32 1024)
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 %14
}