main(argc, argv) int argc;
char **argv;
{
  int i;
  while (--argc)
    writeout(atoi(*(++argv)));
  printf("starting!!!\n");
  for (i = 0x0ff; i >= 255 || i <= 0; i += 0x0ff) {
    if ((i & 0x0ffff) == 0x0ffff)
      printf("ok < %x\n", i);
    writeout(i);
  }
  printf("finished!!!\n");
}


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    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     1180 <main+0x50>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
mov    $0x0,%al
call   1050 <atoi@plt>
mov    %eax,%edi
mov    $0x0,%al
call   1030 <writeout@plt>
jmp    1146 <main+0x16>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xff,-0x14(%rbp)
mov    $0x1,%al
cmpl   $0xff,-0x14(%rbp)
mov    %al,-0x15(%rbp)
jge    11b1 <main+0x81>
cmpl   $0x0,-0x14(%rbp)
setle  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    11c1 <main+0x91>
jmp    11ff <main+0xcf>
mov    -0x14(%rbp),%eax
and    $0xffff,%eax
cmp    $0xffff,%eax
jne    11e5 <main+0xb5>
mov    -0x14(%rbp),%esi
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
mov    $0x0,%al
call   1030 <writeout@plt>
mov    -0x14(%rbp),%eax
add    $0xff,%eax
mov    %eax,-0x14(%rbp)
jmp    1195 <main+0x65>
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
cmp    $0x1,%edi
je     117d <main+0x3d>
mov    %rsi,%r14
mov    %edi,%r15d
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r14,%rbx,8),%rdi
xor    %eax,%eax
call   1060 <atoi@plt>
mov    %eax,%edi
xor    %eax,%eax
call   1040 <writeout@plt>
add    $0x1,%rbx
cmp    %ebx,%r15d
jne    1160 <main+0x20>
lea    0xe85(%rip),%rdi
call   1030 <puts@plt>
mov    $0xff,%ebx
lea    0xe6b(%rip),%r14
jmp    11af <main+0x6f>
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
xor    %eax,%eax
call   1040 <writeout@plt>
add    $0xff,%ebx
cmp    $0xffff,%bx
jne    11a0 <main+0x60>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11a0 <main+0x60>

LLVM IR (-O0):
@.str = [13 x i8] c"starting!!!\0A\00"
@.str.1 = [9 x i8] c"ok < %x\0A\00"
@.str.2 = [13 x i8] c"finished!!!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %7
7: ; preds = %11, %2
%8 = load i32, i32* %4
%9 = add nsw i32 %8, -1
store i32 %9, i32* %4
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %7
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i32 1
store i8** %13, i8*** %5
%14 = load i8*, i8** %13
%15 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %14)
%16 = call i32 (i32, ...) bitcast (i32 (...)* @writeout to i32 (i32, ...)*)(i32 %15)
br label %7
17: ; preds = %7
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store i32 255, i32* %6
br label %19
19: ; preds = %37, %17
%20 = load i32, i32* %6
%21 = icmp sge i32 %20, 255
br i1 %21, label %25, label %22
22: ; preds = %19
%23 = load i32, i32* %6
%24 = icmp sle i32 %23, 0
br label %25
25: ; preds = %22, %19
%26 = phi i1 [ true, %19 ], [ %24, %22 ]
br i1 %26, label %27, label %40
27: ; preds = %25
%28 = load i32, i32* %6
%29 = and i32 %28, 65535
%30 = icmp eq i32 %29, 65535
br i1 %30, label %31, label %34
31: ; preds = %27
%32 = load i32, i32* %6
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %31, %27
%35 = load i32, i32* %6
%36 = call i32 (i32, ...) bitcast (i32 (...)* @writeout to i32 (i32, ...)*)(i32 %35)
br label %37
37: ; preds = %34
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 255
store i32 %39, i32* %6
br label %19
40: ; preds = %25
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%42 = load i32, i32* %3
ret i32 %42
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"ok < %x\0A\00"
@str = [12 x i8] c"starting!!!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = add nsw i32 %0, -1
%4 = icmp eq i32 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %2, %5
%6 = phi i32 [ %12, %5 ], [ %3, %2 ]
%7 = phi i8** [ %8, %5 ], [ %1, %2 ]
%8 = getelementptr inbounds i8*, i8** %7, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %9)
%11 = tail call i32 (i32, ...) bitcast (i32 (...)* @writeout to i32 (i32, ...)*)(i32 %10)
%12 = add nsw i32 %6, -1
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %5
14: ; preds = %5, %2
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
br label %16
16: ; preds = %22, %14
%17 = phi i32 [ 255, %14 ], [ %24, %22 ]
%18 = and i32 %17, 65535
%19 = icmp eq i32 %18, 65535
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %17)
br label %22
22: ; preds = %20, %16
%23 = tail call i32 (i32, ...) bitcast (i32 (...)* @writeout to i32 (i32, ...)*)(i32 %17)
%24 = add nuw nsw i32 %17, 255
br label %16
}