#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 atol(char *);
int ncmp(char *, char *, int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  char *s = argc >= 2 ? argv[1] : argv[0];
  char *t = argc >= 3 ? argv[2] : argv[0];
  int n = argc >= 4 ? atol(argv[3]) : 5;
  printf("%d\n", ncmp(s, t, n));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     1161 <main+0x31>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x30(%rbp)
jmp    116c <main+0x3c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x3,-0x8(%rbp)
jl     118f <main+0x5f>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x38(%rbp)
jmp    119a <main+0x6a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x4,-0x8(%rbp)
jl     11c1 <main+0x91>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1050 <atol@plt>
mov    %eax,-0x3c(%rbp)
jmp    11ce <main+0x9e>
mov    $0x5,%eax
mov    %eax,-0x3c(%rbp)
jmp    11ce <main+0x9e>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1040 <ncmp@plt>
mov    %eax,%esi
lea    0xe13(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
xor    %ecx,%ecx
cmp    $0x2,%edi
setge  %al
mov    (%rsi,%rax,8),%r14
setg   %cl
shl    $0x4,%rcx
mov    (%rsi,%rcx,1),%rbx
mov    $0x5,%edx
cmp    $0x4,%edi
jl     1162 <main+0x32>
mov    0x18(%rsi),%rdi
call   1050 <atol@plt>
mov    %eax,%edx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <ncmp@plt>
lea    0xe8c(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp sge i32 %9, 2
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
br label %19
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
br label %19
19: ; preds = %15, %11
%20 = phi i8* [ %14, %11 ], [ %18, %15 ]
store i8* %20, i8** %6
%21 = load i32, i32* %4
%22 = icmp sge i32 %21, 3
br i1 %22, label %23, label %27
23: ; preds = %19
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 2
%26 = load i8*, i8** %25
br label %31
27: ; preds = %19
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 0
%30 = load i8*, i8** %29
br label %31
31: ; preds = %27, %23
%32 = phi i8* [ %26, %23 ], [ %30, %27 ]
store i8* %32, i8** %7
%33 = load i32, i32* %4
%34 = icmp sge i32 %33, 4
br i1 %34, label %35, label %40
35: ; preds = %31
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 3
%38 = load i8*, i8** %37
%39 = call i32 @atol(i8* %38)
br label %41
40: ; preds = %31
br label %41
41: ; preds = %40, %35
%42 = phi i32 [ %39, %35 ], [ 5, %40 ]
store i32 %42, i32* %8
%43 = load i8*, i8** %6
%44 = load i8*, i8** %7
%45 = load i32, i32* %8
%46 = call i32 @ncmp(i8* %43, i8* %44, i32 %45)
%47 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %46)
%48 = load i32, i32* %3
ret i32 %48
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
%4 = zext i1 %3 to i64
%5 = getelementptr i8*, i8** %1, i64 %4
%6 = load i8*, i8** %5
%7 = icmp sgt i32 %0, 2
%8 = select i1 %7, i64 2, i64 0
%9 = getelementptr i8*, i8** %1, i64 %8
%10 = load i8*, i8** %9
%11 = icmp sgt i32 %0, 3
br i1 %11, label %12, label %16
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 3
%14 = load i8*, i8** %13
%15 = tail call i32 @atol(i8* %14)
br label %16
16: ; preds = %2, %12
%17 = phi i32 [ %15, %12 ], [ 5, %2 ]
%18 = tail call i32 @ncmp(i8* %6, i8* %10, i32 %17)
%19 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
ret i32 0
}