#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*/ errx(int, char *);
int /*<<< orphan*/ printf(char *, char *);
unsigned long strtol(char *, int /*<<< orphan*/, int);
int main(int argc, char *argv[]) {
  unsigned long num;
  if (argc < 3)
    errx(2, "usage: num string");
  num = strtol(argv[1], 0, 10);
  if (!num)
    errx(2, "num must be numeric");
  for (;;) {
    if (!num)
      break;
    printf("%s\n", argv[2]);
    --num;
  }
  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   $0x3,-0x8(%rbp)
jge    1161 <main+0x31>
mov    $0x2,%edi
lea    0xea4(%rip),%rsi
call   1030 <errx@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1195 <main+0x65>
mov    $0x2,%edi
lea    0xe82(%rip),%rsi
call   1030 <errx@plt>
jmp    119a <main+0x6a>
cmpq   $0x0,-0x18(%rbp)
jne    11aa <main+0x7a>
jmp    11cf <main+0x9f>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xe6d(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
jmp    119a <main+0x6a>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
cmp    $0x2,%edi
jg     114e <main+0x1e>
lea    0xebc(%rip),%rsi
mov    $0x2,%edi
call   1030 <errx@plt>
mov    0x8(%r14),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
test   %rax,%rax
je     1184 <main+0x54>
mov    %rax,%rbx
lea    0xeb9(%rip),%r15
nopl   (%rax)
mov    0x10(%r14),%rsi
mov    %r15,%rdi
call   1040 <printf@plt>
add    $0xffffffffffffffff,%rbx
jne    1170 <main+0x40>
jmp    1195 <main+0x65>
lea    0xe87(%rip),%rsi
mov    $0x2,%edi
call   1030 <errx@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [18 x i8] c"usage: num string\00"
@.str.1 = [20 x i8] c"num must be numeric\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 3
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @errx(i32 2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i64 @strtol(i8* %14, i32 0, i32 10)
store i64 %15, i64* %6
%16 = load i64, i64* %6
%17 = icmp ne i64 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %11
%19 = call i32 @errx(i32 2, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %18, %11
br label %21
21: ; preds = %25, %20
%22 = load i64, i64* %6
%23 = icmp ne i64 %22, 0
br i1 %23, label %25, label %24
24: ; preds = %21
br label %32
25: ; preds = %21
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 2
%28 = load i8*, i8** %27
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %28)
%30 = load i64, i64* %6
%31 = add i64 %30, -1
store i64 %31, i64* %6
br label %21
32: ; preds = %24
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"usage: num string\00"
@.str.1 = [20 x i8] c"num must be numeric\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @errx(i32 2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @strtol(i8* %8, i32 0, i32 10)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = tail call i32 @errx(i32 2, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %21
13: ; preds = %6
%14 = getelementptr inbounds i8*, i8** %1, i64 2
br label %15
15: ; preds = %13, %15
%16 = phi i64 [ %9, %13 ], [ %19, %15 ]
%17 = load i8*, i8** %14
%18 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %17)
%19 = add i64 %16, -1
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %15
21: ; preds = %15, %11
ret i32 0
}