#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() {
  char msg[10] = "Hi there!";
  printf("Hello, world!\n");
  printf("Hello, %s!\n", "world!");
  printf("%s\n", msg);
  printf("%d divided by %d is %d with remainder %d.\n", 10, 3, 10 / 3, 10 % 3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0xe(%rbp)
mov    0xed7(%rip),%ax
mov    %ax,-0x6(%rbp)
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
lea    0xed4(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xe(%rbp),%rsi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
mov    $0xa,%esi
mov    $0x3,%ecx
mov    $0x1,%r8d
mov    %ecx,%edx
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movabs $0x6572656874206948,%rax
65 72 65
mov    %rax,0x8(%rsp)
movw   $0x21,0x10(%rsp)
lea    0xf00(%rip),%rdi
call   1030 <puts@plt>
lea    0xebd(%rip),%rdi
lea    0xef4(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rdi
call   1030 <puts@plt>
lea    0xeaa(%rip),%rdi
mov    $0xa,%esi
mov    $0x3,%edx
mov    $0x3,%ecx
mov    $0x1,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.msg = [10 x i8] c"Hi there!\00"
@.str = [15 x i8] c"Hello, world!\0A\00"
@.str.1 = [12 x i8] c"Hello, %s!\0A\00"
@.str.2 = [7 x i8] c"world!\00"
@.str.3 = [4 x i8] c"%s\0A\00"
@.str.4 = [43 x i8] c"%d divided by %d is %d with remainder %d.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
store i32 0, i32* %1
%3 = bitcast [10 x i8]* %2 to i8*
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i32 10, i32 3, i32 3, i32 1)
ret i32 0
}

LLVM IR (-O2):
@__const.main.msg = [10 x i8] c"Hi there!\00"
@.str.1 = [12 x i8] c"Hello, %s!\0A\00"
@.str.2 = [7 x i8] c"world!\00"
@.str.4 = [43 x i8] c"%d divided by %d is %d with remainder %d.\0A\00"
@str = [14 x i8] c"Hello, world!\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @puts(i8* %2)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i32 10, i32 3, i32 3, i32 1)
ret i32 0
}