int main(argc, argv)
char *argv[];
{
  int n;
  if (argc >= 2) {
    sscanf(argv[1], "%d", &n);
    if (n > 0)
      printfactors(n);
  } else {
    while (scanf("%d", &n) == 1)
      if (n > 0)
        printfactors(n);
  }
  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)
jl     1183 <main+0x53>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xea1(%rip),%rsi
lea    -0x14(%rbp),%rdx
mov    $0x0,%al
call   1030 <sscanf@plt>
cmpl   $0x0,-0x14(%rbp)
jle    117e <main+0x4e>
mov    -0x14(%rbp),%edi
mov    $0x0,%al
call   1050 <printfactors@plt>
jmp    11c1 <main+0x91>
jmp    1188 <main+0x58>
lea    0xe71(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    11bc <main+0x8c>
cmpl   $0x0,-0x14(%rbp)
jle    11b7 <main+0x87>
mov    -0x14(%rbp),%edi
mov    $0x0,%al
call   1050 <printfactors@plt>
jmp    1188 <main+0x58>
jmp    11c1 <main+0x91>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x1,%edi
jle    1161 <main+0x31>
mov    0x8(%rsi),%rdi
lea    0xebc(%rip),%rsi
lea    0x4(%rsp),%rdx
xor    %eax,%eax
call   1030 <sscanf@plt>
mov    0x4(%rsp),%edi
test   %edi,%edi
jle    11b3 <main+0x83>
xor    %eax,%eax
call   1050 <printfactors@plt>
jmp    11b3 <main+0x83>
lea    0xe98(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    11b3 <main+0x83>
lea    0xe80(%rip),%r14
lea    0x4(%rsp),%rbx
jmp    11a2 <main+0x72>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    11b3 <main+0x83>
mov    0x4(%rsp),%edi
test   %edi,%edi
jle    1190 <main+0x60>
xor    %eax,%eax
call   1050 <printfactors@plt>
jmp    1190 <main+0x60>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\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
%7 = load i32, i32* %4
%8 = icmp sge i32 %7, 2
br i1 %8, label %9, label %20
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 (i8*, i8*, ...) @sscanf(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%14 = load i32, i32* %6
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %9
%17 = load i32, i32* %6
%18 = call i32 (i32, ...) bitcast (i32 (...)* @printfactors to i32 (i32, ...)*)(i32 %17)
br label %19
19: ; preds = %16, %9
br label %32
20: ; preds = %2
br label %21
21: ; preds = %30, %20
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%23 = icmp eq i32 %22, 1
br i1 %23, label %24, label %31
24: ; preds = %21
%25 = load i32, i32* %6
%26 = icmp sgt i32 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = load i32, i32* %6
%29 = call i32 (i32, ...) bitcast (i32 (...)* @printfactors to i32 (i32, ...)*)(i32 %28)
br label %30
30: ; preds = %27, %24
br label %21
31: ; preds = %21
br label %32
32: ; preds = %31, %19
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = icmp sgt i32 %0, 1
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%8 = icmp eq i32 %7, 1
br i1 %8, label %17, label %25
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = call i32 (i8*, i8*, ...) @sscanf(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%13 = load i32, i32* %3
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %25
15: ; preds = %9
%16 = call i32 (i32, ...) bitcast (i32 (...)* @printfactors to i32 (i32, ...)*)(i32 %13)
br label %25
17: ; preds = %6, %22
%18 = load i32, i32* %3
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 (i32, ...) bitcast (i32 (...)* @printfactors to i32 (i32, ...)*)(i32 %18)
br label %22
22: ; preds = %20, %17
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%24 = icmp eq i32 %23, 1
br i1 %24, label %17, label %25
25: ; preds = %22, %6, %9, %15
ret i32 0
}