#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 */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char const *, int, char const *);
int main(void) {
  uint8_t value = 42;
  const char *string = "test";
  const char *format = "Logging value %d and string %s";
  printf(format, value, string);
  printf(format, value, string);
  printf(format, value, string);
  printf(format, value, string);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2a,-0x8(%rbp)
lea    0xed3(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xecd(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xeea(%rip),%rbx
lea    0xede(%rip),%r14
mov    %rbx,%rdi
mov    $0x2a,%esi
mov    %r14,%rdx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2a,%esi
mov    %r14,%rdx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2a,%esi
mov    %r14,%rdx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2a,%esi
mov    %r14,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"test\00"
@.str.1 = [31 x i8] c"Logging value %d and string %s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
store i32 0, i32* %1
store i32 42, i32* %2
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %3
store i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8** %4
%5 = load i8*, i8** %4
%6 = load i32, i32* %2
%7 = load i8*, i8** %3
%8 = call i32 @printf(i8* %5, i32 %6, i8* %7)
%9 = load i8*, i8** %4
%10 = load i32, i32* %2
%11 = load i8*, i8** %3
%12 = call i32 @printf(i8* %9, i32 %10, i8* %11)
%13 = load i8*, i8** %4
%14 = load i32, i32* %2
%15 = load i8*, i8** %3
%16 = call i32 @printf(i8* %13, i32 %14, i8* %15)
%17 = load i8*, i8** %4
%18 = load i32, i32* %2
%19 = load i8*, i8** %3
%20 = call i32 @printf(i8* %17, i32 %18, i8* %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"test\00"
@.str.1 = [31 x i8] c"Logging value %d and string %s\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 42, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 42, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 42, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 42, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 0
}