#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*/ printf(char *, ...);
main() {
  int integer = 231, i = 0;
  char str[10] = {0};
  while (integer) {
    str[i++] = (char)((integer % 10) + 48);
    integer /= 10;
  }
  printf("%s,", str);
  while (i--) {
    printf("%c", str[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xe7,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0x16(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <memset@plt>
cmpl   $0x0,-0x8(%rbp)
je     118b <main+0x6b>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%cl
mov    -0xc(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
cltq
mov    %cl,-0x16(%rbp,%rax,1)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    114d <main+0x2d>
lea    -0x16(%rbp),%rsi
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
je     11cd <main+0xad>
movslq -0xc(%rbp),%rax
movsbl -0x16(%rbp,%rax,1),%esi
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    119d <main+0x7d>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movl   $0x0,0x14(%rsp)
movl   $0x0,0x11(%rsp)
movw   $0x3331,0xe(%rsp)
movb   $0x32,0x10(%rsp)
lea    0xeb9(%rip),%rdi
lea    0xe(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
movsbl 0x10(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0xf(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0xe(%rsp),%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s,\00"
@.str.1 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [10 x i8]
store i32 0, i32* %1
store i32 231, i32* %2
store i32 0, i32* %3
%5 = bitcast [10 x i8]* %4 to i8*
br label %6
6: ; preds = %9, %0
%7 = load i32, i32* %2
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %20
9: ; preds = %6
%10 = load i32, i32* %2
%11 = srem i32 %10, 10
%12 = add nsw i32 %11, 48
%13 = trunc i32 %12 to i8
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
%16 = sext i32 %14 to i64
%17 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 %16
store i8 %13, i8* %17
%18 = load i32, i32* %2
%19 = sdiv i32 %18, 10
store i32 %19, i32* %2
br label %6
20: ; preds = %6
%21 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %27, %20
%24 = load i32, i32* %3
%25 = add nsw i32 %24, -1
store i32 %25, i32* %3
%26 = icmp ne i32 %24, 0
br i1 %26, label %27, label %34
27: ; preds = %23
%28 = load i32, i32* %3
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %32)
br label %23
34: ; preds = %23
%35 = load i32, i32* %1
ret i32 %35
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s,\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 3
store i8 49, i8* %2
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 1
store i8 51, i8* %4
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 2
store i8 50, i8* %5
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%7 = load i8, i8* %5
%8 = sext i8 %7 to i32
%9 = call i32 @putchar(i32 %8)
%10 = load i8, i8* %4
%11 = sext i8 %10 to i32
%12 = call i32 @putchar(i32 %11)
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = call i32 @putchar(i32 %14)
ret i32 0
}