int main(int argc, char **argv) {
  if (argc < 2) {
    usage();
    return 0;
  }
  int cur;
  int max;
  int desired;
  int delta;
  cur = read_int(
      "/sys/devices/pci0000:00/0000:00:02.0/backlight/acpi_video0/brightness");
  max = read_int("/sys/devices/pci0000:00/0000:00:02.0/backlight/acpi_video0/"
                 "max_brightness");
  delta = max / 15;
  if (cur == -1 || max == -1)
    return 1;
  while (++argv, --argc) {
    if (**argv == '+')
      desired = cur + delta;
    else if (**argv == '-')
      desired = cur - delta;
    else {
      usage();
      return 1;
    }
  }
  if (desired > max)
    desired = max;
  else if (desired < 0)
    desired = 0;
  if (transition(cur, desired, (200 * 1000)) == -1)
    return 1;
  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)
cmpl   $0x2,-0x8(%rbp)
jge    1163 <main+0x33>
mov    $0x0,%al
call   1050 <usage@plt>
movl   $0x0,-0x4(%rbp)
jmp    1290 <main+0x160>
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1040 <read_int@plt>
mov    %eax,-0x14(%rbp)
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1040 <read_int@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    $0xf,%ecx
cltd
idiv   %ecx
mov    %eax,-0x20(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
je     11a7 <main+0x77>
cmpl   $0xffffffff,-0x18(%rbp)
jne    11b3 <main+0x83>
movl   $0x1,-0x4(%rbp)
jmp    1290 <main+0x160>
jmp    11b8 <main+0x88>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     1235 <main+0x105>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2b,%eax
jne    11f7 <main+0xc7>
mov    -0x14(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1230 <main+0x100>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1218 <main+0xe8>
mov    -0x14(%rbp),%eax
sub    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    122b <main+0xfb>
mov    $0x0,%al
call   1050 <usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    1290 <main+0x160>
jmp    1230 <main+0x100>
jmp    11b8 <main+0x88>
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    124c <main+0x11c>
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1262 <main+0x132>
cmpl   $0x0,-0x1c(%rbp)
jge    125d <main+0x12d>
movl   $0x0,-0x1c(%rbp)
jmp    1262 <main+0x132>
mov    -0x14(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    $0x30d40,%edx
mov    $0x0,%al
call   1030 <transition@plt>
cmp    $0xffffffff,%eax
jne    1289 <main+0x159>
movl   $0x1,-0x4(%rbp)
jmp    1290 <main+0x160>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
cmp    $0x1,%edi
jg     114c <main+0x1c>
xor    %r15d,%r15d
xor    %eax,%eax
call   1050 <usage@plt>
jmp    11fc <main+0xcc>
mov    %rsi,%rbp
mov    %edi,%r12d
lea    0xea7(%rip),%rdi
xor    %eax,%eax
call   1040 <read_int@plt>
mov    %eax,%r14d
lea    0xedc(%rip),%rdi
xor    %eax,%eax
call   1040 <read_int@plt>
mov    $0x1,%r15d
cmp    $0xffffffff,%r14d
je     11fc <main+0xcc>
cmp    $0xffffffff,%eax
je     11fc <main+0xcc>
movslq %eax,%rcx
imul   $0xffffffff88888889,%rcx,%rdx
shr    $0x20,%rdx
add    %edx,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x3,%ecx
add    %edx,%ecx
mov    %r14d,%r8d
sub    %ecx,%r8d
add    %r14d,%ecx
mov    %r12d,%esi
mov    $0x1,%edi
jmp    11b8 <main+0x88>
nop
add    $0x1,%rdi
cmp    %edi,%esi
je     11d4 <main+0xa4>
mov    0x0(%rbp,%rdi,8),%rdx
movzbl (%rdx),%ebx
mov    %ecx,%edx
cmp    $0x2b,%bl
je     11b0 <main+0x80>
mov    %r8d,%edx
cmp    $0x2d,%bl
je     11b0 <main+0x80>
jmp    1140 <main+0x10>
test   %edx,%edx
mov    $0x0,%esi
cmovns %edx,%esi
cmp    %eax,%edx
cmovg  %eax,%esi
mov    %r14d,%edi
mov    $0x30d40,%edx
xor    %eax,%eax
call   1030 <transition@plt>
xor    %r15d,%r15d
cmp    $0xffffffff,%eax
sete   %r15b
mov    %r15d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [70 x i8] c"/sys/devices/pci0000:00/0000:00:02.0/backlight/acpi_video0/brightness\00"
@.str.1 = [74 x i8] c"/sys/devices/pci0000:00/0000:00:02.0/backlight/acpi_video0/max_brightness\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 i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 2
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 (...) @usage()
store i32 0, i32* %3
br label %74
14: ; preds = %2
%15 = call i32 (i8*, ...) bitcast (i32 (...)* @read_int to i32 (i8*, ...)*)(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
store i32 %15, i32* %6
%16 = call i32 (i8*, ...) bitcast (i32 (...)* @read_int to i32 (i8*, ...)*)(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.1, i64 0, i64 0))
store i32 %16, i32* %7
%17 = load i32, i32* %7
%18 = sdiv i32 %17, 15
store i32 %18, i32* %9
%19 = load i32, i32* %6
%20 = icmp eq i32 %19, -1
br i1 %20, label %24, label %21
21: ; preds = %14
%22 = load i32, i32* %7
%23 = icmp eq i32 %22, -1
br i1 %23, label %24, label %25
24: ; preds = %21, %14
store i32 1, i32* %3
br label %74
25: ; preds = %21
br label %26
26: ; preds = %55, %25
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i32 1
store i8** %28, i8*** %5
%29 = load i32, i32* %4
%30 = add nsw i32 %29, -1
store i32 %30, i32* %4
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %56
32: ; preds = %26
%33 = load i8**, i8*** %5
%34 = load i8*, i8** %33
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 43
br i1 %37, label %38, label %42
38: ; preds = %32
%39 = load i32, i32* %6
%40 = load i32, i32* %9
%41 = add nsw i32 %39, %40
store i32 %41, i32* %8
br label %55
42: ; preds = %32
%43 = load i8**, i8*** %5
%44 = load i8*, i8** %43
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = icmp eq i32 %46, 45
br i1 %47, label %48, label %52
48: ; preds = %42
%49 = load i32, i32* %6
%50 = load i32, i32* %9
%51 = sub nsw i32 %49, %50
store i32 %51, i32* %8
br label %54
52: ; preds = %42
%53 = call i32 (...) @usage()
store i32 1, i32* %3
br label %74
54: ; preds = %48
br label %55
55: ; preds = %54, %38
br label %26
56: ; preds = %26
%57 = load i32, i32* %8
%58 = load i32, i32* %7
%59 = icmp sgt i32 %57, %58
br i1 %59, label %60, label %62
60: ; preds = %56
%61 = load i32, i32* %7
store i32 %61, i32* %8
br label %67
62: ; preds = %56
%63 = load i32, i32* %8
%64 = icmp slt i32 %63, 0
br i1 %64, label %65, label %66
65: ; preds = %62
store i32 0, i32* %8
br label %66
66: ; preds = %65, %62
br label %67
67: ; preds = %66, %60
%68 = load i32, i32* %6
%69 = load i32, i32* %8
%70 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @transition to i32 (i32, i32, i32, ...)*)(i32 %68, i32 %69, i32 200000)
%71 = icmp eq i32 %70, -1
br i1 %71, label %72, label %73
72: ; preds = %67
store i32 1, i32* %3
br label %74
73: ; preds = %67
store i32 0, i32* %3
br label %74
74: ; preds = %73, %72, %52, %24, %12
%75 = load i32, i32* %3
ret i32 %75
}

LLVM IR (-O2):
@.str = [70 x i8] c"/sys/devices/pci0000:00/0000:00:02.0/backlight/acpi_video0/brightness\00"
@.str.1 = [74 x i8] c"/sys/devices/pci0000:00/0000:00:02.0/backlight/acpi_video0/max_brightness\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @usage()
br label %38
6: ; preds = %2
%7 = tail call i32 (i8*, ...) bitcast (i32 (...)* @read_int to i32 (i8*, ...)*)(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) bitcast (i32 (...)* @read_int to i32 (i8*, ...)*)(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.1, i64 0, i64 0))
%9 = sdiv i32 %8, 15
%10 = icmp eq i32 %7, -1
%11 = icmp eq i32 %8, -1
%12 = select i1 %10, i1 true, i1 %11
br i1 %12, label %38, label %13
13: ; preds = %6
%14 = add nsw i32 %0, -1
%15 = sub nsw i32 %7, %9
%16 = add nsw i32 %9, %7
br label %17
17: ; preds = %13, %26
%18 = phi i32 [ %14, %13 ], [ %28, %26 ]
%19 = phi i8** [ %1, %13 ], [ %20, %26 ]
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = load i8, i8* %21
switch i8 %22, label %24 [
i8 43, label %26
i8 45, label %23
]
23: ; preds = %17
br label %26
24: ; preds = %17
%25 = tail call i32 (...) @usage()
br label %38
26: ; preds = %17, %23
%27 = phi i32 [ %15, %23 ], [ %16, %17 ]
%28 = add nsw i32 %18, -1
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %17
30: ; preds = %26
%31 = icmp sgt i32 %27, %8
%32 = icmp sgt i32 %27, 0
%33 = select i1 %32, i32 %27, i32 0
%34 = select i1 %31, i32 %8, i32 %33
%35 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @transition to i32 (i32, i32, i32, ...)*)(i32 %7, i32 %34, i32 200000)
%36 = icmp eq i32 %35, -1
%37 = zext i1 %36 to i32
br label %38
38: ; preds = %30, %24, %6, %4
%39 = phi i32 [ 0, %4 ], [ 1, %24 ], [ 1, %6 ], [ %37, %30 ]
ret i32 %39
}