#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 *, ...);
int main(int argc, char **argv) {
  char s[] = {'h', 'i', 0};
  int a[3];
  a[0] = 1;
  printf(" %i \n", a[0]);
  printf(" %s \n", s);
  for (int i = 0; s[i] != 0; ++i) {
    printf("char is %c \n", s[i]);
  }
  for (char *cp = s; *cp; ++cp) {
    printf("char is %c \n", *cp);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xed3(%rip),%ax
mov    %ax,-0x13(%rbp)
mov    0xecb(%rip),%al
mov    %al,-0x11(%rbp)
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%esi
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x13(%rbp),%rsi
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rax
movsbl -0x13(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     11a2 <main+0x92>
movslq -0x24(%rbp),%rax
movsbl -0x13(%rbp,%rax,1),%esi
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    116b <main+0x5b>
lea    -0x13(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmpb   $0x0,(%rax)
je     11dd <main+0xcd>
mov    -0x30(%rbp),%rax
movsbl (%rax),%esi
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    11aa <main+0x9a>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movb   $0x0,0x6(%rsp)
movw   $0x6968,0x4(%rsp)
lea    0xedc(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%al
test   %al,%al
je     11a8 <main+0x98>
lea    0x5(%rsp),%rbx
lea    0xeb5(%rip),%r14
nopw   0x0(%rax,%rax,1)
movsbl %al,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1160 <main+0x50>
mov    0x4(%rsp),%al
test   %al,%al
je     11a8 <main+0x98>
lea    0x5(%rsp),%rbx
lea    0xe83(%rip),%r14
nopl   0x0(%rax)
movsbl %al,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1190 <main+0x80>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.s = [3 x i8] c"hi\00"
@.str = [6 x i8] c" %i \0A\00"
@.str.1 = [6 x i8] c" %s \0A\00"
@.str.2 = [13 x i8] c"char is %c \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [3 x i8]
%7 = alloca [3 x i32]
%8 = alloca i32
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = bitcast [3 x i8]* %6 to i8*
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
store i32 1, i32* %11
%12 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
%13 = load i32, i32* %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %15)
store i32 0, i32* %8
br label %17
17: ; preds = %31, %2
%18 = load i32, i32* %8
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %34
24: ; preds = %17
%25 = load i32, i32* %8
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 %26
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %24
%32 = load i32, i32* %8
%33 = add nsw i32 %32, 1
store i32 %33, i32* %8
br label %17
34: ; preds = %17
%35 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 0
store i8* %35, i8** %9
br label %36
36: ; preds = %45, %34
%37 = load i8*, i8** %9
%38 = load i8, i8* %37
%39 = icmp ne i8 %38, 0
br i1 %39, label %40, label %48
40: ; preds = %36
%41 = load i8*, i8** %9
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %43)
br label %45
45: ; preds = %40
%46 = load i8*, i8** %9
%47 = getelementptr inbounds i8, i8* %46, i32 1
store i8* %47, i8** %9
br label %36
48: ; preds = %36
ret i32 0
}

LLVM IR (-O2):
@__const.main.s = [3 x i8] c"hi\00"
@.str = [6 x i8] c" %i \0A\00"
@.str.1 = [6 x i8] c" %s \0A\00"
@.str.2 = [13 x i8] c"char is %c \0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [3 x i8]
%4 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 1)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%7 = load i8, i8* %4
%8 = icmp eq i8 %7, 0
br i1 %8, label %21, label %12
9: ; preds = %12
%10 = load i8, i8* %4
%11 = icmp eq i8 %10, 0
br i1 %11, label %21, label %22
12: ; preds = %2, %12
%13 = phi i64 [ %17, %12 ], [ 0, %2 ]
%14 = phi i8 [ %19, %12 ], [ %7, %2 ]
%15 = sext i8 %14 to i32
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = add nuw i64 %13, 1
%18 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 0
br i1 %20, label %9, label %12
21: ; preds = %22, %2, %9
ret i32 0
22: ; preds = %9, %22
%23 = phi i8 [ %28, %22 ], [ %10, %9 ]
%24 = phi i8* [ %27, %22 ], [ %4, %9 ]
%25 = sext i8 %23 to i32
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %25)
%27 = getelementptr inbounds i8, i8* %24, i64 1
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 0
br i1 %29, label %21, label %22
}