#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*/ get_input(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ reverse(char *);
scalar_t__ strtol(char *, int /*<<< orphan*/ *, int);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    printf("ERROR: Please provide an integer greater than or equal to 0\n");
    return 0;
  }
  int N = (int)strtol(argv[1], NULL, 10);
  if (N < 0) {
    printf("ERROR: Please provide an integer greater than or equal to 0\n");
    return 0;
  }
  char input[80];
  int i;
  for (i = 0; i < N; i++) {
    get_input(input);
    reverse(input);
    printf("%s\n", input);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     117d <main+0x3d>
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1206 <main+0xc6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    11ba <main+0x7a>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1206 <main+0xc6>
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11ff <main+0xbf>
lea    -0x70(%rbp),%rdi
call   1060 <get_input@plt>
lea    -0x70(%rbp),%rdi
call   1030 <reverse@plt>
lea    -0x70(%rbp),%rsi
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    11c1 <main+0x81>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x58,%rsp
cmp    $0x2,%edi
jne    118f <main+0x4f>
mov    0x8(%rsi),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %rax,%rbx
test   %ebx,%ebx
js     118f <main+0x4f>
je     119b <main+0x5b>
mov    %rsp,%r14
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1060 <get_input@plt>
mov    %r14,%rdi
call   1030 <reverse@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
add    $0xffffffff,%ebx
jne    1170 <main+0x30>
jmp    119b <main+0x5b>
lea    0xe6a(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [61 x i8] c"ERROR: Please provide an integer greater than or equal to 0\0A\00"
@.str.1 = [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 i32
%7 = alloca [80 x 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 ne i32 %9, 2
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %39
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i64 @strtol(i8* %16, i32* null, i32 10)
%18 = trunc i64 %17 to i32
store i32 %18, i32* %6
%19 = load i32, i32* %6
%20 = icmp slt i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %13
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %39
23: ; preds = %13
store i32 0, i32* %8
br label %24
24: ; preds = %35, %23
%25 = load i32, i32* %8
%26 = load i32, i32* %6
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %38
28: ; preds = %24
%29 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%30 = call i32 @get_input(i8* %29)
%31 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%32 = call i32 @reverse(i8* %31)
%33 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %33)
br label %35
35: ; preds = %28
%36 = load i32, i32* %8
%37 = add nsw i32 %36, 1
store i32 %37, i32* %8
br label %24
38: ; preds = %24
store i32 0, i32* %3
br label %39
39: ; preds = %38, %21, %11
%40 = load i32, i32* %3
ret i32 %40
}

LLVM IR (-O2):
@str.2 = [60 x i8] c"ERROR: Please provide an integer greater than or equal to 0\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [80 x i8]
%4 = icmp eq i32 %0, 2
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str.2, i64 0, i64 0))
br label %26
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i64 @strtol(i8* nocapture %9, i32* null, i32 10)
%11 = trunc i64 %10 to i32
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %7
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str.2, i64 0, i64 0))
br label %26
15: ; preds = %7
%16 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%17 = icmp eq i32 %11, 0
br i1 %17, label %25, label %18
18: ; preds = %15, %18
%19 = phi i32 [ %23, %18 ], [ 0, %15 ]
%20 = call i32 @get_input(i8* %16)
%21 = call i32 @reverse(i8* %16)
%22 = call i32 @puts(i8* %16)
%23 = add nuw nsw i32 %19, 1
%24 = icmp eq i32 %23, %11
br i1 %24, label %25, label %18
25: ; preds = %18, %15
br label %26
26: ; preds = %13, %25, %5
ret i32 0
}