#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 *);
void printabc(int a, int b, int c) {
  for (; a > 0; a--)
    printf("a");
  for (; b > 0; b--)
    printf("b");
  for (; c > 0; c--)
    printf("c");
}


x86 assembly (clang, -O0):
<printabc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1145 <printabc+0x35>
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
jmp    1121 <printabc+0x11>
jmp    114a <printabc+0x3a>
cmpl   $0x0,-0x8(%rbp)
jle    116e <printabc+0x5e>
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    114a <printabc+0x3a>
jmp    1173 <printabc+0x63>
cmpl   $0x0,-0xc(%rbp)
jle    1197 <printabc+0x87>
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1173 <printabc+0x63>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printabc>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
test   %edi,%edi
jle    1142 <printabc+0x32>
mov    %edi,%ebx
add    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x61,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     1130 <printabc+0x20>
test   %ebp,%ebp
jle    1162 <printabc+0x52>
add    $0x1,%ebp
nopl   0x0(%rax)
mov    $0x62,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     1150 <printabc+0x40>
test   %r14d,%r14d
jle    1184 <printabc+0x74>
add    $0x1,%r14d
nopl   0x0(%rax,%rax,1)
mov    $0x63,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%r14d
cmp    $0x1,%r14d
ja     1170 <printabc+0x60>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @printabc(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %0, 0
br i1 %4, label %7, label %5
5: ; preds = %7, %3
%6 = icmp sgt i32 %1, 0
br i1 %6, label %14, label %12
7: ; preds = %3, %7
%8 = phi i32 [ %10, %7 ], [ %0, %3 ]
%9 = tail call i32 @putchar(i32 97)
%10 = add nsw i32 %8, -1
%11 = icmp ugt i32 %8, 1
br i1 %11, label %7, label %5
12: ; preds = %14, %5
%13 = icmp sgt i32 %2, 0
br i1 %13, label %19, label %24
14: ; preds = %5, %14
%15 = phi i32 [ %17, %14 ], [ %1, %5 ]
%16 = tail call i32 @putchar(i32 98)
%17 = add nsw i32 %15, -1
%18 = icmp ugt i32 %15, 1
br i1 %18, label %14, label %12
19: ; preds = %12, %19
%20 = phi i32 [ %22, %19 ], [ %2, %12 ]
%21 = tail call i32 @putchar(i32 99)
%22 = add nsw i32 %20, -1
%23 = icmp ugt i32 %20, 1
br i1 %23, label %19, label %24
24: ; preds = %19, %12
ret void
}