int main() {
  int i;
  int suit;
  char *color;
  char *symbolfilename;
  typedef struct card {
    int *i;
  };
  for (i = 1; i < 15; i++) {
    if (i < 10) {
      for (suit = 1; suit < 5; suit++) {
        char color[8];
        if (suit <= 2) {
          strcpy(color, "black");
        } else if (suit > 2) {
          strcpy(color, "red");
        }
        sprintf(symbolfilename, "/images/%s-%i.ppm", color, i);
        printf("%s\n", symbolfilename);
      }
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0xf,-0x8(%rbp)
jge    11fa <main+0xca>
cmpl   $0xa,-0x8(%rbp)
jge    11e7 <main+0xb7>
movl   $0x1,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    11e2 <main+0xb2>
cmpl   $0x2,-0xc(%rbp)
jg     118a <main+0x5a>
lea    -0x28(%rbp),%rdi
lea    0xe80(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11a9 <main+0x79>
cmpl   $0x2,-0xc(%rbp)
jle    11a4 <main+0x74>
lea    -0x28(%rbp),%rdi
lea    0xe67(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11a9 <main+0x79>
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rdx
mov    -0x8(%rbp),%ecx
lea    0xe4f(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    -0x20(%rbp),%rsi
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1161 <main+0x31>
jmp    11e7 <main+0xb7>
jmp    11ec <main+0xbc>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    $0x1,%ebx
lea    0xed1(%rip),%r14
lea    0x8(%rsp),%r15
jmp    114c <main+0x2c>
nopl   0x0(%rax)
add    $0x1,%ebx
cmp    $0xf,%ebx
je     11d4 <main+0xb4>
cmp    $0x9,%ebx
ja     1140 <main+0x20>
movw   $0x6b,0xc(%rsp)
movl   $0x63616c62,0x8(%rsp)
63
mov    %r14,%rsi
mov    %r15,%rdx
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <sprintf@plt>
call   1030 <puts@plt>
movw   $0x6b,0xc(%rsp)
movl   $0x63616c62,0x8(%rsp)
63
mov    %r14,%rsi
mov    %r15,%rdx
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <sprintf@plt>
call   1030 <puts@plt>
movl   $0x646572,0x8(%rsp)
mov    %r14,%rsi
mov    %r15,%rdx
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <sprintf@plt>
call   1030 <puts@plt>
movl   $0x646572,0x8(%rsp)
mov    %r14,%rsi
mov    %r15,%rdx
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <sprintf@plt>
call   1030 <puts@plt>
jmp    1140 <main+0x20>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"black\00"
@.str.2 = [18 x i8] c"/images/%s-%i.ppm\00"
define i32 @main() {
%1 = alloca [8 x i8]
%2 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 0
%3 = bitcast [8 x i8]* %1 to i32*
br label %4
4: ; preds = %0, %16
%5 = phi i32 [ 1, %0 ], [ %17, %16 ]
%6 = icmp ult i32 %5, 10
br i1 %6, label %7, label %16
7: ; preds = %4
%8 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) undef, i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %2, i32 %5)
%9 = call i32 @puts(i8* dereferenceable(1) undef)
%10 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) undef, i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %2, i32 %5)
%11 = call i32 @puts(i8* dereferenceable(1) undef)
store i32 6579570, i32* %3
%12 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) undef, i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %2, i32 %5)
%13 = call i32 @puts(i8* dereferenceable(1) undef)
store i32 6579570, i32* %3
%14 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) undef, i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %2, i32 %5)
%15 = call i32 @puts(i8* dereferenceable(1) undef)
br label %16
16: ; preds = %7, %4
%17 = add nuw nsw i32 %5, 1
%18 = icmp eq i32 %17, 15
br i1 %18, label %19, label %4
19: ; preds = %16
ret i32 0
}