#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*/ increment(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
main() {
  char b[101] = "0", a[100];
  scanf("%s", a);
  strcat(b, a);
  printf("\nafter cat%s", b);
  increment(b);
  printf("\n%s", b);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x65,%edx
call   1050 <memset@plt>
movb   $0x30,-0x70(%rbp)
lea    -0xe0(%rbp),%rsi
lea    0xe91(%rip),%rdi
call   1060 <scanf@plt>
lea    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
call   1070 <strcat@plt>
lea    -0x70(%rbp),%rsi
lea    0xe63(%rip),%rdi
call   1040 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1030 <increment@plt>
lea    -0x70(%rbp),%rsi
lea    0xe57(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xd8,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x5d(%rsp)
movb   $0x30,(%rsp)
lea    0xe90(%rip),%rdi
lea    0x70(%rsp),%r14
mov    %r14,%rsi
call   1050 <scanf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcat@plt>
lea    0xe60(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <increment@plt>
lea    0xe56(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [13 x i8] c"\0Aafter cat%s\00"
@.str.2 = [4 x i8] c"\0A%s\00"
define i32 @main() {
%1 = alloca [101 x i8]
%2 = alloca [100 x i8]
%3 = bitcast [101 x i8]* %1 to i8*
%4 = bitcast i8* %3 to [101 x i8]*
%5 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i32 0, i32 0
store i8 48, i8* %5
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [101 x i8], [101 x i8]* %1, i64 0, i64 0
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%10 = call i32 @strcat(i8* %8, i8* %9)
%11 = getelementptr inbounds [101 x i8], [101 x i8]* %1, i64 0, i64 0
%12 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [101 x i8], [101 x i8]* %1, i64 0, i64 0
%14 = call i32 @increment(i8* %13)
%15 = getelementptr inbounds [101 x i8], [101 x i8]* %1, i64 0, i64 0
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [13 x i8] c"\0Aafter cat%s\00"
@.str.2 = [4 x i8] c"\0A%s\00"
define i32 @main() {
%1 = alloca [101 x i8]
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [101 x i8], [101 x i8]* %1, i64 0, i64 0
store i8 48, i8* %3
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @strcat(i8* %3, i8* %4)
%7 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%8 = call i32 @increment(i8* %3)
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %3)
ret i32 0
}