#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*/ printf(char *, char *);
int strlen(char *);
int /*<<< orphan*/ usage();
scalar_t__ usbrelay_init();
int /*<<< orphan*/ usbrelay_set(char, char);
char *usbrelay_strerror();
int main(int argc, char *argv[]) {
  if (argc != 3)
    usage();
  if (strlen(argv[2]) != 1)
    usage();
  if (strlen(argv[2]) != 1)
    usage();
  if ((argv[1][0] < '0') || (argv[1][0] > '9'))
    usage();
  if ((argv[2][0] < '0') || (argv[2][0] > '1'))
    usage();
  if (usbrelay_init() != 0) {
    printf("%s\n", usbrelay_strerror());
    return 1;
  }
  usbrelay_set(argv[1][0] - '0', argv[2][0] - '0');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1187 <main+0x27>
mov    $0x0,%al
call   1070 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1030 <strlen@plt>
cmp    $0x1,%eax
je     11a4 <main+0x44>
mov    $0x0,%al
call   1070 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1030 <strlen@plt>
cmp    $0x1,%eax
je     11c1 <main+0x61>
mov    $0x0,%al
call   1070 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     11e9 <main+0x89>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
jle    11f0 <main+0x90>
mov    $0x0,%al
call   1070 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     1218 <main+0xb8>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%eax
cmp    $0x31,%eax
jle    121f <main+0xbf>
mov    $0x0,%al
call   1070 <usage@plt>
mov    $0x0,%al
call   1080 <usbrelay_init@plt>
cmp    $0x0,%rax
je     1252 <main+0xf2>
mov    $0x0,%al
call   1050 <usbrelay_strerror@plt>
mov    %rax,%rsi
lea    0xdbf(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1282 <main+0x122>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
movsbl %cl,%edi
movsbl %al,%esi
call   1060 <usbrelay_set@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x3,%edi
je     1172 <main+0x12>
xor    %eax,%eax
call   1070 <usage@plt>
mov    0x10(%rbx),%rdi
call   1030 <strlen@plt>
cmp    $0x1,%eax
je     1187 <main+0x27>
xor    %eax,%eax
call   1070 <usage@plt>
mov    0x10(%rbx),%rdi
call   1030 <strlen@plt>
cmp    $0x1,%eax
je     119c <main+0x3c>
xor    %eax,%eax
call   1070 <usage@plt>
mov    0x8(%rbx),%rax
mov    (%rax),%al
add    $0xc6,%al
cmp    $0xf5,%al
ja     11af <main+0x4f>
xor    %eax,%eax
call   1070 <usage@plt>
mov    0x10(%rbx),%rax
mov    (%rax),%al
add    $0xce,%al
cmp    $0xfd,%al
ja     11c2 <main+0x62>
xor    %eax,%eax
call   1070 <usage@plt>
xor    %ebp,%ebp
xor    %eax,%eax
call   1080 <usbrelay_init@plt>
test   %rax,%rax
je     11ed <main+0x8d>
xor    %eax,%eax
call   1050 <usbrelay_strerror@plt>
lea    0xe22(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    $0x1,%ebp
jmp    1209 <main+0xa9>
mov    0x8(%rbx),%rax
mov    0x10(%rbx),%rcx
mov    (%rax),%al
add    $0xd0,%al
mov    (%rcx),%cl
add    $0xd0,%cl
movsbl %al,%edi
movsbl %cl,%esi
call   1060 <usbrelay_set@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 3
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 (...) @usage()
br label %10
10: ; preds = %8, %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 2
%13 = load i8*, i8** %12
%14 = call i32 @strlen(i8* %13)
%15 = icmp ne i32 %14, 1
br i1 %15, label %16, label %18
16: ; preds = %10
%17 = call i32 (...) @usage()
br label %18
18: ; preds = %16, %10
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 2
%21 = load i8*, i8** %20
%22 = call i32 @strlen(i8* %21)
%23 = icmp ne i32 %22, 1
br i1 %23, label %24, label %26
24: ; preds = %18
%25 = call i32 (...) @usage()
br label %26
26: ; preds = %24, %18
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = getelementptr inbounds i8, i8* %29, i64 0
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp slt i32 %32, 48
br i1 %33, label %42, label %34
34: ; preds = %26
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 1
%37 = load i8*, i8** %36
%38 = getelementptr inbounds i8, i8* %37, i64 0
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp sgt i32 %40, 57
br i1 %41, label %42, label %44
42: ; preds = %34, %26
%43 = call i32 (...) @usage()
br label %44
44: ; preds = %42, %34
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 2
%47 = load i8*, i8** %46
%48 = getelementptr inbounds i8, i8* %47, i64 0
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = icmp slt i32 %50, 48
br i1 %51, label %60, label %52
52: ; preds = %44
%53 = load i8**, i8*** %5
%54 = getelementptr inbounds i8*, i8** %53, i64 2
%55 = load i8*, i8** %54
%56 = getelementptr inbounds i8, i8* %55, i64 0
%57 = load i8, i8* %56
%58 = sext i8 %57 to i32
%59 = icmp sgt i32 %58, 49
br i1 %59, label %60, label %62
60: ; preds = %52, %44
%61 = call i32 (...) @usage()
br label %62
62: ; preds = %60, %52
%63 = call i64 (...) @usbrelay_init()
%64 = icmp ne i64 %63, 0
br i1 %64, label %65, label %68
65: ; preds = %62
%66 = call i8* (...) @usbrelay_strerror()
%67 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %66)
store i32 1, i32* %3
br label %86
68: ; preds = %62
%69 = load i8**, i8*** %5
%70 = getelementptr inbounds i8*, i8** %69, i64 1
%71 = load i8*, i8** %70
%72 = getelementptr inbounds i8, i8* %71, i64 0
%73 = load i8, i8* %72
%74 = sext i8 %73 to i32
%75 = sub nsw i32 %74, 48
%76 = trunc i32 %75 to i8
%77 = load i8**, i8*** %5
%78 = getelementptr inbounds i8*, i8** %77, i64 2
%79 = load i8*, i8** %78
%80 = getelementptr inbounds i8, i8* %79, i64 0
%81 = load i8, i8* %80
%82 = sext i8 %81 to i32
%83 = sub nsw i32 %82, 48
%84 = trunc i32 %83 to i8
%85 = call i32 @usbrelay_set(i8 signext %76, i8 signext %84)
store i32 0, i32* %3
br label %86
86: ; preds = %68, %65
%87 = load i32, i32* %3
ret i32 %87
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (...) @usage()
br label %6
6: ; preds = %4, %2
%7 = getelementptr inbounds i8*, i8** %1, i64 2
%8 = load i8*, i8** %7
%9 = tail call i32 @strlen(i8* %8)
%10 = icmp eq i32 %9, 1
br i1 %10, label %13, label %11
11: ; preds = %6
%12 = tail call i32 (...) @usage()
br label %13
13: ; preds = %11, %6
%14 = load i8*, i8** %7
%15 = tail call i32 @strlen(i8* %14)
%16 = icmp eq i32 %15, 1
br i1 %16, label %19, label %17
17: ; preds = %13
%18 = tail call i32 (...) @usage()
br label %19
19: ; preds = %17, %13
%20 = getelementptr inbounds i8*, i8** %1, i64 1
%21 = load i8*, i8** %20
%22 = load i8, i8* %21
%23 = add i8 %22, -58
%24 = icmp ult i8 %23, -10
br i1 %24, label %25, label %27
25: ; preds = %19
%26 = tail call i32 (...) @usage()
br label %27
27: ; preds = %19, %25
%28 = load i8*, i8** %7
%29 = load i8, i8* %28
%30 = add i8 %29, -50
%31 = icmp ult i8 %30, -2
br i1 %31, label %32, label %34
32: ; preds = %27
%33 = tail call i32 (...) @usage()
br label %34
34: ; preds = %27, %32
%35 = tail call i64 (...) @usbrelay_init()
%36 = icmp eq i64 %35, 0
br i1 %36, label %40, label %37
37: ; preds = %34
%38 = tail call i8* (...) @usbrelay_strerror()
%39 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %38)
br label %48
40: ; preds = %34
%41 = load i8*, i8** %20
%42 = load i8, i8* %41
%43 = add i8 %42, -48
%44 = load i8*, i8** %7
%45 = load i8, i8* %44
%46 = add i8 %45, -48
%47 = tail call i32 @usbrelay_set(i8 signext %43, i8 signext %46)
br label %48
48: ; preds = %40, %37
%49 = phi i32 [ 1, %37 ], [ 0, %40 ]
ret i32 %49
}