#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 *, char *);
int main() {
  int i = 5;
  char *str = i % 2 == 0   ? "a"
              : i % 3 == 0 ? "b"
              : i % 5 == 0 ? "c"
              : i % 7 == 0 ? "d"
                           : "e";
  printf("%s\n", str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    114a <main+0x3a>
lea    0xebf(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    11c6 <main+0xb6>
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    116e <main+0x5e>
lea    0xe9d(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    11be <main+0xae>
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1192 <main+0x82>
lea    0xe7b(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    11b6 <main+0xa6>
mov    -0x8(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
lea    0xe64(%rip),%rax
lea    0xe5b(%rip),%rcx
cmp    $0x0,%edx
cmove  %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe31(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeea(%rip),%rdi
lea    0xee1(%rip),%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
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"
@.str.3 = [2 x i8] c"d\00"
@.str.4 = [2 x i8] c"e\00"
@.str.5 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
store i32 0, i32* %1
store i32 5, i32* %2
%4 = load i32, i32* %2
%5 = srem i32 %4, 2
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %0
br label %28
8: ; preds = %0
%9 = load i32, i32* %2
%10 = srem i32 %9, 3
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
br label %26
13: ; preds = %8
%14 = load i32, i32* %2
%15 = srem i32 %14, 5
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13
br label %24
18: ; preds = %13
%19 = load i32, i32* %2
%20 = srem i32 %19, 7
%21 = icmp eq i32 %20, 0
%22 = zext i1 %21 to i64
%23 = select i1 %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0)
br label %24
24: ; preds = %18, %17
%25 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), %17 ], [ %23, %18 ]
br label %26
26: ; preds = %24, %12
%27 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), %12 ], [ %25, %24 ]
br label %28
28: ; preds = %26, %7
%29 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %7 ], [ %27, %26 ]
store i8* %29, i8** %3
%30 = load i8*, i8** %3
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %30)
ret i32 0
}

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