#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*/ call_to_undeclared_function();
int /*<<< orphan*/ i_return_nothing();
int /*<<< orphan*/ not_a_prototype_i(int, int, int);
int printf(char *);
void this_one_is_wrong(void) {
  int i;
  call_to_undeclared_function();
  not_a_prototype_i(1, 2, 3);
  printf("This is a test.\n");
  if (1 > 0) {
    printf("first\n");
    printf("second\n");
  }
  for (i = 0; printf("omg\n"), i < 12; ++i) {
  }
  (void)i_return_nothing();
  (void)i_return_nothing();
  (void)i_return_nothing();
}


x86 assembly (clang, -O0):
<this_one_is_wrong>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <call_to_undeclared_function@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
call   1030 <not_a_prototype_i@plt>
lea    0xe96(%rip),%rdi
call   1040 <printf@plt>
lea    0xe9b(%rip),%rdi
call   1040 <printf@plt>
lea    0xe96(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
lea    0xe8b(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0xc,-0x4(%rbp)
jge    11b7 <this_one_is_wrong+0x77>
jmp    11a9 <this_one_is_wrong+0x69>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    118e <this_one_is_wrong+0x4e>
mov    $0x0,%al
call   1050 <i_return_nothing@plt>
mov    $0x0,%al
call   1050 <i_return_nothing@plt>
mov    $0x0,%al
call   1050 <i_return_nothing@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<this_one_is_wrong>:
push   %rbx
xor    %eax,%eax
call   1060 <call_to_undeclared_function@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
call   1040 <not_a_prototype_i@plt>
lea    0xe9d(%rip),%rdi
call   1030 <puts@plt>
lea    0xea1(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9b(%rip),%rdi
call   1030 <puts@plt>
lea    0xe96(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <i_return_nothing@plt>
xor    %eax,%eax
call   1050 <i_return_nothing@plt>
xor    %eax,%eax
pop    %rbx
jmp    1050 <i_return_nothing@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"This is a test.\0A\00"
@.str.1 = [7 x i8] c"first\0A\00"
@.str.2 = [8 x i8] c"second\0A\00"
@.str.3 = [5 x i8] c"omg\0A\00"
define void @this_one_is_wrong() {
%1 = alloca i32
%2 = call i32 (...) @call_to_undeclared_function()
%3 = call i32 @not_a_prototype_i(i32 1, i32 2, i32 3)
%4 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %7
7: ; preds = %12, %0
%8 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%9 = load i32, i32* %1
%10 = icmp slt i32 %9, 12
br i1 %10, label %11, label %15
11: ; preds = %7
br label %12
12: ; preds = %11
%13 = load i32, i32* %1
%14 = add nsw i32 %13, 1
store i32 %14, i32* %1
br label %7
15: ; preds = %7
%16 = call i32 (...) @i_return_nothing()
%17 = call i32 (...) @i_return_nothing()
%18 = call i32 (...) @i_return_nothing()
ret void
}

LLVM IR (-O2):
@str = [16 x i8] c"This is a test.\00"
@str.4 = [6 x i8] c"first\00"
@str.5 = [7 x i8] c"second\00"
@str.6 = [4 x i8] c"omg\00"
define void @this_one_is_wrong() {
%1 = tail call i32 (...) @call_to_undeclared_function()
%2 = tail call i32 @not_a_prototype_i(i32 1, i32 2, i32 3)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.4, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.5, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.6, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.6, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.6, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.6, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.6, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.6, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.6, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.6, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.6, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.6, i64 0, i64 0))
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.6, i64 0, i64 0))
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.6, i64 0, i64 0))
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.6, i64 0, i64 0))
%19 = tail call i32 (...) @i_return_nothing()
%20 = tail call i32 (...) @i_return_nothing()
%21 = tail call i32 (...) @i_return_nothing()
ret void
}