#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_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ asprintf(char **, char *, char const *);
int chdir(char *);
int /*<<< orphan*/ err(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ millisleep(int);
int /*<<< orphan*/ printf(char *, char const *, int);
int read_val(char *);
scalar_t__ strcmp(char const *, char *);
int strtoul(char const *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ usage_exit(int /*<<< orphan*/, char const *);
int /*<<< orphan*/ validate_device(char const *);
int /*<<< orphan*/ write_val(char *, int);
int main(int argc, const char **argv) {
  char *cur_path;
  char *max_path;
  int cur_level;
  int max_level;
  int cur_perc;
  int new_perc;
  do {
    if (argc < 1 + 1)
      usage_exit(EXIT_FAILURE, argv[0]);
  } while (0);
  if (chdir("/sys/class") == -1)
    err(EXIT_FAILURE, "%s", "/sys/class");
  validate_device(argv[1]);
  do {
    if (argc < 2 + 1)
      usage_exit(EXIT_FAILURE, argv[0]);
  } while (0);
  asprintf(&cur_path, "%s/brightness", argv[1]);
  asprintf(&max_path, "%s/max_brightness", argv[1]);
  cur_level = read_val(cur_path);
  max_level = read_val(max_path);
  cur_perc = cur_level * 100 / max_level;
  if (strcmp(argv[2], "up") == 0) {
    new_perc = cur_perc + 10;
  } else if (strcmp(argv[2], "down") == 0) {
    new_perc = cur_perc - 10;
  } else if (strcmp(argv[2], "get") == 0) {
    printf("current level for %s: %d%%\n", argv[1], cur_perc);
    new_perc = cur_perc;
  } else if (strcmp(argv[2], "set") == 0) {
    do {
      if (argc < 3 + 1)
        usage_exit(EXIT_FAILURE, argv[0]);
    } while (0);
    new_perc = strtoul(argv[3], NULL, 0);
  } else {
    usage_exit(EXIT_FAILURE, argv[0]);
  }
  if (new_perc < 0)
    new_perc = 0;
  if (new_perc > 100)
    new_perc = 100;
  while (cur_perc != new_perc) {
    cur_perc += cur_perc < new_perc ? 1 : -1;
    write_val(cur_path, cur_perc * max_level / 100);
    millisleep(20);
  }
  free(max_path);
  free(cur_path);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11f5 <main+0x35>
mov    0x2df9(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   10d0 <usage_exit@plt>
jmp    11fa <main+0x3a>
lea    0xdff(%rip),%rdi
call   1040 <chdir@plt>
cmp    $0xffffffff,%eax
jne    122b <main+0x6b>
mov    0x2dca(%rip),%rax
mov    (%rax),%edi
lea    0xdec(%rip),%rsi
lea    0xdda(%rip),%rdx
call   1080 <err@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <validate_device@plt>
cmpl   $0x3,-0x8(%rbp)
jge    1257 <main+0x97>
mov    0x2d97(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   10d0 <usage_exit@plt>
jmp    125c <main+0x9c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    -0x18(%rbp),%rdi
lea    0xd9f(%rip),%rsi
call   10b0 <asprintf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    -0x20(%rbp),%rdi
lea    0xd95(%rip),%rsi
call   10b0 <asprintf@plt>
mov    -0x18(%rbp),%rdi
call   10a0 <read_val@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
call   10a0 <read_val@plt>
mov    %eax,-0x28(%rbp)
imul   $0x64,-0x24(%rbp),%eax
cltd
idivl  -0x28(%rbp)
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd70(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    12db <main+0x11b>
mov    -0x2c(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x30(%rbp)
jmp    13cd <main+0x20d>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd47(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1307 <main+0x147>
mov    -0x2c(%rbp),%eax
sub    $0xa,%eax
mov    %eax,-0x30(%rbp)
jmp    13c8 <main+0x208>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd20(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1347 <main+0x187>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x2c(%rbp),%edx
lea    0xd03(%rip),%rdi
call   1050 <printf@plt>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x30(%rbp)
jmp    13c3 <main+0x203>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd00(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    13a9 <main+0x1e9>
jmp    136a <main+0x1aa>
cmpl   $0x4,-0x8(%rbp)
jge    1389 <main+0x1c9>
mov    0x2c65(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   10d0 <usage_exit@plt>
jmp    138e <main+0x1ce>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10e0 <strtoul@plt>
mov    %eax,-0x30(%rbp)
jmp    13be <main+0x1fe>
mov    0x2c30(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   10d0 <usage_exit@plt>
jmp    13c3 <main+0x203>
jmp    13c8 <main+0x208>
jmp    13cd <main+0x20d>
cmpl   $0x0,-0x30(%rbp)
jge    13de <main+0x21e>
movl   $0x0,-0x30(%rbp)
cmpl   $0x64,-0x30(%rbp)
jle    13ef <main+0x22f>
movl   $0x64,-0x30(%rbp)
jmp    13f4 <main+0x234>
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
je     1444 <main+0x284>
mov    -0x2c(%rbp),%edx
mov    -0x30(%rbp),%esi
mov    $0xffffffff,%eax
mov    $0x1,%ecx
cmp    %esi,%edx
cmovl  %ecx,%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x2c(%rbp),%eax
imul   -0x28(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
call   10c0 <write_val@plt>
mov    $0x14,%edi
call   1060 <millisleep@plt>
jmp    13f4 <main+0x234>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    0x2b7b(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %edi,%r15d
cmp    $0x1,%edi
jg     11e8 <main+0x28>
mov    0x2e02(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rsi
call   10d0 <usage_exit@plt>
lea    0xe11(%rip),%rdi
call   1040 <chdir@plt>
cmp    $0xffffffff,%eax
jne    1215 <main+0x55>
mov    0x2de0(%rip),%rax
mov    (%rax),%edi
lea    0xe02(%rip),%rsi
lea    0xdf0(%rip),%rdx
call   1080 <err@plt>
mov    0x8(%r14),%rdi
call   1090 <validate_device@plt>
cmp    $0x2,%r15d
jg     1235 <main+0x75>
mov    0x2db5(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rsi
call   10d0 <usage_exit@plt>
mov    0x8(%r14),%rdx
lea    0xdce(%rip),%rsi
mov    %rsp,%rdi
call   10b0 <asprintf@plt>
mov    0x8(%r14),%rdx
lea    0xdc9(%rip),%rsi
lea    0x8(%rsp),%rdi
call   10b0 <asprintf@plt>
mov    (%rsp),%rdi
call   10a0 <read_val@plt>
mov    %eax,%ebx
mov    0x8(%rsp),%rdi
call   10a0 <read_val@plt>
mov    %eax,%r12d
imul   $0x64,%ebx,%eax
cltd
idiv   %r12d
mov    %eax,%ebx
mov    0x10(%r14),%rdi
lea    0xda5(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     12e5 <main+0x125>
mov    0x10(%r14),%rdi
lea    0xd93(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     12ea <main+0x12a>
mov    0x10(%r14),%rdi
lea    0xd83(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     12ef <main+0x12f>
mov    0x10(%r14),%rdi
lea    0xd8e(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1305 <main+0x145>
mov    0x2d07(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rsi
call   10d0 <usage_exit@plt>
jmp    1329 <main+0x169>
lea    0xa(%rbx),%eax
jmp    1329 <main+0x169>
lea    -0xa(%rbx),%eax
jmp    1329 <main+0x169>
mov    0x8(%r14),%rsi
lea    0xd40(%rip),%rdi
mov    %ebx,%edx
call   1050 <printf@plt>
mov    %ebx,%eax
jmp    1329 <main+0x169>
cmp    $0x3,%r15d
jg     131c <main+0x15c>
mov    0x2cce(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rsi
call   10d0 <usage_exit@plt>
mov    0x18(%r14),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   10e0 <strtoul@plt>
xor    %ecx,%ecx
test   %eax,%eax
cmovns %eax,%ecx
cmp    $0x64,%ecx
mov    $0x64,%ebp
cmovb  %ecx,%ebp
cmp    %ebp,%ebx
je     1380 <main+0x1c0>
nop
xor    %eax,%eax
cmp    %ebp,%ebx
setl   %al
lea    (%rbx,%rax,2),%ebx
add    $0xffffffff,%ebx
mov    (%rsp),%rdi
mov    %ebx,%eax
imul   %r12d,%eax
cltq
imul   $0x51eb851f,%rax,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x25,%rsi
add    %eax,%esi
call   10c0 <write_val@plt>
mov    $0x14,%edi
call   1060 <millisleep@plt>
cmp    %ebp,%ebx
jne    1340 <main+0x180>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
mov    0x2c3e(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@.str = [11 x i8] c"/sys/class\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [14 x i8] c"%s/brightness\00"
@.str.3 = [18 x i8] c"%s/max_brightness\00"
@.str.4 = [3 x i8] c"up\00"
@.str.5 = [5 x i8] c"down\00"
@.str.6 = [4 x i8] c"get\00"
@.str.7 = [28 x i8] c"current level for %s: %d%%\0A\00"
@.str.8 = [4 x i8] c"set\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %12
12: ; preds = %2
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 2
br i1 %14, label %15, label %21
15: ; preds = %12
%16 = load i32, i32* @EXIT_FAILURE
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 @usage_exit(i32 %16, i8* %19)
br label %21
21: ; preds = %15, %12
br label %22
22: ; preds = %21
%23 = call i32 @chdir(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%24 = icmp eq i32 %23, -1
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = load i32, i32* @EXIT_FAILURE
%27 = call i32 @err(i32 %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %28
28: ; preds = %25, %22
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i32 @validate_device(i8* %31)
br label %33
33: ; preds = %28
%34 = load i32, i32* %4
%35 = icmp slt i32 %34, 3
br i1 %35, label %36, label %42
36: ; preds = %33
%37 = load i32, i32* @EXIT_FAILURE
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 0
%40 = load i8*, i8** %39
%41 = call i32 @usage_exit(i32 %37, i8* %40)
br label %42
42: ; preds = %36, %33
br label %43
43: ; preds = %42
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 1
%46 = load i8*, i8** %45
%47 = call i32 @asprintf(i8** %6, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %46)
%48 = load i8**, i8*** %5
%49 = getelementptr inbounds i8*, i8** %48, i64 1
%50 = load i8*, i8** %49
%51 = call i32 @asprintf(i8** %7, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %50)
%52 = load i8*, i8** %6
%53 = call i32 @read_val(i8* %52)
store i32 %53, i32* %8
%54 = load i8*, i8** %7
%55 = call i32 @read_val(i8* %54)
store i32 %55, i32* %9
%56 = load i32, i32* %8
%57 = mul nsw i32 %56, 100
%58 = load i32, i32* %9
%59 = sdiv i32 %57, %58
store i32 %59, i32* %10
%60 = load i8**, i8*** %5
%61 = getelementptr inbounds i8*, i8** %60, i64 2
%62 = load i8*, i8** %61
%63 = call i64 @strcmp(i8* %62, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%64 = icmp eq i64 %63, 0
br i1 %64, label %65, label %68
65: ; preds = %43
%66 = load i32, i32* %10
%67 = add nsw i32 %66, 10
store i32 %67, i32* %11
br label %121
68: ; preds = %43
%69 = load i8**, i8*** %5
%70 = getelementptr inbounds i8*, i8** %69, i64 2
%71 = load i8*, i8** %70
%72 = call i64 @strcmp(i8* %71, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%73 = icmp eq i64 %72, 0
br i1 %73, label %74, label %77
74: ; preds = %68
%75 = load i32, i32* %10
%76 = sub nsw i32 %75, 10
store i32 %76, i32* %11
br label %120
77: ; preds = %68
%78 = load i8**, i8*** %5
%79 = getelementptr inbounds i8*, i8** %78, i64 2
%80 = load i8*, i8** %79
%81 = call i64 @strcmp(i8* %80, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%82 = icmp eq i64 %81, 0
br i1 %82, label %83, label %90
83: ; preds = %77
%84 = load i8**, i8*** %5
%85 = getelementptr inbounds i8*, i8** %84, i64 1
%86 = load i8*, i8** %85
%87 = load i32, i32* %10
%88 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i8* %86, i32 %87)
%89 = load i32, i32* %10
store i32 %89, i32* %11
br label %119
90: ; preds = %77
%91 = load i8**, i8*** %5
%92 = getelementptr inbounds i8*, i8** %91, i64 2
%93 = load i8*, i8** %92
%94 = call i64 @strcmp(i8* %93, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%95 = icmp eq i64 %94, 0
br i1 %95, label %96, label %112
96: ; preds = %90
br label %97
97: ; preds = %96
%98 = load i32, i32* %4
%99 = icmp slt i32 %98, 4
br i1 %99, label %100, label %106
100: ; preds = %97
%101 = load i32, i32* @EXIT_FAILURE
%102 = load i8**, i8*** %5
%103 = getelementptr inbounds i8*, i8** %102, i64 0
%104 = load i8*, i8** %103
%105 = call i32 @usage_exit(i32 %101, i8* %104)
br label %106
106: ; preds = %100, %97
br label %107
107: ; preds = %106
%108 = load i8**, i8*** %5
%109 = getelementptr inbounds i8*, i8** %108, i64 3
%110 = load i8*, i8** %109
%111 = call i32 @strtoul(i8* %110, i32* null, i32 0)
store i32 %111, i32* %11
br label %118
112: ; preds = %90
%113 = load i32, i32* @EXIT_FAILURE
%114 = load i8**, i8*** %5
%115 = getelementptr inbounds i8*, i8** %114, i64 0
%116 = load i8*, i8** %115
%117 = call i32 @usage_exit(i32 %113, i8* %116)
br label %118
118: ; preds = %112, %107
br label %119
119: ; preds = %118, %83
br label %120
120: ; preds = %119, %74
br label %121
121: ; preds = %120, %65
%122 = load i32, i32* %11
%123 = icmp slt i32 %122, 0
br i1 %123, label %124, label %125
124: ; preds = %121
store i32 0, i32* %11
br label %125
125: ; preds = %124, %121
%126 = load i32, i32* %11
%127 = icmp sgt i32 %126, 100
br i1 %127, label %128, label %129
128: ; preds = %125
store i32 100, i32* %11
br label %129
129: ; preds = %128, %125
br label %130
130: ; preds = %134, %129
%131 = load i32, i32* %10
%132 = load i32, i32* %11
%133 = icmp ne i32 %131, %132
br i1 %133, label %134, label %149
134: ; preds = %130
%135 = load i32, i32* %10
%136 = load i32, i32* %11
%137 = icmp slt i32 %135, %136
%138 = zext i1 %137 to i64
%139 = select i1 %137, i32 1, i32 -1
%140 = load i32, i32* %10
%141 = add nsw i32 %140, %139
store i32 %141, i32* %10
%142 = load i8*, i8** %6
%143 = load i32, i32* %10
%144 = load i32, i32* %9
%145 = mul nsw i32 %143, %144
%146 = sdiv i32 %145, 100
%147 = call i32 @write_val(i8* %142, i32 %146)
%148 = call i32 @millisleep(i32 20)
br label %130
149: ; preds = %130
%150 = load i8*, i8** %7
%151 = call i32 @free(i8* %150)
%152 = load i8*, i8** %6
%153 = call i32 @free(i8* %152)
%154 = load i32, i32* @EXIT_SUCCESS
ret i32 %154
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str = [11 x i8] c"/sys/class\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [14 x i8] c"%s/brightness\00"
@.str.3 = [18 x i8] c"%s/max_brightness\00"
@.str.4 = [3 x i8] c"up\00"
@.str.5 = [5 x i8] c"down\00"
@.str.6 = [4 x i8] c"get\00"
@.str.7 = [28 x i8] c"current level for %s: %d%%\0A\00"
@.str.8 = [4 x i8] c"set\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = bitcast i8** %3 to i8*
%6 = bitcast i8** %4 to i8*
%7 = icmp slt i32 %0, 2
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i32, i32* @EXIT_FAILURE
%10 = load i8*, i8** %1
%11 = tail call i32 @usage_exit(i32 %9, i8* %10)
br label %12
12: ; preds = %8, %2
%13 = tail call i32 @chdir(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load i32, i32* @EXIT_FAILURE
%17 = tail call i32 @err(i32 %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %15, %12
%19 = getelementptr inbounds i8*, i8** %1, i64 1
%20 = load i8*, i8** %19
%21 = tail call i32 @validate_device(i8* %20)
%22 = icmp slt i32 %0, 3
br i1 %22, label %23, label %27
23: ; preds = %18
%24 = load i32, i32* @EXIT_FAILURE
%25 = load i8*, i8** %1
%26 = tail call i32 @usage_exit(i32 %24, i8* %25)
br label %27
27: ; preds = %23, %18
%28 = load i8*, i8** %19
%29 = call i32 @asprintf(i8** %3, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %28)
%30 = load i8*, i8** %19
%31 = call i32 @asprintf(i8** %4, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %30)
%32 = load i8*, i8** %3
%33 = call i32 @read_val(i8* %32)
%34 = load i8*, i8** %4
%35 = call i32 @read_val(i8* %34)
%36 = mul nsw i32 %33, 100
%37 = sdiv i32 %36, %35
%38 = getelementptr inbounds i8*, i8** %1, i64 2
%39 = load i8*, i8** %38
%40 = call i64 @strcmp(i8* %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %27
%43 = add nsw i32 %37, 10
br label %75
44: ; preds = %27
%45 = load i8*, i8** %38
%46 = call i64 @strcmp(i8* %45, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %44
%49 = add nsw i32 %37, -10
br label %75
50: ; preds = %44
%51 = load i8*, i8** %38
%52 = call i64 @strcmp(i8* %51, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %57
54: ; preds = %50
%55 = load i8*, i8** %19
%56 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i8* %55, i32 %37)
br label %75
57: ; preds = %50
%58 = load i8*, i8** %38
%59 = call i64 @strcmp(i8* %58, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%60 = icmp eq i64 %59, 0
br i1 %60, label %61, label %71
61: ; preds = %57
%62 = icmp slt i32 %0, 4
br i1 %62, label %63, label %67
63: ; preds = %61
%64 = load i32, i32* @EXIT_FAILURE
%65 = load i8*, i8** %1
%66 = call i32 @usage_exit(i32 %64, i8* %65)
br label %67
67: ; preds = %63, %61
%68 = getelementptr inbounds i8*, i8** %1, i64 3
%69 = load i8*, i8** %68
%70 = call i32 @strtoul(i8* nocapture %69, i32* null, i32 0)
br label %75
71: ; preds = %57
%72 = load i32, i32* @EXIT_FAILURE
%73 = load i8*, i8** %1
%74 = call i32 @usage_exit(i32 %72, i8* %73)
br label %75
75: ; preds = %48, %67, %71, %54, %42
%76 = phi i32 [ %43, %42 ], [ %49, %48 ], [ %37, %54 ], [ %70, %67 ], [ undef, %71 ]
%77 = icmp sgt i32 %76, 0
%78 = select i1 %77, i32 %76, i32 0
%79 = icmp ult i32 %78, 100
%80 = select i1 %79, i32 %78, i32 100
%81 = icmp eq i32 %37, %80
br i1 %81, label %93, label %82
82: ; preds = %75, %82
%83 = phi i32 [ %86, %82 ], [ %37, %75 ]
%84 = icmp slt i32 %83, %80
%85 = select i1 %84, i32 1, i32 -1
%86 = add nsw i32 %85, %83
%87 = load i8*, i8** %3
%88 = mul nsw i32 %86, %35
%89 = sdiv i32 %88, 100
%90 = call i32 @write_val(i8* %87, i32 %89)
%91 = call i32 @millisleep(i32 20)
%92 = icmp eq i32 %86, %80
br i1 %92, label %93, label %82
93: ; preds = %82, %75
%94 = load i8*, i8** %4
%95 = call i32 @free(i8* %94)
%96 = load i8*, i8** %3
%97 = call i32 @free(i8* %96)
%98 = load i32, i32* @EXIT_SUCCESS
ret i32 %98
}