#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 atoi(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ set_corr(int, int, int);
scalar_t__ set_drive(int, int, int, int);
scalar_t__ set_freq(int, int, int, int, short, int);
scalar_t__ set_load(int, int, int);
scalar_t__ set_output(int, int, int, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int set_dds_parameters(int channel, int argc, char **argv, int fd) {
  int i, value1, value2, value3, value4;
  for (i = 3; i < argc; i++) {
    if (!strcmp("corr", argv[i])) {
      if (argc < i + 2) {
        fprintf(stderr, "Too few arguments for corr command.\n");
        return 1;
      }
      value1 = atoi(argv[++i]);
      if (set_corr(fd, channel, value1)) {
        fprintf(stderr, "Corr command execution error.\n");
        return 1;
      }
    } else if (!strcmp("freq", argv[i])) {
      if (argc < i + +5) {
        fprintf(stderr, "Too few arguments for freq command.\n");
        return 1;
      }
      value1 = atoi(argv[++i]);
      value2 = atoi(argv[++i]);
      value3 = atoi(argv[++i]);
      value4 = atoi(argv[++i]);
      if (set_freq(fd, channel, value1, value2, (short)value3, value4)) {
        fprintf(stderr, "Freq command execution error.\n");
        return 1;
      }
    } else if (!strcmp("out", argv[i])) {
      if (argc < i + 3) {
        fprintf(stderr, "Too few arguments for out command.\n");
        return 1;
      }
      value1 = atoi(argv[++i]);
      value2 = atoi(argv[++i]);
      if (set_output(fd, channel, value1, value2)) {
        fprintf(stderr, "Out command execution error.\n");
        return 1;
      }
    } else if (!strcmp("drive", argv[i])) {
      if (argc < i + 3) {
        fprintf(stderr, "Too few arguments for drive command.\n");
        return 1;
      }
      value1 = atoi(argv[++i]);
      value2 = atoi(argv[++i]);
      if (set_drive(fd, channel, value1, value2)) {
        fprintf(stderr, "Drive command execution error.\n");
        return 1;
      }
    } else if (!strcmp("load", argv[i])) {
      if (argc < i + 2) {
        fprintf(stderr, "Too few arguments for load command.\n");
        return 1;
      }
      value1 = atoi(argv[++i]);
      if (set_load(fd, channel, value1)) {
        fprintf(stderr, "Load command execution error.\n");
        return 1;
      }
    } else {
      fprintf(stderr, "Unknown command: %s\n", argv[i]);
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<set_dds_parameters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x3,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1613 <set_dds_parameters+0x493>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe45(%rip),%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1259 <set_dds_parameters+0xd9>
mov    -0xc(%rbp),%eax
mov    -0x20(%rbp),%ecx
add    $0x2,%ecx
cmp    %ecx,%eax
jge    11fd <set_dds_parameters+0x7d>
mov    0x2dff(%rip),%rax
mov    (%rax),%edi
lea    0xe1b(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    161a <set_dds_parameters+0x49a>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x20(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x24(%rbp),%edx
call   1030 <set_corr@plt>
cmp    $0x0,%rax
je     1254 <set_dds_parameters+0xd4>
mov    0x2da8(%rip),%rax
mov    (%rax),%edi
lea    0xde9(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    161a <set_dds_parameters+0x49a>
jmp    1600 <set_dds_parameters+0x480>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xddd(%rip),%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    136c <set_dds_parameters+0x1ec>
mov    -0xc(%rbp),%eax
mov    -0x20(%rbp),%ecx
add    $0x5,%ecx
cmp    %ecx,%eax
jge    12ae <set_dds_parameters+0x12e>
mov    0x2d4e(%rip),%rax
mov    (%rax),%edi
lea    0xdb3(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    161a <set_dds_parameters+0x49a>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x20(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x20(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x20(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x20(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x30(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
mov    -0x2c(%rbp),%eax
mov    -0x30(%rbp),%r9d
movswl %ax,%r8d
call   1040 <set_freq@plt>
cmp    $0x0,%rax
je     1367 <set_dds_parameters+0x1e7>
mov    0x2c95(%rip),%rax
mov    (%rax),%edi
lea    0xd1f(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    161a <set_dds_parameters+0x49a>
jmp    15fb <set_dds_parameters+0x47b>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xd13(%rip),%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    143c <set_dds_parameters+0x2bc>
mov    -0xc(%rbp),%eax
mov    -0x20(%rbp),%ecx
add    $0x3,%ecx
cmp    %ecx,%eax
jge    13c1 <set_dds_parameters+0x241>
mov    0x2c3b(%rip),%rax
mov    (%rax),%edi
lea    0xce8(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    161a <set_dds_parameters+0x49a>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x20(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x20(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x28(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
call   1070 <set_output@plt>
cmp    $0x0,%rax
je     1437 <set_dds_parameters+0x2b7>
mov    0x2bc5(%rip),%rax
mov    (%rax),%edi
lea    0xc96(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    161a <set_dds_parameters+0x49a>
jmp    15f6 <set_dds_parameters+0x476>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xc89(%rip),%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    150c <set_dds_parameters+0x38c>
mov    -0xc(%rbp),%eax
mov    -0x20(%rbp),%ecx
add    $0x3,%ecx
cmp    %ecx,%eax
jge    1491 <set_dds_parameters+0x311>
mov    0x2b6b(%rip),%rax
mov    (%rax),%edi
lea    0xc60(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    161a <set_dds_parameters+0x49a>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x20(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x20(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x28(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
call   1080 <set_drive@plt>
cmp    $0x0,%rax
je     1507 <set_dds_parameters+0x387>
mov    0x2af5(%rip),%rax
mov    (%rax),%edi
lea    0xc10(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    161a <set_dds_parameters+0x49a>
jmp    15f1 <set_dds_parameters+0x471>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xc05(%rip),%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    15bd <set_dds_parameters+0x43d>
mov    -0xc(%rbp),%eax
mov    -0x20(%rbp),%ecx
add    $0x2,%ecx
cmp    %ecx,%eax
jge    1561 <set_dds_parameters+0x3e1>
mov    0x2a9b(%rip),%rax
mov    (%rax),%edi
lea    0xbdb(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    161a <set_dds_parameters+0x49a>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x20(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x24(%rbp),%edx
call   10a0 <set_load@plt>
cmp    $0x0,%rax
je     15b8 <set_dds_parameters+0x438>
mov    0x2a44(%rip),%rax
mov    (%rax),%edi
lea    0xba9(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    161a <set_dds_parameters+0x49a>
jmp    15ec <set_dds_parameters+0x46c>
mov    0x2a1c(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xb94(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    161a <set_dds_parameters+0x49a>
jmp    15f1 <set_dds_parameters+0x471>
jmp    15f6 <set_dds_parameters+0x476>
jmp    15fb <set_dds_parameters+0x47b>
jmp    1600 <set_dds_parameters+0x480>
jmp    1605 <set_dds_parameters+0x485>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    119c <set_dds_parameters+0x1c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_dds_parameters>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,(%rsp)
xor    %eax,%eax
cmp    $0x4,%esi
jl     14c9 <set_dds_parameters+0x349>
mov    %rdx,%rbp
mov    %esi,%r15d
mov    %edi,%ebx
mov    $0x3,%r12d
mov    %esi,0x4(%rsp)
mov    %rdx,0x8(%rsp)
jmp    11d1 <set_dds_parameters+0x51>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%r12d
add    $0x1,%r12d
cmp    %r15d,%r12d
jge    13dc <set_dds_parameters+0x25c>
movslq %r12d,%r13
mov    0x0(%rbp,%r13,8),%r14
lea    0xe20(%rip),%rdi
mov    %r14,%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1290 <set_dds_parameters+0x110>
lea    0xe52(%rip),%rdi
mov    %r14,%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     12d0 <set_dds_parameters+0x150>
lea    0xe84(%rip),%rdi
mov    %r14,%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1349 <set_dds_parameters+0x1c9>
lea    0xeb3(%rip),%rdi
mov    %r14,%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     138c <set_dds_parameters+0x20c>
lea    0xee8(%rip),%rdi
mov    %r14,%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
jne    1437 <set_dds_parameters+0x2b7>
lea    0x2(%r12),%eax
cmp    %r15d,%eax
jg     1453 <set_dds_parameters+0x2d3>
mov    0x8(%rsp),%rbp
mov    0x8(%rbp,%r13,8),%rdi
call   1090 <atoi@plt>
mov    (%rsp),%edi
mov    %ebx,%esi
mov    %eax,%edx
call   10a0 <set_load@plt>
test   %rax,%rax
je     11c0 <set_dds_parameters+0x40>
jmp    1477 <set_dds_parameters+0x2f7>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0x2(%r12),%eax
cmp    %r15d,%eax
jg     13e3 <set_dds_parameters+0x263>
mov    0x8(%rsp),%rbp
mov    0x8(%rbp,%r13,8),%rdi
call   1090 <atoi@plt>
mov    (%rsp),%edi
mov    %ebx,%esi
mov    %eax,%edx
call   1030 <set_corr@plt>
test   %rax,%rax
je     11c0 <set_dds_parameters+0x40>
jmp    13f8 <set_dds_parameters+0x278>
nopw   0x0(%rax,%rax,1)
lea    0x5(%r12),%eax
cmp    %r15d,%eax
jg     140d <set_dds_parameters+0x28d>
mov    0x8(%rsp),%rbp
mov    0x8(%rbp,%r13,8),%rdi
call   1090 <atoi@plt>
mov    %eax,0x14(%rsp)
mov    0x10(%rbp,%r13,8),%rdi
call   1090 <atoi@plt>
mov    %eax,%r14d
mov    0x18(%rbp,%r13,8),%rdi
call   1090 <atoi@plt>
mov    %eax,%r15d
mov    0x20(%rbp,%r13,8),%rdi
call   1090 <atoi@plt>
movswl %r15w,%r8d
mov    (%rsp),%edi
mov    %ebx,%esi
mov    0x14(%rsp),%edx
mov    %r14d,%ecx
mov    %eax,%r9d
call   1040 <set_freq@plt>
test   %rax,%rax
jne    1422 <set_dds_parameters+0x2a2>
add    $0x4,%r12d
mov    0x4(%rsp),%r15d
mov    0x8(%rsp),%rbp
jmp    11c4 <set_dds_parameters+0x44>
lea    0x3(%r12),%eax
cmp    %r15d,%eax
jg     1465 <set_dds_parameters+0x2e5>
mov    0x8(%rsp),%rbp
mov    0x8(%rbp,%r13,8),%rdi
call   1090 <atoi@plt>
mov    %eax,%r14d
mov    0x10(%rbp,%r13,8),%rdi
call   1090 <atoi@plt>
mov    (%rsp),%edi
mov    %ebx,%esi
mov    %r14d,%edx
mov    %eax,%ecx
call   1070 <set_output@plt>
test   %rax,%rax
je     13ce <set_dds_parameters+0x24e>
jmp    1489 <set_dds_parameters+0x309>
lea    0x3(%r12),%eax
cmp    %r15d,%eax
jg     149b <set_dds_parameters+0x31b>
mov    0x8(%rsp),%rbp
mov    0x8(%rbp,%r13,8),%rdi
call   1090 <atoi@plt>
mov    %eax,%r14d
mov    0x10(%rbp,%r13,8),%rdi
call   1090 <atoi@plt>
mov    (%rsp),%edi
mov    %ebx,%esi
mov    %r14d,%edx
mov    %eax,%ecx
call   1080 <set_drive@plt>
test   %rax,%rax
jne    14ad <set_dds_parameters+0x32d>
add    $0x2,%r12d
mov    0x4(%rsp),%r15d
jmp    11c4 <set_dds_parameters+0x44>
xor    %eax,%eax
jmp    14c9 <set_dds_parameters+0x349>
mov    0x2bf6(%rip),%rax
mov    (%rax),%edi
lea    0xc12(%rip),%rsi
jmp    14bd <set_dds_parameters+0x33d>
mov    0x2be1(%rip),%rax
mov    (%rax),%edi
lea    0xc22(%rip),%rsi
jmp    14bd <set_dds_parameters+0x33d>
mov    0x2bcc(%rip),%rax
mov    (%rax),%edi
lea    0xc31(%rip),%rsi
jmp    14bd <set_dds_parameters+0x33d>
mov    0x2bb7(%rip),%rax
mov    (%rax),%edi
lea    0xc41(%rip),%rsi
jmp    14bd <set_dds_parameters+0x33d>
mov    0x2ba2(%rip),%rax
mov    (%rax),%edi
lea    0xd26(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    14c4 <set_dds_parameters+0x344>
mov    0x2b86(%rip),%rax
mov    (%rax),%edi
lea    0xcc6(%rip),%rsi
jmp    14bd <set_dds_parameters+0x33d>
mov    0x2b74(%rip),%rax
mov    (%rax),%edi
lea    0xc21(%rip),%rsi
jmp    14bd <set_dds_parameters+0x33d>
mov    0x2b62(%rip),%rax
mov    (%rax),%edi
lea    0xcc7(%rip),%rsi
jmp    14bd <set_dds_parameters+0x33d>
mov    0x2b50(%rip),%rax
mov    (%rax),%edi
lea    0xc21(%rip),%rsi
jmp    14bd <set_dds_parameters+0x33d>
mov    0x2b3e(%rip),%rax
mov    (%rax),%edi
lea    0xc33(%rip),%rsi
jmp    14bd <set_dds_parameters+0x33d>
mov    0x2b2c(%rip),%rax
mov    (%rax),%edi
lea    0xc47(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"corr\00"
@stderr = global i32 0
@.str.1 = [37 x i8] c"Too few arguments for corr command.\0A\00"
@.str.2 = [31 x i8] c"Corr command execution error.\0A\00"
@.str.3 = [5 x i8] c"freq\00"
@.str.4 = [37 x i8] c"Too few arguments for freq command.\0A\00"
@.str.5 = [31 x i8] c"Freq command execution error.\0A\00"
@.str.6 = [4 x i8] c"out\00"
@.str.7 = [36 x i8] c"Too few arguments for out command.\0A\00"
@.str.8 = [30 x i8] c"Out command execution error.\0A\00"
@.str.9 = [6 x i8] c"drive\00"
@.str.10 = [38 x i8] c"Too few arguments for drive command.\0A\00"
@.str.11 = [32 x i8] c"Drive command execution error.\0A\00"
@.str.12 = [5 x i8] c"load\00"
@.str.13 = [37 x i8] c"Too few arguments for load command.\0A\00"
@.str.14 = [31 x i8] c"Load command execution error.\0A\00"
@.str.15 = [21 x i8] c"Unknown command: %s\0A\00"
define i32 @set_dds_parameters(i32 %0, i32 %1, i8** %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8**
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i8** %2, i8*** %8
store i32 %3, i32* %9
store i32 3, i32* %10
br label %15
15: ; preds = %238, %4
%16 = load i32, i32* %10
%17 = load i32, i32* %7
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %241
19: ; preds = %15
%20 = load i8**, i8*** %8
%21 = load i32, i32* %10
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %20, i64 %22
%24 = load i8*, i8** %23
%25 = call i32 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %24)
%26 = icmp ne i32 %25, 0
br i1 %26, label %52, label %27
27: ; preds = %19
%28 = load i32, i32* %7
%29 = load i32, i32* %10
%30 = add nsw i32 %29, 2
%31 = icmp slt i32 %28, %30
br i1 %31, label %32, label %35
32: ; preds = %27
%33 = load i32, i32* @stderr
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %5
br label %242
35: ; preds = %27
%36 = load i8**, i8*** %8
%37 = load i32, i32* %10
%38 = add nsw i32 %37, 1
store i32 %38, i32* %10
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8*, i8** %36, i64 %39
%41 = load i8*, i8** %40
%42 = call i32 @atoi(i8* %41)
store i32 %42, i32* %11
%43 = load i32, i32* %9
%44 = load i32, i32* %6
%45 = load i32, i32* %11
%46 = call i64 @set_corr(i32 %43, i32 %44, i32 %45)
%47 = icmp ne i64 %46, 0
br i1 %47, label %48, label %51
48: ; preds = %35
%49 = load i32, i32* @stderr
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %5
br label %242
51: ; preds = %35
br label %237
52: ; preds = %19
%53 = load i8**, i8*** %8
%54 = load i32, i32* %10
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i8*, i8** %53, i64 %55
%57 = load i8*, i8** %56
%58 = call i32 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %57)
%59 = icmp ne i32 %58, 0
br i1 %59, label %110, label %60
60: ; preds = %52
%61 = load i32, i32* %7
%62 = load i32, i32* %10
%63 = add nsw i32 %62, 5
%64 = icmp slt i32 %61, %63
br i1 %64, label %65, label %68
65: ; preds = %60
%66 = load i32, i32* @stderr
%67 = call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %5
br label %242
68: ; preds = %60
%69 = load i8**, i8*** %8
%70 = load i32, i32* %10
%71 = add nsw i32 %70, 1
store i32 %71, i32* %10
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i8*, i8** %69, i64 %72
%74 = load i8*, i8** %73
%75 = call i32 @atoi(i8* %74)
store i32 %75, i32* %11
%76 = load i8**, i8*** %8
%77 = load i32, i32* %10
%78 = add nsw i32 %77, 1
store i32 %78, i32* %10
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i8*, i8** %76, i64 %79
%81 = load i8*, i8** %80
%82 = call i32 @atoi(i8* %81)
store i32 %82, i32* %12
%83 = load i8**, i8*** %8
%84 = load i32, i32* %10
%85 = add nsw i32 %84, 1
store i32 %85, i32* %10
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i8*, i8** %83, i64 %86
%88 = load i8*, i8** %87
%89 = call i32 @atoi(i8* %88)
store i32 %89, i32* %13
%90 = load i8**, i8*** %8
%91 = load i32, i32* %10
%92 = add nsw i32 %91, 1
store i32 %92, i32* %10
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds i8*, i8** %90, i64 %93
%95 = load i8*, i8** %94
%96 = call i32 @atoi(i8* %95)
store i32 %96, i32* %14
%97 = load i32, i32* %9
%98 = load i32, i32* %6
%99 = load i32, i32* %11
%100 = load i32, i32* %12
%101 = load i32, i32* %13
%102 = trunc i32 %101 to i16
%103 = load i32, i32* %14
%104 = call i64 @set_freq(i32 %97, i32 %98, i32 %99, i32 %100, i16 signext %102, i32 %103)
%105 = icmp ne i64 %104, 0
br i1 %105, label %106, label %109
106: ; preds = %68
%107 = load i32, i32* @stderr
%108 = call i32 (i32, i8*, ...) @fprintf(i32 %107, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %5
br label %242
109: ; preds = %68
br label %236
110: ; preds = %52
%111 = load i8**, i8*** %8
%112 = load i32, i32* %10
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds i8*, i8** %111, i64 %113
%115 = load i8*, i8** %114
%116 = call i32 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %115)
%117 = icmp ne i32 %116, 0
br i1 %117, label %151, label %118
118: ; preds = %110
%119 = load i32, i32* %7
%120 = load i32, i32* %10
%121 = add nsw i32 %120, 3
%122 = icmp slt i32 %119, %121
br i1 %122, label %123, label %126
123: ; preds = %118
%124 = load i32, i32* @stderr
%125 = call i32 (i32, i8*, ...) @fprintf(i32 %124, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %5
br label %242
126: ; preds = %118
%127 = load i8**, i8*** %8
%128 = load i32, i32* %10
%129 = add nsw i32 %128, 1
store i32 %129, i32* %10
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds i8*, i8** %127, i64 %130
%132 = load i8*, i8** %131
%133 = call i32 @atoi(i8* %132)
store i32 %133, i32* %11
%134 = load i8**, i8*** %8
%135 = load i32, i32* %10
%136 = add nsw i32 %135, 1
store i32 %136, i32* %10
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds i8*, i8** %134, i64 %137
%139 = load i8*, i8** %138
%140 = call i32 @atoi(i8* %139)
store i32 %140, i32* %12
%141 = load i32, i32* %9
%142 = load i32, i32* %6
%143 = load i32, i32* %11
%144 = load i32, i32* %12
%145 = call i64 @set_output(i32 %141, i32 %142, i32 %143, i32 %144)
%146 = icmp ne i64 %145, 0
br i1 %146, label %147, label %150
147: ; preds = %126
%148 = load i32, i32* @stderr
%149 = call i32 (i32, i8*, ...) @fprintf(i32 %148, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %5
br label %242
150: ; preds = %126
br label %235
151: ; preds = %110
%152 = load i8**, i8*** %8
%153 = load i32, i32* %10
%154 = sext i32 %153 to i64
%155 = getelementptr inbounds i8*, i8** %152, i64 %154
%156 = load i8*, i8** %155
%157 = call i32 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i8* %156)
%158 = icmp ne i32 %157, 0
br i1 %158, label %192, label %159
159: ; preds = %151
%160 = load i32, i32* %7
%161 = load i32, i32* %10
%162 = add nsw i32 %161, 3
%163 = icmp slt i32 %160, %162
br i1 %163, label %164, label %167
164: ; preds = %159
%165 = load i32, i32* @stderr
%166 = call i32 (i32, i8*, ...) @fprintf(i32 %165, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.10, i64 0, i64 0))
store i32 1, i32* %5
br label %242
167: ; preds = %159
%168 = load i8**, i8*** %8
%169 = load i32, i32* %10
%170 = add nsw i32 %169, 1
store i32 %170, i32* %10
%171 = sext i32 %170 to i64
%172 = getelementptr inbounds i8*, i8** %168, i64 %171
%173 = load i8*, i8** %172
%174 = call i32 @atoi(i8* %173)
store i32 %174, i32* %11
%175 = load i8**, i8*** %8
%176 = load i32, i32* %10
%177 = add nsw i32 %176, 1
store i32 %177, i32* %10
%178 = sext i32 %177 to i64
%179 = getelementptr inbounds i8*, i8** %175, i64 %178
%180 = load i8*, i8** %179
%181 = call i32 @atoi(i8* %180)
store i32 %181, i32* %12
%182 = load i32, i32* %9
%183 = load i32, i32* %6
%184 = load i32, i32* %11
%185 = load i32, i32* %12
%186 = call i64 @set_drive(i32 %182, i32 %183, i32 %184, i32 %185)
%187 = icmp ne i64 %186, 0
br i1 %187, label %188, label %191
188: ; preds = %167
%189 = load i32, i32* @stderr
%190 = call i32 (i32, i8*, ...) @fprintf(i32 %189, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.11, i64 0, i64 0))
store i32 1, i32* %5
br label %242
191: ; preds = %167
br label %234
192: ; preds = %151
%193 = load i8**, i8*** %8
%194 = load i32, i32* %10
%195 = sext i32 %194 to i64
%196 = getelementptr inbounds i8*, i8** %193, i64 %195
%197 = load i8*, i8** %196
%198 = call i32 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i8* %197)
%199 = icmp ne i32 %198, 0
br i1 %199, label %225, label %200
200: ; preds = %192
%201 = load i32, i32* %7
%202 = load i32, i32* %10
%203 = add nsw i32 %202, 2
%204 = icmp slt i32 %201, %203
br i1 %204, label %205, label %208
205: ; preds = %200
%206 = load i32, i32* @stderr
%207 = call i32 (i32, i8*, ...) @fprintf(i32 %206, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.13, i64 0, i64 0))
store i32 1, i32* %5
br label %242
208: ; preds = %200
%209 = load i8**, i8*** %8
%210 = load i32, i32* %10
%211 = add nsw i32 %210, 1
store i32 %211, i32* %10
%212 = sext i32 %211 to i64
%213 = getelementptr inbounds i8*, i8** %209, i64 %212
%214 = load i8*, i8** %213
%215 = call i32 @atoi(i8* %214)
store i32 %215, i32* %11
%216 = load i32, i32* %9
%217 = load i32, i32* %6
%218 = load i32, i32* %11
%219 = call i64 @set_load(i32 %216, i32 %217, i32 %218)
%220 = icmp ne i64 %219, 0
br i1 %220, label %221, label %224
221: ; preds = %208
%222 = load i32, i32* @stderr
%223 = call i32 (i32, i8*, ...) @fprintf(i32 %222, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.14, i64 0, i64 0))
store i32 1, i32* %5
br label %242
224: ; preds = %208
br label %233
225: ; preds = %192
%226 = load i32, i32* @stderr
%227 = load i8**, i8*** %8
%228 = load i32, i32* %10
%229 = sext i32 %228 to i64
%230 = getelementptr inbounds i8*, i8** %227, i64 %229
%231 = load i8*, i8** %230
%232 = call i32 (i32, i8*, ...) @fprintf(i32 %226, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0), i8* %231)
store i32 1, i32* %5
br label %242
233: ; preds = %224
br label %234
234: ; preds = %233, %191
br label %235
235: ; preds = %234, %150
br label %236
236: ; preds = %235, %109
br label %237
237: ; preds = %236, %51
br label %238
238: ; preds = %237
%239 = load i32, i32* %10
%240 = add nsw i32 %239, 1
store i32 %240, i32* %10
br label %15
241: ; preds = %15
store i32 0, i32* %5
br label %242
242: ; preds = %241, %225, %221, %205, %188, %164, %147, %123, %106, %65, %48, %32
%243 = load i32, i32* %5
ret i32 %243
}

LLVM IR (-O2):
@.str = [5 x i8] c"corr\00"
@stderr = global i32 0
@.str.1 = [37 x i8] c"Too few arguments for corr command.\0A\00"
@.str.2 = [31 x i8] c"Corr command execution error.\0A\00"
@.str.3 = [5 x i8] c"freq\00"
@.str.4 = [37 x i8] c"Too few arguments for freq command.\0A\00"
@.str.5 = [31 x i8] c"Freq command execution error.\0A\00"
@.str.6 = [4 x i8] c"out\00"
@.str.7 = [36 x i8] c"Too few arguments for out command.\0A\00"
@.str.8 = [30 x i8] c"Out command execution error.\0A\00"
@.str.9 = [6 x i8] c"drive\00"
@.str.10 = [38 x i8] c"Too few arguments for drive command.\0A\00"
@.str.11 = [32 x i8] c"Drive command execution error.\0A\00"
@.str.12 = [5 x i8] c"load\00"
@.str.13 = [37 x i8] c"Too few arguments for load command.\0A\00"
@.str.14 = [31 x i8] c"Load command execution error.\0A\00"
@.str.15 = [21 x i8] c"Unknown command: %s\0A\00"
define i32 @set_dds_parameters(i32 %0, i32 %1, i8** nocapture %2, i32 %3) {
%5 = icmp sgt i32 %1, 3
br i1 %5, label %6, label %143
6: ; preds = %4, %139
%7 = phi i32 [ %141, %139 ], [ 3, %4 ]
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8*, i8** %2, i64 %8
%10 = load i8*, i8** %9
%11 = tail call i32 @strcmp(i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* dereferenceable(1) %10)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %30
13: ; preds = %6
%14 = add nsw i32 %7, 2
%15 = icmp sgt i32 %14, %1
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = load i32, i32* @stderr
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
br label %143
19: ; preds = %13
%20 = add nsw i32 %7, 1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8*, i8** %2, i64 %21
%23 = load i8*, i8** %22
%24 = tail call i32 @atoi(i8* %23)
%25 = tail call i64 @set_corr(i32 %3, i32 %0, i32 %24)
%26 = icmp eq i64 %25, 0
br i1 %26, label %139, label %27
27: ; preds = %19
%28 = load i32, i32* @stderr
%29 = tail call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
br label %143
30: ; preds = %6
%31 = tail call i32 @strcmp(i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* dereferenceable(1) %10)
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %66
33: ; preds = %30
%34 = add nsw i32 %7, 5
%35 = icmp sgt i32 %34, %1
br i1 %35, label %36, label %39
36: ; preds = %33
%37 = load i32, i32* @stderr
%38 = tail call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0))
br label %143
39: ; preds = %33
%40 = add nsw i32 %7, 1
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8*, i8** %2, i64 %41
%43 = load i8*, i8** %42
%44 = tail call i32 @atoi(i8* %43)
%45 = add nsw i32 %7, 2
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8*, i8** %2, i64 %46
%48 = load i8*, i8** %47
%49 = tail call i32 @atoi(i8* %48)
%50 = add nsw i32 %7, 3
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8*, i8** %2, i64 %51
%53 = load i8*, i8** %52
%54 = tail call i32 @atoi(i8* %53)
%55 = add nsw i32 %7, 4
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i8*, i8** %2, i64 %56
%58 = load i8*, i8** %57
%59 = tail call i32 @atoi(i8* %58)
%60 = trunc i32 %54 to i16
%61 = tail call i64 @set_freq(i32 %3, i32 %0, i32 %44, i32 %49, i16 signext %60, i32 %59)
%62 = icmp eq i64 %61, 0
br i1 %62, label %139, label %63
63: ; preds = %39
%64 = load i32, i32* @stderr
%65 = tail call i32 (i32, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
br label %143
66: ; preds = %30
%67 = tail call i32 @strcmp(i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* dereferenceable(1) %10)
%68 = icmp eq i32 %67, 0
br i1 %68, label %69, label %91
69: ; preds = %66
%70 = add nsw i32 %7, 3
%71 = icmp sgt i32 %70, %1
br i1 %71, label %72, label %75
72: ; preds = %69
%73 = load i32, i32* @stderr
%74 = tail call i32 (i32, i8*, ...) @fprintf(i32 %73, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0))
br label %143
75: ; preds = %69
%76 = add nsw i32 %7, 1
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i8*, i8** %2, i64 %77
%79 = load i8*, i8** %78
%80 = tail call i32 @atoi(i8* %79)
%81 = add nsw i32 %7, 2
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i8*, i8** %2, i64 %82
%84 = load i8*, i8** %83
%85 = tail call i32 @atoi(i8* %84)
%86 = tail call i64 @set_output(i32 %3, i32 %0, i32 %80, i32 %85)
%87 = icmp eq i64 %86, 0
br i1 %87, label %139, label %88
88: ; preds = %75
%89 = load i32, i32* @stderr
%90 = tail call i32 (i32, i8*, ...) @fprintf(i32 %89, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0))
br label %143
91: ; preds = %66
%92 = tail call i32 @strcmp(i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i8* dereferenceable(1) %10)
%93 = icmp eq i32 %92, 0
br i1 %93, label %94, label %116
94: ; preds = %91
%95 = add nsw i32 %7, 3
%96 = icmp sgt i32 %95, %1
br i1 %96, label %97, label %100
97: ; preds = %94
%98 = load i32, i32* @stderr
%99 = tail call i32 (i32, i8*, ...) @fprintf(i32 %98, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.10, i64 0, i64 0))
br label %143
100: ; preds = %94
%101 = add nsw i32 %7, 1
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds i8*, i8** %2, i64 %102
%104 = load i8*, i8** %103
%105 = tail call i32 @atoi(i8* %104)
%106 = add nsw i32 %7, 2
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds i8*, i8** %2, i64 %107
%109 = load i8*, i8** %108
%110 = tail call i32 @atoi(i8* %109)
%111 = tail call i64 @set_drive(i32 %3, i32 %0, i32 %105, i32 %110)
%112 = icmp eq i64 %111, 0
br i1 %112, label %139, label %113
113: ; preds = %100
%114 = load i32, i32* @stderr
%115 = tail call i32 (i32, i8*, ...) @fprintf(i32 %114, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.11, i64 0, i64 0))
br label %143
116: ; preds = %91
%117 = tail call i32 @strcmp(i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i8* dereferenceable(1) %10)
%118 = icmp eq i32 %117, 0
br i1 %118, label %119, label %136
119: ; preds = %116
%120 = add nsw i32 %7, 2
%121 = icmp sgt i32 %120, %1
br i1 %121, label %122, label %125
122: ; preds = %119
%123 = load i32, i32* @stderr
%124 = tail call i32 (i32, i8*, ...) @fprintf(i32 %123, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.13, i64 0, i64 0))
br label %143
125: ; preds = %119
%126 = add nsw i32 %7, 1
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds i8*, i8** %2, i64 %127
%129 = load i8*, i8** %128
%130 = tail call i32 @atoi(i8* %129)
%131 = tail call i64 @set_load(i32 %3, i32 %0, i32 %130)
%132 = icmp eq i64 %131, 0
br i1 %132, label %139, label %133
133: ; preds = %125
%134 = load i32, i32* @stderr
%135 = tail call i32 (i32, i8*, ...) @fprintf(i32 %134, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.14, i64 0, i64 0))
br label %143
136: ; preds = %116
%137 = load i32, i32* @stderr
%138 = tail call i32 (i32, i8*, ...) @fprintf(i32 %137, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0), i8* %10)
br label %143
139: ; preds = %19, %75, %125, %100, %39
%140 = phi i32 [ %126, %125 ], [ %106, %100 ], [ %81, %75 ], [ %55, %39 ], [ %20, %19 ]
%141 = add nsw i32 %140, 1
%142 = icmp slt i32 %141, %1
br i1 %142, label %6, label %143
143: ; preds = %139, %4, %136, %133, %122, %113, %97, %88, %72, %63, %36, %27, %16
%144 = phi i32 [ 1, %136 ], [ 1, %122 ], [ 1, %133 ], [ 1, %97 ], [ 1, %113 ], [ 1, %72 ], [ 1, %88 ], [ 1, %36 ], [ 1, %63 ], [ 1, %16 ], [ 1, %27 ], [ 0, %4 ], [ 0, %139 ]
ret i32 %144
}