#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 getpid();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ system(char *);
void do_nothing2() {
  if (getpid() & 1)
    printf("something %x\n", getpid() + 3 * getpid());
  else
    printf("something else %x\n", getpid() % 3);
  system("df");
}


x86 assembly (clang, -O0):
<do_nothing2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getpid@plt>
and    $0x1,%eax
cmp    $0x0,%eax
je     1175 <do_nothing2+0x45>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x4(%rbp),%esi
imul   $0x3,%eax,%eax
add    %eax,%esi
lea    0xe95(%rip),%rdi
call   1050 <printf@plt>
jmp    1192 <do_nothing2+0x62>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
lea    0xe81(%rip),%rdi
call   1050 <printf@plt>
lea    0xe88(%rip),%rdi
call   1040 <system@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_nothing2>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%ebx
test   $0x1,%bpl
jne    1172 <do_nothing2+0x42>
movslq %ebx,%rax
imul   $0x55555556,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%ebx
lea    0xea0(%rip),%rdi
mov    %ebx,%esi
jmp    1185 <do_nothing2+0x55>
xor    %eax,%eax
call   1030 <getpid@plt>
lea    (%rax,%rax,2),%esi
add    %ebx,%esi
lea    0xe7b(%rip),%rdi
call   1050 <printf@plt>
lea    0xe90(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <system@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"something %x\0A\00"
@.str.1 = [19 x i8] c"something else %x\0A\00"
@.str.2 = [3 x i8] c"df\00"
define void @do_nothing2() {
%1 = call i32 (...) @getpid()
%2 = and i32 %1, 1
%3 = icmp ne i32 %2, 0
br i1 %3, label %4, label %10
4: ; preds = %0
%5 = call i32 (...) @getpid()
%6 = call i32 (...) @getpid()
%7 = mul nsw i32 3, %6
%8 = add nsw i32 %5, %7
%9 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %8)
br label %14
10: ; preds = %0
%11 = call i32 (...) @getpid()
%12 = srem i32 %11, 3
%13 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %10, %4
%15 = call i32 @system(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"something %x\0A\00"
@.str.1 = [19 x i8] c"something else %x\0A\00"
@.str.2 = [3 x i8] c"df\00"
define void @do_nothing2() {
%1 = tail call i32 (...) @getpid()
%2 = and i32 %1, 1
%3 = icmp eq i32 %2, 0
%4 = tail call i32 (...) @getpid()
br i1 %3, label %10, label %5
5: ; preds = %0
%6 = tail call i32 (...) @getpid()
%7 = mul nsw i32 %6, 3
%8 = add nsw i32 %7, %4
%9 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %8)
br label %13
10: ; preds = %0
%11 = srem i32 %4, 3
%12 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %10, %5
%14 = tail call i32 @system(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret void
}