#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 */
char tolower(char);
char toupper(char);
void c_jfc_traduire(char *cle, int cletype) {
  if (cletype == 0) {
    while (*cle) {
      *cle = toupper(*cle);
      cle++;
    }
  } else if (cletype == 1) {
    while (*cle) {
      *cle = tolower(*cle);
      cle++;
    }
  }
}


x86 assembly (clang, -O0):
<c_jfc_traduire>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1175 <c_jfc_traduire+0x55>
jmp    113e <c_jfc_traduire+0x1e>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1170 <c_jfc_traduire+0x50>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    113e <c_jfc_traduire+0x1e>
jmp    11c0 <c_jfc_traduire+0xa0>
cmpl   $0x1,-0xc(%rbp)
jne    11bb <c_jfc_traduire+0x9b>
jmp    1184 <c_jfc_traduire+0x64>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     11b6 <c_jfc_traduire+0x96>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1040 <tolower@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1184 <c_jfc_traduire+0x64>
jmp    11bb <c_jfc_traduire+0x9b>
jmp    11c0 <c_jfc_traduire+0xa0>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_jfc_traduire>:
push   %rbx
mov    %rdi,%rbx
test   %esi,%esi
je     1158 <c_jfc_traduire+0x38>
cmp    $0x1,%esi
jne    1186 <c_jfc_traduire+0x66>
mov    (%rbx),%al
test   %al,%al
je     1186 <c_jfc_traduire+0x66>
add    $0x1,%rbx
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1040 <tolower@plt>
mov    %al,-0x1(%rbx)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1140 <c_jfc_traduire+0x20>
jmp    1186 <c_jfc_traduire+0x66>
mov    (%rbx),%al
test   %al,%al
je     1186 <c_jfc_traduire+0x66>
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl %al,%edi
call   1030 <toupper@plt>
mov    %al,-0x1(%rbx)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1170 <c_jfc_traduire+0x50>
pop    %rbx
ret

LLVM IR (-O0):
define void @c_jfc_traduire(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %20
7: ; preds = %2
br label %8
8: ; preds = %12, %7
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
br i1 %11, label %12, label %19
12: ; preds = %8
%13 = load i8*, i8** %3
%14 = load i8, i8* %13
%15 = call signext i8 @toupper(i8 signext %14)
%16 = load i8*, i8** %3
store i8 %15, i8* %16
%17 = load i8*, i8** %3
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %3
br label %8
19: ; preds = %8
br label %37
20: ; preds = %2
%21 = load i32, i32* %4
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %36
23: ; preds = %20
br label %24
24: ; preds = %28, %23
%25 = load i8*, i8** %3
%26 = load i8, i8* %25
%27 = icmp ne i8 %26, 0
br i1 %27, label %28, label %35
28: ; preds = %24
%29 = load i8*, i8** %3
%30 = load i8, i8* %29
%31 = call signext i8 @tolower(i8 signext %30)
%32 = load i8*, i8** %3
store i8 %31, i8* %32
%33 = load i8*, i8** %3
%34 = getelementptr inbounds i8, i8* %33, i32 1
store i8* %34, i8** %3
br label %24
35: ; preds = %24
br label %36
36: ; preds = %35, %20
br label %37
37: ; preds = %36, %19
ret void
}

LLVM IR (-O2):
define void @c_jfc_traduire(i8* nocapture %0, i32 %1) {
switch i32 %1, label %23 [
i32 0, label %6
i32 1, label %3
]
3: ; preds = %2
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %23, label %16
6: ; preds = %2
%7 = load i8, i8* %0
%8 = icmp eq i8 %7, 0
br i1 %8, label %23, label %9
9: ; preds = %6, %9
%10 = phi i8 [ %14, %9 ], [ %7, %6 ]
%11 = phi i8* [ %13, %9 ], [ %0, %6 ]
%12 = tail call signext i8 @toupper(i8 signext %10)
store i8 %12, i8* %11
%13 = getelementptr inbounds i8, i8* %11, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %23, label %9
16: ; preds = %3, %16
%17 = phi i8 [ %21, %16 ], [ %4, %3 ]
%18 = phi i8* [ %20, %16 ], [ %0, %3 ]
%19 = tail call signext i8 @tolower(i8 signext %17)
store i8 %19, i8* %18
%20 = getelementptr inbounds i8, i8* %18, i64 1
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 0
br i1 %22, label %23, label %16
23: ; preds = %16, %9, %3, %6, %2
ret void
}