#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 timeval {
  int tv_sec;
  int tv_usec;
};
typedef int /*<<< orphan*/ CLIENT;

/* Variables and functions */
int /*<<< orphan*/ CLGET_RETRY_TIMEOUT;
int /*<<< orphan*/ CLGET_TIMEOUT;
int /*<<< orphan*/ CLSET_RETRY_TIMEOUT;
int /*<<< orphan*/ CLSET_TIMEOUT;
int atoi(char *);
int /*<<< orphan*/ clnt_control(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                char *);
int /*<<< orphan*/ *clnt_create(char *, int, int, char *);
int /*<<< orphan*/ printf(char *, int, ...);
int main(int argn, char *argc[]) {
  int run_mode = 0;
  int test_status = 0;
  int progNum = atoi(argc[2]);
  char proto[8] = "udp";
  CLIENT *clnt = NULL;
  struct timeval tvSet;
  struct timeval tvGet;
  clnt = clnt_create(argc[1], progNum, 1, proto);
  if (run_mode) {
    printf("CLIENT : %p\n", clnt);
  }
  tvSet.tv_sec = 1000;
  tvSet.tv_usec = 2000;
  clnt_control(clnt, CLSET_TIMEOUT, (char *)&tvSet);
  clnt_control(clnt, CLGET_TIMEOUT, (char *)&tvGet);
  if ((tvSet.tv_sec != tvGet.tv_sec) || (tvSet.tv_usec != tvGet.tv_usec))
    test_status = 1;
  if (run_mode) {
    printf("Time Set : %ld sec %ld usec\n", (long)tvSet.tv_sec,
           (long)tvSet.tv_usec);
    printf("Time Get : %ld sec %ld usec\n", (long)tvGet.tv_sec,
           (long)tvGet.tv_usec);
  }
  tvSet.tv_sec = 4000;
  tvSet.tv_usec = 8000;
  clnt_control(clnt, CLSET_RETRY_TIMEOUT, (char *)&tvSet);
  clnt_control(clnt, CLGET_RETRY_TIMEOUT, (char *)&tvGet);
  if ((tvSet.tv_sec != tvGet.tv_sec) || (tvSet.tv_usec != tvGet.tv_usec))
    test_status = 1;
  if (run_mode) {
    printf("Time Set : %ld sec %ld usec\n", (long)tvSet.tv_sec,
           (long)tvSet.tv_usec);
    printf("Time Get : %ld sec %ld usec\n", (long)tvGet.tv_sec,
           (long)tvGet.tv_usec);
  }
  printf("%d\n", test_status);
  return test_status;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    0xe85(%rip),%rax
mov    %rax,-0x24(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x1c(%rbp),%esi
lea    -0x24(%rbp),%rcx
mov    $0x1,%edx
call   1050 <clnt_create@plt>
mov    %rax,-0x30(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11c2 <main+0x82>
mov    -0x30(%rbp),%rax
mov    %eax,%esi
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x3e8,-0x38(%rbp)
movl   $0x7d0,-0x34(%rbp)
mov    -0x30(%rbp),%rdi
mov    0x2ded(%rip),%rax
mov    (%rax),%esi
lea    -0x38(%rbp),%rdx
call   1030 <clnt_control@plt>
mov    -0x30(%rbp),%rdi
mov    0x2e07(%rip),%rax
mov    (%rax),%esi
lea    -0x40(%rbp),%rdx
call   1030 <clnt_control@plt>
mov    -0x38(%rbp),%eax
cmp    -0x40(%rbp),%eax
jne    1214 <main+0xd4>
mov    -0x34(%rbp),%eax
cmp    -0x3c(%rbp),%eax
je     121b <main+0xdb>
movl   $0x1,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1255 <main+0x115>
movslq -0x38(%rbp),%rax
mov    %eax,%esi
movslq -0x34(%rbp),%rdx
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x40(%rbp),%rax
mov    %eax,%esi
movslq -0x3c(%rbp),%rdx
lea    0xde4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xfa0,-0x38(%rbp)
movl   $0x1f40,-0x34(%rbp)
mov    -0x30(%rbp),%rdi
mov    0x2d62(%rip),%rax
mov    (%rax),%esi
lea    -0x38(%rbp),%rdx
call   1030 <clnt_control@plt>
mov    -0x30(%rbp),%rdi
mov    0x2d5c(%rip),%rax
mov    (%rax),%esi
lea    -0x40(%rbp),%rdx
call   1030 <clnt_control@plt>
mov    -0x38(%rbp),%eax
cmp    -0x40(%rbp),%eax
jne    12a7 <main+0x167>
mov    -0x34(%rbp),%eax
cmp    -0x3c(%rbp),%eax
je     12ae <main+0x16e>
movl   $0x1,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     12e8 <main+0x1a8>
movslq -0x38(%rbp),%rax
mov    %eax,%esi
movslq -0x34(%rbp),%rdx
lea    0xd4c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x40(%rbp),%rax
mov    %eax,%esi
movslq -0x3c(%rbp),%rdx
lea    0xd51(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xd5d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    0x10(%rsi),%rdi
call   1060 <atoi@plt>
movq   $0x706475,0x10(%rsp)
mov    0x8(%rbx),%rdi
lea    0x10(%rsp),%rcx
mov    %eax,%esi
mov    $0x1,%edx
call   1050 <clnt_create@plt>
mov    %rax,%rbx
movabs $0x7d0000003e8,%rax
mov    %rax,(%rsp)
mov    0x2e40(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
mov    %rbx,%rdi
call   1030 <clnt_control@plt>
mov    0x2e5c(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
call   1030 <clnt_control@plt>
mov    (%rsp),%eax
cmp    0x8(%rsp),%eax
jne    11c0 <main+0x80>
mov    0x4(%rsp),%eax
xor    %ebp,%ebp
cmp    0xc(%rsp),%eax
je     11c5 <main+0x85>
mov    $0x1,%ebp
movabs $0x1f4000000fa0,%rax
mov    %rax,(%rsp)
mov    0x2df6(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
mov    %rbx,%rdi
call   1030 <clnt_control@plt>
mov    0x2df2(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
call   1030 <clnt_control@plt>
mov    (%rsp),%eax
cmp    0x8(%rsp),%eax
jne    1210 <main+0xd0>
mov    0x4(%rsp),%eax
cmp    0xc(%rsp),%eax
je     1215 <main+0xd5>
mov    $0x1,%ebp
lea    0xde4(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
@__const.main.proto = [8 x i8] c"udp\00\00\00\00\00"
@.str = [13 x i8] c"CLIENT : %p\0A\00"
@CLSET_TIMEOUT = global i32 0
@CLGET_TIMEOUT = global i32 0
@.str.1 = [29 x i8] c"Time Set : %ld sec %ld usec\0A\00"
@.str.2 = [29 x i8] c"Time Get : %ld sec %ld usec\0A\00"
@CLSET_RETRY_TIMEOUT = global i32 0
@CLGET_RETRY_TIMEOUT = global i32 0
@.str.3 = [4 x i8] c"%d\0A\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 i32
%9 = alloca [8 x i8]
%10 = alloca i32*
%11 = alloca %struct.timeval
%12 = alloca %struct.timeval
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 2
%15 = load i8*, i8** %14
%16 = call i32 @atoi(i8* %15)
store i32 %16, i32* %8
%17 = bitcast [8 x i8]* %9 to i8*
store i32* null, i32** %10
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = load i32, i32* %8
%22 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%23 = call i32* @clnt_create(i8* %20, i32 %21, i32 1, i8* %22)
store i32* %23, i32** %10
%24 = load i32, i32* %6
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %2
%27 = load i32*, i32** %10
%28 = ptrtoint i32* %27 to i32
%29 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %28)
br label %30
30: ; preds = %26, %2
%31 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i32 0, i32 0
store i32 1000, i32* %31
%32 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i32 0, i32 1
store i32 2000, i32* %32
%33 = load i32*, i32** %10
%34 = load i32, i32* @CLSET_TIMEOUT
%35 = bitcast %struct.timeval* %11 to i8*
%36 = call i32 @clnt_control(i32* %33, i32 %34, i8* %35)
%37 = load i32*, i32** %10
%38 = load i32, i32* @CLGET_TIMEOUT
%39 = bitcast %struct.timeval* %12 to i8*
%40 = call i32 @clnt_control(i32* %37, i32 %38, i8* %39)
%41 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i32 0, i32 0
%42 = load i32, i32* %41
%43 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 0
%44 = load i32, i32* %43
%45 = icmp ne i32 %42, %44
br i1 %45, label %52, label %46
46: ; preds = %30
%47 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i32 0, i32 1
%48 = load i32, i32* %47
%49 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 1
%50 = load i32, i32* %49
%51 = icmp ne i32 %48, %50
br i1 %51, label %52, label %53
52: ; preds = %46, %30
store i32 1, i32* %7
br label %53
53: ; preds = %52, %46
%54 = load i32, i32* %6
%55 = icmp ne i32 %54, 0
br i1 %55, label %56, label %73
56: ; preds = %53
%57 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i32 0, i32 0
%58 = load i32, i32* %57
%59 = sext i32 %58 to i64
%60 = trunc i64 %59 to i32
%61 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i32 0, i32 1
%62 = load i32, i32* %61
%63 = sext i32 %62 to i64
%64 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %60, i64 %63)
%65 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 0
%66 = load i32, i32* %65
%67 = sext i32 %66 to i64
%68 = trunc i64 %67 to i32
%69 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 1
%70 = load i32, i32* %69
%71 = sext i32 %70 to i64
%72 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %68, i64 %71)
br label %73
73: ; preds = %56, %53
%74 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i32 0, i32 0
store i32 4000, i32* %74
%75 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i32 0, i32 1
store i32 8000, i32* %75
%76 = load i32*, i32** %10
%77 = load i32, i32* @CLSET_RETRY_TIMEOUT
%78 = bitcast %struct.timeval* %11 to i8*
%79 = call i32 @clnt_control(i32* %76, i32 %77, i8* %78)
%80 = load i32*, i32** %10
%81 = load i32, i32* @CLGET_RETRY_TIMEOUT
%82 = bitcast %struct.timeval* %12 to i8*
%83 = call i32 @clnt_control(i32* %80, i32 %81, i8* %82)
%84 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i32 0, i32 0
%85 = load i32, i32* %84
%86 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 0
%87 = load i32, i32* %86
%88 = icmp ne i32 %85, %87
br i1 %88, label %95, label %89
89: ; preds = %73
%90 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i32 0, i32 1
%91 = load i32, i32* %90
%92 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 1
%93 = load i32, i32* %92
%94 = icmp ne i32 %91, %93
br i1 %94, label %95, label %96
95: ; preds = %89, %73
store i32 1, i32* %7
br label %96
96: ; preds = %95, %89
%97 = load i32, i32* %6
%98 = icmp ne i32 %97, 0
br i1 %98, label %99, label %116
99: ; preds = %96
%100 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i32 0, i32 0
%101 = load i32, i32* %100
%102 = sext i32 %101 to i64
%103 = trunc i64 %102 to i32
%104 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i32 0, i32 1
%105 = load i32, i32* %104
%106 = sext i32 %105 to i64
%107 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %103, i64 %106)
%108 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 0
%109 = load i32, i32* %108
%110 = sext i32 %109 to i64
%111 = trunc i64 %110 to i32
%112 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 1
%113 = load i32, i32* %112
%114 = sext i32 %113 to i64
%115 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %111, i64 %114)
br label %116
116: ; preds = %99, %96
%117 = load i32, i32* %7
%118 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %117)
%119 = load i32, i32* %7
ret i32 %119
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
@CLSET_TIMEOUT = global i32 0
@CLGET_TIMEOUT = global i32 0
@CLSET_RETRY_TIMEOUT = global i32 0
@CLGET_RETRY_TIMEOUT = global i32 0
@.str.3 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i64
%4 = alloca %struct.timeval
%5 = alloca %struct.timeval
%6 = getelementptr inbounds i8*, i8** %1, i64 2
%7 = load i8*, i8** %6
%8 = tail call i32 @atoi(i8* %7)
%9 = bitcast i64* %3 to i8*
store i64 7365749, i64* %3
%10 = bitcast %struct.timeval* %4 to i8*
%11 = bitcast %struct.timeval* %5 to i8*
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = call i32* @clnt_create(i8* %13, i32 %8, i32 1, i8* %9)
%15 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 0
store i32 1000, i32* %15
%16 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 1
store i32 2000, i32* %16
%17 = load i32, i32* @CLSET_TIMEOUT
%18 = call i32 @clnt_control(i32* %14, i32 %17, i8* %10)
%19 = load i32, i32* @CLGET_TIMEOUT
%20 = call i32 @clnt_control(i32* %14, i32 %19, i8* %11)
%21 = load i32, i32* %15
%22 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i64 0, i32 0
%23 = load i32, i32* %22
%24 = icmp eq i32 %21, %23
br i1 %24, label %25, label %30
25: ; preds = %2
%26 = load i32, i32* %16
%27 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i64 0, i32 1
%28 = load i32, i32* %27
%29 = icmp eq i32 %26, %28
br i1 %29, label %31, label %30
30: ; preds = %25, %2
br label %31
31: ; preds = %25, %30
%32 = phi i32 [ 1, %30 ], [ 0, %25 ]
store i32 4000, i32* %15
store i32 8000, i32* %16
%33 = load i32, i32* @CLSET_RETRY_TIMEOUT
%34 = call i32 @clnt_control(i32* %14, i32 %33, i8* %10)
%35 = load i32, i32* @CLGET_RETRY_TIMEOUT
%36 = call i32 @clnt_control(i32* %14, i32 %35, i8* %11)
%37 = load i32, i32* %15
%38 = load i32, i32* %22
%39 = icmp eq i32 %37, %38
br i1 %39, label %40, label %45
40: ; preds = %31
%41 = load i32, i32* %16
%42 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i64 0, i32 1
%43 = load i32, i32* %42
%44 = icmp eq i32 %41, %43
br i1 %44, label %46, label %45
45: ; preds = %40, %31
br label %46
46: ; preds = %40, %45
%47 = phi i32 [ 1, %45 ], [ %32, %40 ]
%48 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %47)
ret i32 %47
}