#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*/ rev(char *, int);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  char s[100], ch;
  int n, i, c;
  scanf("%d\n", &n);
  scanf("%c", &ch);
  for (i = 0; i < n; i++) {
    s[i] = ch;
    scanf("%c", &ch);
  }
  s[n] = '\0';
  rev(s, n - 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
lea    -0x78(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeb9(%rip),%rdi
lea    -0x71(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x78(%rbp),%eax
jge    1194 <main+0x74>
mov    -0x71(%rbp),%cl
movslq -0x7c(%rbp),%rax
mov    %cl,-0x70(%rbp,%rax,1)
lea    0xe89(%rip),%rdi
lea    -0x71(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    115d <main+0x3d>
movslq -0x78(%rbp),%rax
movb   $0x0,-0x70(%rbp,%rax,1)
lea    -0x70(%rbp),%rdi
mov    -0x78(%rbp),%esi
sub    $0x1,%esi
call   1030 <rev@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
lea    0xecd(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xebe(%rip),%rdi
lea    0xb(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    1194 <main+0x74>
lea    0xea3(%rip),%r14
lea    0xb(%rsp),%r15
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movzbl 0xb(%rsp),%eax
mov    %al,0x10(%rsp,%rbx,1)
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     1170 <main+0x50>
movslq %eax,%rsi
movb   $0x0,0x10(%rsp,%rsi,1)
add    $0xffffffff,%esi
lea    0x10(%rsp),%rdi
call   1030 <rev@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %4)
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
store i32 0, i32* %5
br label %9
9: ; preds = %19, %0
%10 = load i32, i32* %5
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %22
13: ; preds = %9
%14 = load i8, i8* %3
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %16
store i8 %14, i8* %17
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
br label %19
19: ; preds = %13
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %9
22: ; preds = %9
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %24
store i8 0, i8* %25
%26 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%27 = load i32, i32* %4
%28 = sub nsw i32 %27, 1
%29 = call i32 @rev(i8* %26, i32 %28)
ret i32 0
}

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