#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 *, ...);
int main() {
  int a = 3;
  printf("~a+a=%d\n", ~a + a);
  unsigned short b = 6;
  printf("~b+b=%d\n", ~b + b);
  char ch = 'A';
  switch (ch) {
  case 'A':
    printf("A\n");
    break;
  default:
    printf("other\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%esi
not    %esi
add    %eax,%esi
lea    0xeca(%rip),%rdi
xor    %eax,%eax
mov    %al,-0xc(%rbp)
call   1030 <printf@plt>
mov    -0xc(%rbp),%al
movw   $0x6,-0xa(%rbp)
movzwl -0xa(%rbp),%ecx
mov    %ecx,%esi
not    %esi
add    %ecx,%esi
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
movb   $0x41,-0xb(%rbp)
mov    -0xb(%rbp),%al
sub    $0x41,%al
jne    1186 <main+0x76>
jmp    1173 <main+0x63>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1194 <main+0x84>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
mov    $0xffffffff,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xece(%rip),%rdi
mov    $0xffffffff,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec4(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"~a+a=%d\0A\00"
@.str.1 = [9 x i8] c"~b+b=%d\0A\00"
@.str.2 = [3 x i8] c"A\0A\00"
@.str.3 = [7 x i8] c"other\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i16
%4 = alloca i8
store i32 0, i32* %1
store i32 3, i32* %2
%5 = load i32, i32* %2
%6 = xor i32 %5, -1
%7 = load i32, i32* %2
%8 = add nsw i32 %6, %7
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %8)
store i16 6, i16* %3
%10 = load i16, i16* %3
%11 = zext i16 %10 to i32
%12 = xor i32 %11, -1
%13 = load i16, i16* %3
%14 = zext i16 %13 to i32
%15 = add nsw i32 %12, %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %15)
store i8 65, i8* %4
%17 = load i8, i8* %4
%18 = sext i8 %17 to i32
switch i32 %18, label %21 [
i32 65, label %19
]
19: ; preds = %0
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %23
21: ; preds = %0
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %23
23: ; preds = %21, %19
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"~a+a=%d\0A\00"
@.str.1 = [9 x i8] c"~b+b=%d\0A\00"
@str = [2 x i8] c"A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 -1)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 -1)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret i32 0
}