#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ ss_set_freq_info(int, char *, char **, int);
int /*<<< orphan*/ ssa_iw_sockets_close(int);
int ssa_iw_sockets_open();
int /*<<< orphan*/ usage();
int main(int argc, char **argv) {
  int skfd;
  int ss_channel;
  if ((skfd = ssa_iw_sockets_open()) < 0) {
    perror("socket");
    printf("ssa_iw_sockets_open error\n");
    exit(0);
  }
  if (argc < 2) {
    usage();
    exit(0);
  }
  ss_set_freq_info(skfd, argv[1], argv + 2, argc - 2);
  ssa_iw_sockets_close(skfd);
  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)
mov    $0x0,%al
call   1030 <ssa_iw_sockets_open@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    11b8 <main+0x48>
lea    0xe60(%rip),%rdi
call   1070 <perror@plt>
lea    0xe5b(%rip),%rdi
call   1050 <printf@plt>
xor    %edi,%edi
call   1080 <exit@plt>
cmpl   $0x2,-0x8(%rbp)
jge    11d0 <main+0x60>
mov    $0x0,%al
call   1060 <usage@plt>
xor    %edi,%edi
call   1080 <exit@plt>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x10(%rbp),%rdx
add    $0x10,%rdx
mov    -0x8(%rbp),%ecx
sub    $0x2,%ecx
call   1090 <ss_set_freq_info@plt>
mov    -0x14(%rbp),%edi
call   1040 <ssa_iw_sockets_close@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <ssa_iw_sockets_open@plt>
test   %eax,%eax
js     11b0 <main+0x40>
cmp    $0x1,%ebx
jle    11cf <main+0x5f>
mov    %eax,%ebp
mov    0x8(%r14),%rsi
add    $0x10,%r14
add    $0xfffffffe,%ebx
mov    %eax,%edi
mov    %r14,%rdx
mov    %ebx,%ecx
call   1090 <ss_set_freq_info@plt>
mov    %ebp,%edi
call   1050 <ssa_iw_sockets_close@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xe49(%rip),%rdi
call   1070 <perror@plt>
lea    0xe44(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1080 <exit@plt>
xor    %eax,%eax
call   1060 <usage@plt>
xor    %edi,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"socket\00"
@.str.1 = [27 x i8] c"ssa_iw_sockets_open error\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 (...) @ssa_iw_sockets_open()
store i32 %8, i32* %6
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @exit(i32 0)
unreachable
14: ; preds = %2
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 2
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = call i32 (...) @usage()
%19 = call i32 @exit(i32 0)
unreachable
20: ; preds = %14
%21 = load i32, i32* %6
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 2
%27 = load i32, i32* %4
%28 = sub nsw i32 %27, 2
%29 = call i32 @ss_set_freq_info(i32 %21, i8* %24, i8** %26, i32 %28)
%30 = load i32, i32* %6
%31 = call i32 @ssa_iw_sockets_close(i32 %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"socket\00"
@str = [26 x i8] c"ssa_iw_sockets_open error\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 (...) @ssa_iw_sockets_open()
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 0)
unreachable
9: ; preds = %2
%10 = icmp slt i32 %0, 2
br i1 %10, label %11, label %14
11: ; preds = %9
%12 = tail call i32 (...) @usage()
%13 = tail call i32 @exit(i32 0)
unreachable
14: ; preds = %9
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = getelementptr inbounds i8*, i8** %1, i64 2
%18 = add nsw i32 %0, -2
%19 = tail call i32 @ss_set_freq_info(i32 %3, i8* %16, i8** %17, i32 %18)
%20 = tail call i32 @ssa_iw_sockets_close(i32 %3)
ret i32 0
}